Space Station 13 - Modules - TypesVar Details - Proc Details

machinery

Vars

active_power_usagePower usage for active machinery. Used if use_power is set to POWER_USE_ACTIVE. Use change_power_consumption() to modify this during runtime.
base_typeFor mapped buildable types, set this to be the base type actually buildable.
can_use_toolsWhether or not the machine is allowed to be dismantled/modified. Used for snowflake consoles that would break permanently if dismantled. Also prevents damage, since the machine would be irreparable in this state. Has to be defined here because machinery datums.
clicksoundSound played on succesful interface use by a carbon lifeform.
clickvolSound played on succesful interface use.
component_partsList of component instances. Expected type: /obj/item/stock_parts.
construct_stateThe construction state singleton associated with this machine
core_skillThe skill used for skill checks for this machine (mostly so subtypes can use different skills).
emaggedBoolean. Whether or not the machine has been emagged.
frame_typeWhat is created when the machine is dismantled.
gl_uidNumeric unique ID number tracker. Used for ensuring uid is unique.
id_tagThis generic variable is to be used by mappers to give related machines a string key. In principle used by radio stock parts.
identifierStores the identifier string of an input toggle. Used for the input_toggle public variable.
idle_power_usagePower usage for idle machinery. Used if use_power is set to POWER_USE_IDLE. Use change_power_consumption() to modify this during runtime.
input_toggleStores the on/off state of an input toggle. Used for the input_toggle public variable.
interact_offlineBoolean. Can the machine be interacted with while de-powered.
machine_descA simple description of what this machine does, shown on examine for circuit boards.
machine_nameThe human-readable name of this machine, shown when examining circuit boards.
malf_upgradedBoolean. Whether or not the machine has been upgrade by a malfunctioning AI.
maximum_component_partsList of componant paths and the maximum number of that specific path that can be inserted into the machine. null - no max. list(type part = number max).
next_clicksoundValue to compare with world.time for whether to play clicksound according to CLICKSOUND_INTERVAL.
operator_skillMachines often do all operations on Process(). This caches the user's skill while the operations are running.
panel_openBoolean. Whether or not the maintenance panel is open.
power_channelPower channel the machine draws from in APCs. EQUIP, ENVIRON, or LIGHT. Use update_power_channel() to modify this during runtime.
power_componentsList of all machine components that are of the power subtype. This is an optimization, as power code is expensive.
power_init_completeHelps with bookkeeping when initializing atoms. Don't modify.
processing_flagsBitflag. What is being processed. One of MACHINERY_PROCESS_*.
processing_partsComponent parts queued for processing by the machine. Expected type: /obj/item/stock_parts
public_methodsList of all registered public_method singletons.
public_variablesList of all registered public_variable singletons.
reason_brokenBitflag. Reason the machine is 'broken'. Can be any combination of MACHINE_BROKEN_*. Do not modify directly - Use set_broken() instead.
silicon_restrictionOne of the STATUS_* flags. If set, will force the given status flag if a silicon tries to access the machine.
statBitflag. Machine's base status. Can include MACHINE_STAT_BROKEN, MACHINE_STAT_NOPOWER, etc.
stat_immuneBitflag. The machine will never set stat to these flags.
stock_part_presetsAssociative list of singleton path -> number to apply.
uidNumeric unique ID number. Set to the value of gl_uid++ when used.
uncreated_component_partsLAZYLIST of component paths which have delayed init. Indeces = number of components.
use_powerOne of POWER_USE_*. The power usage state of the machine. Use update_use_power() to modify this during runtime.
wiresWire datum, if any. If you place a type path, it will be autoinitialized.

Procs

