machinery

Machines in the world, such as computers, pipes, and airlocks.
Overview: Used to create objects that need a per step proc call. Default definition of 'Initialize()' stores a reference to src machine in global 'machines list'. Default definition of 'Destroy' removes reference to src machine in global 'machines list'.
Class Variables: use_power (num) current state of auto power use. Possible Values: NO_POWER_USE -- no auto power use IDLE_POWER_USE -- machine is using power at its idle power level ACTIVE_POWER_USE -- machine is using power at its active power level
active_power_usage (num) Value for the amount of power to use when in active power mode
idle_power_usage (num) Value for the amount of power to use when in idle power mode
power_channel (num) What channel to draw from when drawing power for power mode Possible Values: AREA_USAGE_EQUIP:0 -- Equipment Channel AREA_USAGE_LIGHT:2 -- Lighting Channel AREA_USAGE_ENVIRON:3 -- Environment Channel
component_parts (list) A list of component parts of machine used by frame based machines.
stat (bitflag) Machine status bit flags. Possible bit flags: BROKEN -- Machine is broken NOPOWER -- No power is being supplied to machine. MAINT -- machine is currently under going maintenance. EMPED -- temporary broken by EMP pulse
Class Procs: Initialize() 'game/machinery/machine.dm'
Destroy() 'game/machinery/machine.dm'
auto_use_power() 'game/machinery/machine.dm' This proc determines how power mode power is deducted by the machine. 'auto_use_power()' is called by the 'master_controller' game_controller every tick.
Return Value:
return:1 -- if object is powered
return:0 -- if object is not powered.
Default definition uses 'use_power', 'power_channel', 'active_power_usage',
'idle_power_usage', 'powered()', and 'use_power()' implement behavior.
powered(chan = -1) 'modules/power/power.dm' Checks to see if area that contains the object has power available for power channel given in 'chan'. -1 defaults to power_channel
use_power(amount, chan=-1) 'modules/power/power.dm' Deducts 'amount' from the power channel 'chan' of the area that contains the object.
power_change() 'modules/power/power.dm' Called by the area that contains the object when ever that area under goes a power state change (area runs out of power, or area channel is turned off).
RefreshParts() 'game/machinery/machine.dm' Called to refresh the variables in the machine that are contributed to by parts contained in the component_parts list. (example: glass and material amounts for the autolathe)
Default definition does nothing.
process() 'game/machinery/machine.dm' Called by the 'machinery subsystem' once per machinery tick for each machine that is listed in its 'machines' list.
process_atmos() Called by the 'air subsystem' once per atmos tick for each machine that is listed in its 'atmos_machines' list. Compiled by Aygar
Vars | |
atmos_processing | Is this machine currently in the atmos machinery queue? |
---|---|
is_operational | A combination of factors such as having power, not being broken and so on. Boolean. |
last_used_time | world.time of last use by /mob/living |
last_user_mobtype | Mobtype of last user. Typecast to /mob/living for initial() usage |
processing_flags | Viable flags to go here are START_PROCESSING_ON_INIT, or START_PROCESSING_MANUALLY. See code__DEFINES\machines.dm for more information on these flags. |
subsystem_type | What subsystem this machine will use, which is generally SSmachines or SSfastprocess. By default all machinery use SSmachines. This fires a machine's process() roughly every 2 seconds. |
Procs | |
AI_notify_hack | Alerts the AI that a hack is in progress. |
begin_processing | Helper proc for telling a machine to start processing with the subsystem type that is located in its subsystem_type var. |
directly_use_power | An alternative to 'use_power', this proc directly costs the APC in direct charge, as opposed to being calculated periodically. |
dump_contents | Drop every movable atom in the machine's contents list, including any components and circuit. |
dump_inventory_contents | Drop every movable atom in the machine's contents list that is not a component_part. |
end_processing | Helper proc for telling a machine to stop processing with the subsystem type that is located in its subsystem_type var. |
on_set_is_operational | Called when the value of is_operational changes, so we can react to it. |
on_set_machine_stat | Called when the value of machine_stat changes, so we can react to it. |
open_machine | Opens the machine. |
power_change | Called whenever the power settings of the containing area change |
set_is_operational | Called when we want to change the value of the is_operational variable. Boolean. |
set_machine_stat | Called when we want to change the value of the machine_stat variable. Holds bitflags. |
spawn_frame | Spawns a frame where this machine is. If the machine was not disassmbled, the frame is spawned damaged. If the frame couldn't exist on this turf, it's smashed down to metal sheets. |
try_put_in_hand | Puts passed object in to user's hand |
use_power_from_net | Attempts to draw power directly from the APC's Powernet rather than the APC's battery. For high-draw machines, like the cell charger |
Var Details
atmos_processing

