atom
The base type for nearly all physical objects in SS13
Lots and lots of functionality lives here, although in general we are striving to move as much as possible to the components/elements system
Vars | |
add_overlays | a very temporary list of overlays to add |
---|---|
article | If non-null, overrides a/an/some in all cases |
atom_colours | used to store the different colors on an atom |
attack_hand_is_action | Should we set last action for attack hand? This implies that attack_hands to this atom should flush to clickdelay buffers instead of discarding. |
attack_hand_speed | Amount of time to check for from a mob's last attack to allow an attack_hand(). |
attack_hand_unwieldlyness | Amount of time to hard stagger (no clicking at all) the mob post attack_hand(). Lower = better |
base_icon_state | Used for changing icon states for different base sprites. |
base_pixel_x | Default pixel x shifting for the atom's icon. |
base_pixel_y | Default pixel y shifting for the atom's icon. |
chat_color | Last color calculated for the the chatmessage overlays |
chat_color_darkened | A luminescence-shifted value of the last color calculated for chatmessage overlays |
chat_color_name | Last name used to calculate a color for the chatmessage overlays |
custom_materials | The custom materials this atom is made of, used by a lot of things like furniture, walls, and floors (if I finish the functionality, that is.) The list referenced by this var can be shared by multiple objects and should not be directly modified. Instead, use set_custom_materials. |
custom_premium_price | Price of an item in a vending machine, overriding the premium vending machine price. Define in terms of paycheck defines as opposed to raw numbers. |
custom_price | Price of an item in a vending machine, overriding the base vending machine price. Define in terms of paycheck defines as opposed to raw numbers. |
explosion_block | Value used to increment ex_act() if reactionary_explosions is on |
explosion_flags | Flags for explosions |
fingerprintslast | Last fingerprints to touch this atom |
flags_1 | First atom flags var |
hud_list | This atom's HUD (med/sec, etc) images. Associative list. |
hud_possible | HUD images that this atom can provide. |
interaction_flags_atom | Intearaction flags |
managed_overlays | overlays managed by update_overlays to prevent removing overlays that weren't added by the same proc |
managed_vis_overlays | vis overlays managed by SSvis_overlays to automaticaly turn them like other overlays |
material_flags | Bitfield for how the atom handles materials. |
material_modifier | Modifier that raises/lowers the effect of the amount of a material, prevents small and easy to get items from being death machines. |
orbit_target | Reference to atom being orbited |
pass_flags_self | pass_flags that we are. If any of this matches a pass_flag on a moving thing, by default, we let them through. |
proximity_monitor | Proximity monitor associated with this atom |
rad_insulation | Radiation insulation types |
reagents | Reagents holder |
realized_overlays | List of overlay "keys" (info about the appearance) -> mutable versions of static appearances Drawn from the overlays list |
realized_underlays | List of underlay "keys" (info about the appearance) -> mutable versions of static appearances Drawn from the underlays list |
remove_overlays | a very temporary list of overlays to remove |
ricochet_chance_mod | When a projectile tries to ricochet off this atom, the projectile ricochet chance is multiplied by this |
ricochet_damage_mod | When a projectile ricochets off this atom, it deals the normal damage * this modifier to this atom |
targeted_by | Mobs that are currently do_after'ing this atom, to be cleared from on Destroy() |
wave_explosion_block | Amount to decrease wave explosions by |
wave_explosion_multiply | Amount to multiply wave explosions by |
Procs | |
AltClickNoInteract | Use this instead of [/mob/proc/AltClickOn] where you only want turf content listing without additional atom alt-click interaction |
CanAllowThrough | Returns true or false to allow the mover to move through src |
ComponentInitialize | Put your AddComponent calls here |
Destroy | Top level of the destroy chain for most atoms |
Initialize | The primary method that objects are setup in SS13 with |
LateInitialize | Late Intialization, for code that should run after all atoms have run Intialization |
New | Called when an atom is created in byond (built in engine proc) |
Shake | Perform a shake on an atom, resets its position afterwards |
_contents | Wrapper to return a copy of contents, as SDQL2 can't tell an internal list from a normal list. |
add_context | Creates a "Type-B" contextual screentip interaction.
When a user hovers over this, this proc will be called in order
to provide context for contextual screentips.
You must call register_context() in order for this to be registered.
A screentip context list is a list that has context keys (SCREENTIP_CONTEXT_*, from __DEFINES/screentips.dm)
that map to the action as text.
If you mutate the list in this signal, you must return CONTEXTUAL_SCREENTIP_SET.
source can, in all cases, be replaced with src , and only exists because this proc directly connects to a signal. |
audible_message | Show a message to all mobs in earshot of this atom |
balloon_alert | Creates text that will float from the atom upwards to the viewer. |
balloon_alert_to_viewers | Create balloon alerts (text that floats up) to everything within range. Will only display to people who can see. |
bullet_act | React to a hit by a projectile object |
check_projectile_ricochet | Checks if a projectile should ricochet off of us. Projectiles get final say. [__DEFINES/projectiles.dm] for return values. |
connect_to_shuttle | Called after a shuttle is loaded from map template initially. |
examine_more | Called when a mob examines (shift click or verb) this atom twice (or more) within EXAMINE_MORE_TIME (default 1.5 seconds) |
get_examine_string | Generate the full examine string of this atom (including icon for goonchat) |
get_filter_index | Returns the indice in filters of the given filter name. If it is not found, returns null. |
has_gravity | Returns true if this atom has gravity for the passed in turf |
hitby | React to being hit by a thrown object |
hitby_react | We have have actually hit the passed in atom |
mat_update_desc | This proc is called when a material updates an object's description |
mech_melee_attack | Called when a mech melee attacks an atom |
ninjadrain_act | Atom level proc for space ninja's glove interactions. |
onAwayMission | Is the atom in an away mission |
onCentCom | Is this atom currently located on centcom |
onSyndieBase | Is the atom in any of the centcom syndicate areas |
realize_overlays | Takes the atoms's existing overlays and underlays, and makes them mutable so they can be properly vv'd in the realized_overlays/underlays list |
register_context | Create a "Type-B" contextual screentip interaction, registering to add_context() .
This will run add_context() when the atom is hovered over by an item for context.
add_context() will not be called unless this is run.
This is not necessary for Type-B interactions, as you can just apply the flag and register to the signal yourself. |
rust_heretic_act | Causes effects when the atom gets hit by a rust effect from heretics |
setClosed | Used to set something as 'closed' if it's being used as a supplypod |
setOpened | Used to set something as 'open' if it's being used as a supplypod |
set_custom_materials | Sets the custom materials for an item. |
set_light_color | Setter for the light color of this atom. |
set_light_range | Setter for the light range of this atom. |
shuttleRotate | Base proc |
update_appearance | Updates the appearence of the icon |
update_desc | Updates the description of the atom |
update_icon | Updates the icon of the atom |
update_icon_state | Updates the icon state of the atom |
update_name | Updates the name of the atom |
update_overlays | Builds a list of overlays for the atom, this will not apply them. If you need to update overlays, use [update_icon(UPDATE_OVERLAYS)], This proc is intended to be overridden. |
visible_message | Generate a visible message from this atom |
wave_ex_act | Called when a wave explosion hits this atom. |
wave_explode | Called when a wave explosion hits this atom. Do not override this. |
zap_act | Respond to a electric bolt action on our item |
Var Details
add_overlays
a very temporary list of overlays to add
article
If non-null, overrides a/an/some in all cases
atom_colours
used to store the different colors on an atom
its inherent color, the colored paint applied on it, special color effect etc...
attack_hand_is_action
Should we set last action for attack hand? This implies that attack_hands to this atom should flush to clickdelay buffers instead of discarding.
attack_hand_speed
Amount of time to check for from a mob's last attack to allow an attack_hand().
attack_hand_unwieldlyness
Amount of time to hard stagger (no clicking at all) the mob post attack_hand(). Lower = better
base_icon_state
Used for changing icon states for different base sprites.
base_pixel_x
Default pixel x shifting for the atom's icon.
base_pixel_y
Default pixel y shifting for the atom's icon.
chat_color
Last color calculated for the the chatmessage overlays
chat_color_darkened
A luminescence-shifted value of the last color calculated for chatmessage overlays
chat_color_name
Last name used to calculate a color for the chatmessage overlays
custom_materials
The custom materials this atom is made of, used by a lot of things like furniture, walls, and floors (if I finish the functionality, that is.) The list referenced by this var can be shared by multiple objects and should not be directly modified. Instead, use set_custom_materials.
custom_premium_price
Price of an item in a vending machine, overriding the premium vending machine price. Define in terms of paycheck defines as opposed to raw numbers.
custom_price
Price of an item in a vending machine, overriding the base vending machine price. Define in terms of paycheck defines as opposed to raw numbers.
explosion_block
Value used to increment ex_act() if reactionary_explosions is on
explosion_flags
Flags for explosions
fingerprintslast
Last fingerprints to touch this atom
flags_1
First atom flags var
hud_list
This atom's HUD (med/sec, etc) images. Associative list.
hud_possible
HUD images that this atom can provide.
interaction_flags_atom
Intearaction flags
managed_overlays
overlays managed by update_overlays to prevent removing overlays that weren't added by the same proc
managed_vis_overlays
vis overlays managed by SSvis_overlays to automaticaly turn them like other overlays
material_flags
Bitfield for how the atom handles materials.
material_modifier
Modifier that raises/lowers the effect of the amount of a material, prevents small and easy to get items from being death machines.
orbit_target
Reference to atom being orbited
pass_flags_self
pass_flags that we are. If any of this matches a pass_flag on a moving thing, by default, we let them through.
proximity_monitor
Proximity monitor associated with this atom
rad_insulation
Radiation insulation types
reagents
Reagents holder
realized_overlays
List of overlay "keys" (info about the appearance) -> mutable versions of static appearances Drawn from the overlays list
realized_underlays
List of underlay "keys" (info about the appearance) -> mutable versions of static appearances Drawn from the underlays list
remove_overlays
a very temporary list of overlays to remove
ricochet_chance_mod
When a projectile tries to ricochet off this atom, the projectile ricochet chance is multiplied by this
ricochet_damage_mod
When a projectile ricochets off this atom, it deals the normal damage * this modifier to this atom
targeted_by
Mobs that are currently do_after'ing this atom, to be cleared from on Destroy()
wave_explosion_block
Amount to decrease wave explosions by
wave_explosion_multiply
Amount to multiply wave explosions by
Proc Details
AltClickNoInteract
Use this instead of [/mob/proc/AltClickOn] where you only want turf content listing without additional atom alt-click interaction
CanAllowThrough
Returns true or false to allow the mover to move through src
ComponentInitialize
Put your AddComponent calls here
Destroy
Top level of the destroy chain for most atoms
Cleans up the following:
- Removes alternate apperances from huds that see them
- qdels the reagent holder from atoms if it exists
- clears the orbiters list
- clears overlays and priority overlays
- clears the light object
Initialize
The primary method that objects are setup in SS13 with
we don't use New as we have better control over when this is called and we can choose to delay calls or hook other logic in and so forth
During roundstart map parsing, atoms are queued for intialization in the base atom/New(), After the map has loaded, then Initalize is called on all atoms one by one. NB: this is also true for loading map templates as well, so they don't Initalize until all objects in the map file are parsed and present in the world
If you're creating an object at any point after SSInit has run then this proc will be immediately be called from New.
mapload: This parameter is true if the atom being loaded is either being intialized during the Atom subsystem intialization, or if the atom is being loaded from the map template. If the item is being created at runtime any time after the Atom subsystem is intialized then it's false.
You must always call the parent of this proc, otherwise failures will occur as the item will not be seen as initalized (this can lead to all sorts of strange behaviour, like the item being completely unclickable)
You must not sleep in this proc, or any subprocs
Any parameters from new are passed through (excluding loc), naturally if you're loading from a map there are no other arguments
Must return an initialization hint or a runtime will occur.
Note: the following functions don't call the base for optimization and must copypasta handling:
LateInitialize
Late Intialization, for code that should run after all atoms have run Intialization
To have your LateIntialize proc be called, your atoms Initalization proc must return the hint INITIALIZE_HINT_LATELOAD otherwise you will never be called.
useful for doing things like finding other machines on GLOB.machines because you can guarantee that all atoms will actually exist in the "WORLD" at this time and that all their Intialization code has been run
New
Called when an atom is created in byond (built in engine proc)
Not a lot happens here in SS13 code, as we offload most of the work to the Intialization proc, mostly we run the preloader if the preloader is being used and then call InitAtom of which the ultimate result is that the Intialize proc is called.
We also generate a tag here if the DF_USE_TAG flag is set on the atom
Shake
Perform a shake on an atom, resets its position afterwards
_contents
Wrapper to return a copy of contents, as SDQL2 can't tell an internal list from a normal list.
add_context
Creates a "Type-B" contextual screentip interaction.
When a user hovers over this, this proc will be called in order
to provide context for contextual screentips.
You must call register_context()
in order for this to be registered.
A screentip context list is a list that has context keys (SCREENTIP_CONTEXT_*, from __DEFINES/screentips.dm)
that map to the action as text.
If you mutate the list in this signal, you must return CONTEXTUAL_SCREENTIP_SET.
source
can, in all cases, be replaced with src
, and only exists because this proc directly connects to a signal.
audible_message
Show a message to all mobs in earshot of this atom
Use for objects performing audible actions
vars:
- message is the message output to anyone who can hear.
- deaf_message (optional) is what deaf people will see.
- hearing_distance (optional) is the range, how many tiles away the message can be heard.
- ignored_mobs (optional) doesn't show any message to any given mob in the list.
- runechat_popup (optional) if TRUE, will display a runechat popup using rune_msg if set otherwise it will use message and self_message accordingly.
- rune_msg (optional) is the message to display in the runechat popup.
balloon_alert
Creates text that will float from the atom upwards to the viewer.
balloon_alert_to_viewers
Create balloon alerts (text that floats up) to everything within range. Will only display to people who can see.
bullet_act
React to a hit by a projectile object
Default behaviour is to send the COMSIG_ATOM_BULLET_ACT and then call [on_hit][/obj/item/projectile/proc/on_hit] on the projectile
@params P - projectile def_zone - zone hit piercing_hit - is this hit piercing or normal?
check_projectile_ricochet
Checks if a projectile should ricochet off of us. Projectiles get final say. [__DEFINES/projectiles.dm] for return values.
connect_to_shuttle
Called after a shuttle is loaded from map template initially.
@params
- port - Mobile port/shuttle
- dock - Stationary dock the shuttle's at
- idnum - ID number of the shuttle
examine_more
Called when a mob examines (shift click or verb) this atom twice (or more) within EXAMINE_MORE_TIME (default 1.5 seconds)
This is where you can put extra information on something that may be superfluous or not important in critical gameplay moments, while allowing people to manually double-examine to take a closer look
Produces a signal COMSIG_PARENT_EXAMINE_MORE
get_examine_string
Generate the full examine string of this atom (including icon for goonchat)
get_filter_index
Returns the indice in filters of the given filter name. If it is not found, returns null.
has_gravity
Returns true if this atom has gravity for the passed in turf
Sends signals COMSIG_ATOM_HAS_GRAVITY and COMSIG_TURF_HAS_GRAVITY, both can force gravity with the forced gravity var
Gravity situations:
- No gravity if you're not in a turf
- No gravity if this atom is in is a space turf
- Gravity if the area it's in always has gravity
- Gravity if there's a gravity generator on the z level
- Gravity if the Z level has an SSMappingTrait for ZTRAIT_GRAVITY
- otherwise no gravity
hitby
React to being hit by a thrown object
Default behaviour is to call hitby_react on ourselves after 2 seconds if we are dense and under normal gravity.
Im not sure why this the case, maybe to prevent lots of hitby's if the thrown object is deleted shortly after hitting something (during explosions or other massive events that throw lots of items around - singularity being a notable example)
hitby_react
We have have actually hit the passed in atom
Default behaviour is to move back from the item that hit us
mat_update_desc
This proc is called when a material updates an object's description
mech_melee_attack
Called when a mech melee attacks an atom
ninjadrain_act
Atom level proc for space ninja's glove interactions.
Proc which only occurs when space ninja uses his gloves on an atom. Does nothing by default, but effects will vary. Arguments:
- ninja_suit - The offending space ninja's suit.
- ninja - The human mob wearing the suit.
- ninja_gloves - The offending space ninja's gloves.
onAwayMission
Is the atom in an away mission
Must be in the away mission z-level to return TRUE
Also used in gamemode code for win conditions
onCentCom
Is this atom currently located on centcom
Specifically, is it on the z level and within the centcom areas
You can also be in a shuttleshuttle during endgame transit
Used in gamemode to identify mobs who have escaped and for some other areas of the code who don't want atoms where they shouldn't be
onSyndieBase
Is the atom in any of the centcom syndicate areas
Either in the syndie base on centcom, or any of their shuttles
Also used in gamemode code for win conditions
realize_overlays
Takes the atoms's existing overlays and underlays, and makes them mutable so they can be properly vv'd in the realized_overlays/underlays list
register_context
Create a "Type-B" contextual screentip interaction, registering to add_context()
.
This will run add_context()
when the atom is hovered over by an item for context.
add_context()
will not be called unless this is run.
This is not necessary for Type-B interactions, as you can just apply the flag and register to the signal yourself.
rust_heretic_act
Causes effects when the atom gets hit by a rust effect from heretics
Override this if you want custom behaviour in whatever gets hit by the rust
setClosed
Used to set something as 'closed' if it's being used as a supplypod
Override this if you want an atom to be usable as a supplypod.
setOpened
Used to set something as 'open' if it's being used as a supplypod
Override this if you want an atom to be usable as a supplypod.
set_custom_materials
Sets the custom materials for an item.
set_light_color
Setter for the light color of this atom.
set_light_range
Setter for the light range of this atom.
shuttleRotate
Base proc
update_appearance
Updates the appearence of the icon
Mostly delegates to update_name, update_desc, and update_icon
Arguments:
- updates: A set of bitflags dictating what should be updated. Defaults to [ALL]
update_desc
Updates the description of the atom
update_icon
Updates the icon of the atom
update_icon_state
Updates the icon state of the atom
update_name
Updates the name of the atom
update_overlays
Builds a list of overlays for the atom, this will not apply them. If you need to update overlays, use [update_icon(UPDATE_OVERLAYS)], This proc is intended to be overridden.
visible_message
Generate a visible message from this atom
Show a message to all player mobs who sees this atom
Show a message to the src mob (if the src is a mob)
Use for atoms performing visible actions
message is output to anyone who can see, e.g. "The [src] does something!"
Vars:
- self_message (optional) is what the src mob sees e.g. "You do something!"
- blind_message (optional) is what blind people will hear e.g. "You hear something!"
- vision_distance (optional) define how many tiles away the message can be seen.
- ignored_mobs (optional) doesn't show any message to any given mob in the list.
- target (optional) is the other mob involved with the visible message. For example, the attacker in many combat messages.
- target_message (optional) is what the target mob will see e.g. "[src] does something to you!"
- omni (optional) if TRUE, will show to users no matter what.
- runechat_popup (optional) if TRUE, will display a runechat popup using rune_msg if set otherwise it will use message and self_message accordingly.
- rune_msg (optional) is the message to display in the runechat popup.
wave_ex_act
Called when a wave explosion hits this atom.
Returns explosion power to "allow through". Standard handling and flag overrides in [wave_explode()].
wave_explode
Called when a wave explosion hits this atom. Do not override this.
Returns explosion power to "allow through".
zap_act
Respond to a electric bolt action on our item
Default behaviour is to return, we define here to allow for cleaner code later on