RefreshPartsRefreshes the machines parts-related stat flags, and calls on_refresh() on each component.
area_changedHandles machinery power updates if the area the machine is in changes. Called by update_power_on_move().
area_uidRetrieves the unique id of the machine's current area.
can_add_componentInstallation. Returns number of such components which can be inserted.
can_apply_preset_toReturns the first valid preset singleton for a given part, or null
cannot_transition_toReturn a change state define or a fail message to block transition.
change_power_consumptionUpdates the machine's *_power_usage to the new value and updates the machine's current power consumption state if applicable.
component_attack_handPasses attack_hand() calls through to components within the machine, if they are accessible.
component_attackbyPasses use_tool() calls through to components within the machine, if they are accessible.
component_destroyedHandles destroying the provided component. component should be an item within the machine.
component_stat_changeCalled whenever an attached component updates it's status. Override to handle updates to the machine.
components_are_accessibleUse to block interactivity if panel is not open, etc. path is the type path to check accessibility for. Returns boolean.
dismantleDeconstructs the machine into its base frame and ejects all of its components. Returns boolean.
display_partsDisplays all components in the machine to the user.
force_init_componentForces initialization of a component in the uncreated_component_parts list. Returns the result of install_component(), or null if the path does not exist in the list.
get_component_of_typeReturns a component instance of the given part_type, or null if no such type is present. strict forces strict type comparisons and disallows subtypes.
get_power_usageReturns the current power usage draw, based on the state of use_power.
inoperableChecks whether or not the machine's state variable has the MACHINE_STAT_BROKEN or MACHINE_STAT_NOPOWER flags, or any of the provided additional_flags. Returns TRUE if any of the flags match.
interface_interactIf you want to have interface interactions handled for you conveniently, use this. Return TRUE for handled. If you perform direct interactions in here, you are responsible for ensuring that full interactivity checks have been made (i.e CanInteract()). The checks leading in to here only guarantee that the user should be able to view a UI.
is_poweredWhether or not the machine is considered 'powered'. By default this translates directly to !stat_check(MACHINE_STAT_NOPOWER).
malf_upgradeHandles updgrading the machine for a malfunctioning AI. Return TRUE if the machine was successfully upgraded.
missing_partsReturns a list of required components that are missing from the machine, or null if no components are missing or the machine lacks a construct_state.
number_of_componentsReturns the number of components of the given part_type currently installed in the machine.
on_user_loginCalled by /mob/Login() if the mob has an associated machine.
operableInverse of inoperable().
part_insertionHandles inserting a component or item into the machine by a user. Returns boolean. TRUE should halt further processing in attack*() procs.
part_removalHandles removal of a component by a user. Returns boolean.
part_replacementHandles replacement of components by a user using a part replacer. Returns boolean.
physical_attack_handIf you want a physical interaction which happens after all relevant checks but preempts the UI interactions, do it here. Return TRUE for handled.
pingDisplays a ping message and sound effect.
populate_partsCreates all components listed in uncreated_component_parts. full_populate also creates a circuitboard and all needed components.
poweredReturns TRUE if the area has power on given channel (or doesn't require power), defaults to power_channel. May also optionally specify an area, otherwise defaults to loc.loc.
refreshRefreshes the machine's status. Used by the refresh public method.
remove_part_and_give_to_userRemoves a part of the given path and places it in the hands of user.
replace_partReplaces a single component in the machine.
set_brokenSets the machine's broken state, modfying both stat and reason_broken accordingly.
set_initial_levelUsed by constructors. Shouldn't generally be called from elsewhere.
set_statAllows setting or unsetting a stat flag.
set_stat_immunityUpdates the machine's stat immunity. This also updates the stat flag itself, if it's set and you're turning on immunity.
shockElectrocutes the mob user based on probability prb, if the machine is in a state capable of doing so. Returns TRUE if the user was shocked.
stateDisplays a message for mobs in range.
state_transitionCalled on state transition; can intercept, but must call parent.
toggle_input_toggleHandles toggling the machine's toggle variable. Used by the toggle_input_toggle public method.
toggle_powerToggles the machine's power state. Used by the toggle_power public method.
toggle_statToggles a stat flag.
total_component_rating_of_typeReturns the total combined component ratings for the provided part_type.
types_of_componentReturns a list of subtypes of the given component type, with associated value = number of that component.
uninstall_componentUninstalls the provided component, if it exists in component_parts. refresh_parts will call RefreshParts() after uninstallation. Returns the uninstalled part.
update_power_channelUpdates the machine's power_channel to the new value and updates the machine's area's power grid.
update_power_on_moveHandles updating machinery power whenever the machine is moved. Calls area_changed() by default.
update_use_powerUpdates the use_power variable to the new value and updates the machine's area's power grid.
use_power_oneoffThis will have this machine have its area eat this much power next tick, and not afterwards. Do not use for continued power draw. chan can be one of the possible values for power_channel, or POWER_CHAN to use the machine's current configured power channel.
user_can_move_target_insideCalled by machines that can hold a mob (sleeper, suit cycler, etc.), checking if mob can be moved before doing so. Call parent first if you want to add new checks specific for each machine, this proc handles the common stuff. Returns TRUE if mob can be moved into a machine, FALSE if it cannot.

Var Details

active_power_usage

Power usage for active machinery. Used if use_power is set to POWER_USE_ACTIVE. Use change_power_consumption() to modify this during runtime.

base_type

For mapped buildable types, set this to be the base type actually buildable.

can_use_tools

Whether or not the machine is allowed to be dismantled/modified. Used for snowflake consoles that would break permanently if dismantled. Also prevents damage, since the machine would be irreparable in this state. Has to be defined here because machinery datums.

clicksound

Sound played on succesful interface use by a carbon lifeform.

clickvol

Sound played on succesful interface use.

component_parts

List of component instances. Expected type: /obj/item/stock_parts.

construct_state

The construction state singleton associated with this machine

core_skill

The skill used for skill checks for this machine (mostly so subtypes can use different skills).

emagged

Boolean. Whether or not the machine has been emagged.

frame_type

What is created when the machine is dismantled.

gl_uid

Numeric unique ID number tracker. Used for ensuring uid is unique.

id_tag

This generic variable is to be used by mappers to give related machines a string key. In principle used by radio stock parts.

identifier

Stores the identifier string of an input toggle. Used for the input_toggle public variable.

idle_power_usage

Power usage for idle machinery. Used if use_power is set to POWER_USE_IDLE. Use change_power_consumption() to modify this during runtime.

input_toggle

Stores the on/off state of an input toggle. Used for the input_toggle public variable.

interact_offline

Boolean. Can the machine be interacted with while de-powered.

machine_desc

A simple description of what this machine does, shown on examine for circuit boards.

machine_name

The human-readable name of this machine, shown when examining circuit boards.

malf_upgraded

Boolean. Whether or not the machine has been upgrade by a malfunctioning AI.

maximum_component_parts

List of componant paths and the maximum number of that specific path that can be inserted into the machine. null - no max. list(type part = number max).

next_clicksound

Value to compare with world.time for whether to play clicksound according to CLICKSOUND_INTERVAL.

operator_skill

Machines often do all operations on Process(). This caches the user's skill while the operations are running.

panel_open

Boolean. Whether or not the maintenance panel is open.

power_channel

Power channel the machine draws from in APCs. EQUIP, ENVIRON, or LIGHT. Use update_power_channel() to modify this during runtime.

power_components

List of all machine components that are of the power subtype. This is an optimization, as power code is expensive.

power_init_complete

Helps with bookkeeping when initializing atoms. Don't modify.

processing_flags

Bitflag. What is being processed. One of MACHINERY_PROCESS_*.

processing_parts

Component parts queued for processing by the machine. Expected type: /obj/item/stock_parts

public_methods

List of all registered public_method singletons.

public_variables

List of all registered public_variable singletons.

reason_broken

Bitflag. Reason the machine is 'broken'. Can be any combination of MACHINE_BROKEN_*. Do not modify directly - Use set_broken() instead.

silicon_restriction

One of the STATUS_* flags. If set, will force the given status flag if a silicon tries to access the machine.

stat

Bitflag. Machine's base status. Can include MACHINE_STAT_BROKEN, MACHINE_STAT_NOPOWER, etc.

stat_immune

Bitflag. The machine will never set stat to these flags.

stock_part_presets

Associative list of singleton path -> number to apply.

uid

Numeric unique ID number. Set to the value of gl_uid++ when used.

uncreated_component_parts

LAZYLIST of component paths which have delayed init. Indeces = number of components.

use_power

One of POWER_USE_*. The power usage state of the machine. Use update_use_power() to modify this during runtime.

wires

Wire datum, if any. If you place a type path, it will be autoinitialized.

Proc Details

RefreshParts

Refreshes the machines parts-related stat flags, and calls on_refresh() on each component.

area_changed

Handles machinery power updates if the area the machine is in changes. Called by update_power_on_move().

area_uid

Retrieves the unique id of the machine's current area.

can_add_component

Installation. Returns number of such components which can be inserted.

can_apply_preset_to

Returns the first valid preset singleton for a given part, or null

cannot_transition_to

Return a change state define or a fail message to block transition.

change_power_consumption

Updates the machine's *_power_usage to the new value and updates the machine's current power consumption state if applicable.

component_attack_hand

Passes attack_hand() calls through to components within the machine, if they are accessible.

component_attackby

Passes use_tool() calls through to components within the machine, if they are accessible.

component_destroyed

Handles destroying the provided component. component should be an item within the machine.

component_stat_change

Called whenever an attached component updates it's status. Override to handle updates to the machine.

components_are_accessible

Use to block interactivity if panel is not open, etc. path is the type path to check accessibility for. Returns boolean.

dismantle

Deconstructs the machine into its base frame and ejects all of its components. Returns boolean.

display_parts

Displays all components in the machine to the user.

force_init_component

Forces initialization of a component in the uncreated_component_parts list. Returns the result of install_component(), or null if the path does not exist in the list.

get_component_of_type

Returns a component instance of the given part_type, or null if no such type is present. strict forces strict type comparisons and disallows subtypes.

get_power_usage

Returns the current power usage draw, based on the state of use_power.

inoperable

Checks whether or not the machine's state variable has the MACHINE_STAT_BROKEN or MACHINE_STAT_NOPOWER flags, or any of the provided additional_flags. Returns TRUE if any of the flags match.

interface_interact

If you want to have interface interactions handled for you conveniently, use this. Return TRUE for handled. If you perform direct interactions in here, you are responsible for ensuring that full interactivity checks have been made (i.e CanInteract()). The checks leading in to here only guarantee that the user should be able to view a UI.

is_powered

Whether or not the machine is considered 'powered'. By default this translates directly to !stat_check(MACHINE_STAT_NOPOWER).

Returns boolean.

malf_upgrade

Handles updgrading the machine for a malfunctioning AI. Return TRUE if the machine was successfully upgraded.

missing_parts

Returns a list of required components that are missing from the machine, or null if no components are missing or the machine lacks a construct_state.

number_of_components

Returns the number of components of the given part_type currently installed in the machine.

on_user_login

Called by /mob/Login() if the mob has an associated machine.

operable

Inverse of inoperable().

part_insertion

Handles inserting a component or item into the machine by a user. Returns boolean. TRUE should halt further processing in attack*() procs.

part_removal

Handles removal of a component by a user. Returns boolean.

part_replacement

Handles replacement of components by a user using a part replacer. Returns boolean.

physical_attack_hand

If you want a physical interaction which happens after all relevant checks but preempts the UI interactions, do it here. Return TRUE for handled.

ping

Displays a ping message and sound effect.

populate_parts

Creates all components listed in uncreated_component_parts. full_populate also creates a circuitboard and all needed components.

powered

Returns TRUE if the area has power on given channel (or doesn't require power), defaults to power_channel. May also optionally specify an area, otherwise defaults to loc.loc.

refresh

Refreshes the machine's status. Used by the refresh public method.

remove_part_and_give_to_user

Removes a part of the given path and places it in the hands of user.

replace_part

Replaces a single component in the machine.

set_broken

Sets the machine's broken state, modfying both stat and reason_broken accordingly.

If the resulting reason_broken is empty, MACHINE_STAT_BROKEN is unset. Otherwise, the broken stat is set.

Parameters:

Returns boolean - Whether or not the state was changed.

set_initial_level

Used by constructors. Shouldn't generally be called from elsewhere.

set_stat

Allows setting or unsetting a stat flag.

Parameters:

Returns boolean - Whether or not the stat was updated.

set_stat_immunity

Updates the machine's stat immunity. This also updates the stat flag itself, if it's set and you're turning on immunity.

Parameters:

Returns boolean. Whether or not stat was updated during the operation.

shock

Electrocutes the mob user based on probability prb, if the machine is in a state capable of doing so. Returns TRUE if the user was shocked.

state

Displays a message for mobs in range.

state_transition

Called on state transition; can intercept, but must call parent.

toggle_input_toggle

Handles toggling the machine's toggle variable. Used by the toggle_input_toggle public method.

toggle_power

Toggles the machine's power state. Used by the toggle_power public method.

toggle_stat

Toggles a stat flag.

Parameters:

Returns boolean or null. Null if the machine is immune to the state, otherwise, boolean based on the new state of the flag.

total_component_rating_of_type

Returns the total combined component ratings for the provided part_type.

types_of_component

Returns a list of subtypes of the given component type, with associated value = number of that component.

uninstall_component

Uninstalls the provided component, if it exists in component_parts. refresh_parts will call RefreshParts() after uninstallation. Returns the uninstalled part.

update_power_channel

Updates the machine's power_channel to the new value and updates the machine's area's power grid.

update_power_on_move

Handles updating machinery power whenever the machine is moved. Calls area_changed() by default.

update_use_power

Updates the use_power variable to the new value and updates the machine's area's power grid.

use_power_oneoff

This will have this machine have its area eat this much power next tick, and not afterwards. Do not use for continued power draw. chan can be one of the possible values for power_channel, or POWER_CHAN to use the machine's current configured power channel.

user_can_move_target_inside

Called by machines that can hold a mob (sleeper, suit cycler, etc.), checking if mob can be moved before doing so. Call parent first if you want to add new checks specific for each machine, this proc handles the common stuff. Returns TRUE if mob can be moved into a machine, FALSE if it cannot.