Is this machine currently in the atmos machinery queue?
is_operational

A combination of factors such as having power, not being broken and so on. Boolean.
last_used_time

world.time of last use by /mob/living
last_user_mobtype

Mobtype of last user. Typecast to /mob/living for initial() usage
processing_flags

Viable flags to go here are START_PROCESSING_ON_INIT, or START_PROCESSING_MANUALLY. See code__DEFINES\machines.dm for more information on these flags.
subsystem_type

What subsystem this machine will use, which is generally SSmachines or SSfastprocess. By default all machinery use SSmachines. This fires a machine's process() roughly every 2 seconds.
Proc Details
AI_notify_hack
Alerts the AI that a hack is in progress.
Sends all AIs a message that a hack is occurring. Specifically used for space ninja tampering as this proc was originally in the ninja files. However, the proc may also be used elsewhere.
begin_processing
Helper proc for telling a machine to start processing with the subsystem type that is located in its subsystem_type
var.
directly_use_power
An alternative to 'use_power', this proc directly costs the APC in direct charge, as opposed to being calculated periodically.
- Amount: How much power the APC's cell is to be costed.
dump_contents
Drop every movable atom in the machine's contents list, including any components and circuit.
dump_inventory_contents
Drop every movable atom in the machine's contents list that is not a component_part.
Proc does not drop components and will skip over anything in the component_parts list. Call dump_contents() to drop all contents including components. Arguments:
- subset - If this is not null, only atoms that are also contained within the subset list will be dropped.
end_processing
Helper proc for telling a machine to stop processing with the subsystem type that is located in its subsystem_type
var.
on_set_is_operational
Called when the value of is_operational
changes, so we can react to it.
on_set_machine_stat
Called when the value of machine_stat
changes, so we can react to it.
open_machine
Opens the machine.
Will update the machine icon and any user interfaces currently open. Arguments:
- drop - Boolean. Whether to drop any stored items in the machine. Does not include components.
power_change
Called whenever the power settings of the containing area change
by default, check equipment channel & set flag, can override if needed
Returns TRUE if the NOPOWER flag was toggled
set_is_operational
Called when we want to change the value of the is_operational
variable. Boolean.
set_machine_stat
Called when we want to change the value of the machine_stat variable. Holds bitflags.
spawn_frame
Spawns a frame where this machine is. If the machine was not disassmbled, the frame is spawned damaged. If the frame couldn't exist on this turf, it's smashed down to metal sheets.
Arguments:
- disassembled - If FALSE, the machine was destroyed instead of disassembled and the frame spawns at reduced integrity.
try_put_in_hand
Puts passed object in to user's hand
Puts the passed object in to the users hand if they are adjacent. If the user is not adjacent then place the object on top of the machine.
Vars:
- object (obj) The object to be moved in to the users hand.
- user (mob/living) The user to recive the object
use_power_from_net
Attempts to draw power directly from the APC's Powernet rather than the APC's battery. For high-draw machines, like the cell charger
Checks the surplus power on the APC's powernet, and compares to the requested amount. If the requested amount is available, this proc will add the amount to the APC's usage and return that amount. Otherwise, this proc will return FALSE. If the take_any var arg is set to true, this proc will use and return any surplus that is under the requested amount, assuming that the surplus is above zero. Args:
- amount, the amount of power requested from the Powernet. In standard loosely-defined SS13 power units.
- take_any, a bool of whether any amount of power is acceptable, instead of all or nothing. Defaults to FALSE