Goonstation 13 - Modules - TypesVar Details - Proc Details

manufacturing unit

Vars

accept_blueprintsWhether or not we accept blueprints from the ruk kit into this manufacturer.
accountCard currently scanned into the machine, used when deducting payment for ores from a Rockbox
active_power_consumptionHow much power is consumed while active? This is determined automatically when the unit starts a production cycle
availableA list of every manufacture datum typepath available in this unit subtype by default
base_material_classBase class for material pieces that the manufacturer accepts. Keep this as material pieces only unless you're making larger changes to the system, Various parts of the code are coupled to assuming that this is a material piece w/ a material.
categoriesA list of valid categories the manufacturer will use. Any invalid provided categories are assigned "Miscellaneous".
dismantle_stageThe dismantlement stage we are currently at. See manufacturer.dm line 15 for details on the defines
downloadManufacture datum typepaths gained from scanned blueprints
drive_recipesManufacture datum typepaths provided by an inserted manudrive
electrifiedThis is a timer and not a true/false; it's decremented every process() tick
emaggedWhether or not a traitor emagged the manufacturer, and thus will start acting really weird atop other things
errorA somewhat legacy variable to output silent yet visible errors to the user in the UI. Current uses include when there is a lack of materials, an invalid blueprint, and when there is not enough manudrive uses.
free_resource_amtThe amount of each free resource that the manufacturer comes preloaded with. Separate from free_resources() as typically manufacturers use the same amount of each type.
free_resourcesThe types of material pieces of which the manufacturer will be spawned with. The amount of each resource is defined on free_resource_amt
hackedWhether or not we are hacked, and thus will show our hidden blueprints + change our maximum speed setting.
hiddenThese manufacture datum typepaths are available by default, but can't be printed or seen unless the machine is hacked
icon_baseThis is used to make icon state changes cleaner by setting it to "fab-[icon_base]"
linkThe data terminal attached underfloor to this manufacturer. Allows use of PNET packets
malfunctionWhether or not the manufacturer is malfunctioning, and thus will occasionally flip_out() among other glitchy things.
manudriveWhere insertible manudrives are held for reading blueprints and getting/setting fablimits.
material_patterns_by_refHelper list which stores all the material patterns each loaded material satisfies, by ref to the piece
modeThe current status of the machine. "ready" / MODE_READY - The machine is ready to produce more blueprints. "working" / MODE_WORKING - The machine is currently producing a blueprint. "halt" / MODE_HALT - The machine stopped due to some problem arising.
nearby_turfsTurfs around the manufacturer are stored here for performance reasons
original_durationOriginal duration of the currently queued print, used to keep track of progress when M.time gets modified weirdly in queueing
output_capThe maximum amount of produce this can dispense on outputting a blueprint's chosen outputs.
output_targetThe current atom we will output product into. Can be a turf, a crate, etc.
panel_openWhether or not the wiring panel is open for the UI.
power_wire_cutWhether or not the power wire is cut, removing the ability for the manufacturer to do work
queueA list of manufacture datums in the form of a queue. Blueprints are taken from index 1 and added at the last index
repeatControls whether or not to repeat the first item in the queue while working.
req_accessreq_access is used to lock out specific features and not limit deconstruction therefore DECON_NO_ACCESS is required
resource_amountsSupposedly used by podwards manufacturers, but not really Kind of legacy is this is removed soon
should_update_statictrue by default to update first time around, set to true whenever something is done that invalidates static data
speedControls how fast blueprints are produced. Higher speed settings have a exponential effect on power use.
supplemental_descAppended in get_desc() to the base description, to make subtype definitions cleaner
time_leftTime left until the current blueprint is complete. Updated on pausing and on starting a new blueprint.
time_left_electrifiedThis is a timer decremented every process() tick representing how long the machine will be electrified for.
time_startedTime the blueprint was queued, or if paused/resumed, the time we resumed the blueprint.
wiresThis is a bitflag used to track wire states, for hacking and such. Replace it with something cleaner if an option exists when you're reading this :p

Procs

blueprint_is_availableReturns whether or not a blueprint is able to be used for printing
blueprints_as_listConverts list of manufacture datums to list keyed by category containing listified manufacture datums of said category.
broken_state_topicOverriden to not disable if no power, wire maintenence to restore power is on the GUI which creates catch-22 situation
can_eject_materialHelper proc to check whether or not we can eject the material from storage or not.
can_use_rangedCheck if the target is allowed to interact with this at range. Silicons can, humans can't.
check_enough_materialsCheck if a blueprint can be manufactured with the current materials. mats_used - a list from get_materials_needed to avoid calling the proc twice
check_physical_proximityHandle checking and outputting for not being close to the machine
claim_free_resourcesAdds the resources we define in free_resources to our storage, and clears the list when we're done to represent we do not have more resources to claim
eject_materialHandles allowing the user to eject integer amounts of material
get_bank_dataGet the relevant bank record data from the current account. Returns null if there's no account scanned yet
get_blueprint_typeGet whether a blueprint is available, hidden, downloaded, or a drive recipe. If in multiple print lists, picks the first result. Or null.
get_contentsSafely gets our storage contents. In case someone does something like load materials into the machine before we have initialized our storage Also ejects things w/o material or that aren't pieces, to ensure safety
get_drive_uses_leftGet how many more times a drive can produce items it is stocked with
get_material_by_refReturns material which matches ref from storage, else returns null
get_material_for_requirementGet the material in storage which satisfies some amount of a requirement.
get_materials_neededReturns associative list of manufacturing requirement to material piece references, but does not guarantee all item_paths are satisfied or that the blueprint will have the required materials ready by the time it reaches the front of the queue. Reqs not satisfied are not added to mats_used
get_requirements_material_satisfiesGet a list of the patterns a material satisfies. Does not include "ALL" in list, as it is assumed such a requirement is handled separately. Includes all previous material tier strings for simple "x in y" checks, as well as material ID for those recipies which need exact mat.
grump_messageHelper to play the grump with or without a grump message/sound. Just as a note the sound is appropriate when the machine is reporting the error, if its a grump that the player probably had to think about or find out then theres no "reason" for there to be sound
has_physical_proximityCheck if the target is within arm's reach of the machine
manufacture_as_listConverts a manufacture datum to a list with string keys to relevant vars for the UI
remove_materialsGo through the material requirements of a blueprint, removing the respective used materials
rockboxes_as_listGets rockbox data as list for ui_static_data
scan_cardScan in some supposed card into the machine, prompting the usr for a PIN. Returns TRUE if we managed to scan the card.
swap_materialsSwap the "position" of two materials in the manufacturer for the sake of priority use management.
try_shockTry to shock the target if the machine is electrified, returns whether or not the target got shocked

Var Details

accept_blueprints

Whether or not we accept blueprints from the ruk kit into this manufacturer.

account

Card currently scanned into the machine, used when deducting payment for ores from a Rockbox

active_power_consumption

How much power is consumed while active? This is determined automatically when the unit starts a production cycle

available

A list of every manufacture datum typepath available in this unit subtype by default

base_material_class

Base class for material pieces that the manufacturer accepts. Keep this as material pieces only unless you're making larger changes to the system, Various parts of the code are coupled to assuming that this is a material piece w/ a material.

categories

A list of valid categories the manufacturer will use. Any invalid provided categories are assigned "Miscellaneous".

dismantle_stage

The dismantlement stage we are currently at. See manufacturer.dm line 15 for details on the defines

download

Manufacture datum typepaths gained from scanned blueprints

drive_recipes

Manufacture datum typepaths provided by an inserted manudrive

electrified

This is a timer and not a true/false; it's decremented every process() tick

emagged

Whether or not a traitor emagged the manufacturer, and thus will start acting really weird atop other things

error

A somewhat legacy variable to output silent yet visible errors to the user in the UI. Current uses include when there is a lack of materials, an invalid blueprint, and when there is not enough manudrive uses.

free_resource_amt

The amount of each free resource that the manufacturer comes preloaded with. Separate from free_resources() as typically manufacturers use the same amount of each type.

free_resources

The types of material pieces of which the manufacturer will be spawned with. The amount of each resource is defined on free_resource_amt

hacked

Whether or not we are hacked, and thus will show our hidden blueprints + change our maximum speed setting.

hidden

These manufacture datum typepaths are available by default, but can't be printed or seen unless the machine is hacked

icon_base

This is used to make icon state changes cleaner by setting it to "fab-[icon_base]"

The data terminal attached underfloor to this manufacturer. Allows use of PNET packets

malfunction

Whether or not the manufacturer is malfunctioning, and thus will occasionally flip_out() among other glitchy things.

manudrive

Where insertible manudrives are held for reading blueprints and getting/setting fablimits.

material_patterns_by_ref

Helper list which stores all the material patterns each loaded material satisfies, by ref to the piece

mode

The current status of the machine. "ready" / MODE_READY - The machine is ready to produce more blueprints. "working" / MODE_WORKING - The machine is currently producing a blueprint. "halt" / MODE_HALT - The machine stopped due to some problem arising.

nearby_turfs

Turfs around the manufacturer are stored here for performance reasons

original_duration

Original duration of the currently queued print, used to keep track of progress when M.time gets modified weirdly in queueing

output_cap

The maximum amount of produce this can dispense on outputting a blueprint's chosen outputs.

output_target

The current atom we will output product into. Can be a turf, a crate, etc.

panel_open

Whether or not the wiring panel is open for the UI.

power_wire_cut

Whether or not the power wire is cut, removing the ability for the manufacturer to do work

queue

A list of manufacture datums in the form of a queue. Blueprints are taken from index 1 and added at the last index

repeat

Controls whether or not to repeat the first item in the queue while working.

req_access

req_access is used to lock out specific features and not limit deconstruction therefore DECON_NO_ACCESS is required

resource_amounts

Supposedly used by podwards manufacturers, but not really Kind of legacy is this is removed soon

should_update_static

true by default to update first time around, set to true whenever something is done that invalidates static data

speed

Controls how fast blueprints are produced. Higher speed settings have a exponential effect on power use.

supplemental_desc

Appended in get_desc() to the base description, to make subtype definitions cleaner

time_left

Time left until the current blueprint is complete. Updated on pausing and on starting a new blueprint.

time_left_electrified

This is a timer decremented every process() tick representing how long the machine will be electrified for.

time_started

Time the blueprint was queued, or if paused/resumed, the time we resumed the blueprint.

wires

This is a bitflag used to track wire states, for hacking and such. Replace it with something cleaner if an option exists when you're reading this :p

Proc Details

blueprint_is_available

Returns whether or not a blueprint is able to be used for printing

blueprints_as_list

Converts list of manufacture datums to list keyed by category containing listified manufacture datums of said category.

broken_state_topic

Overriden to not disable if no power, wire maintenence to restore power is on the GUI which creates catch-22 situation

can_eject_material

Helper proc to check whether or not we can eject the material from storage or not.

can_use_ranged

Check if the target is allowed to interact with this at range. Silicons can, humans can't.

check_enough_materials

Check if a blueprint can be manufactured with the current materials. mats_used - a list from get_materials_needed to avoid calling the proc twice

check_physical_proximity

Handle checking and outputting for not being close to the machine

claim_free_resources

Adds the resources we define in free_resources to our storage, and clears the list when we're done to represent we do not have more resources to claim

eject_material

Handles allowing the user to eject integer amounts of material

get_bank_data

Get the relevant bank record data from the current account. Returns null if there's no account scanned yet

get_blueprint_type

Get whether a blueprint is available, hidden, downloaded, or a drive recipe. If in multiple print lists, picks the first result. Or null.

get_contents

Safely gets our storage contents. In case someone does something like load materials into the machine before we have initialized our storage Also ejects things w/o material or that aren't pieces, to ensure safety

get_drive_uses_left

Get how many more times a drive can produce items it is stocked with

get_material_by_ref

Returns material which matches ref from storage, else returns null

get_material_for_requirement

Get the material in storage which satisfies some amount of a requirement.

get_materials_needed

Returns associative list of manufacturing requirement to material piece references, but does not guarantee all item_paths are satisfied or that the blueprint will have the required materials ready by the time it reaches the front of the queue. Reqs not satisfied are not added to mats_used

get_requirements_material_satisfies

Get a list of the patterns a material satisfies. Does not include "ALL" in list, as it is assumed such a requirement is handled separately. Includes all previous material tier strings for simple "x in y" checks, as well as material ID for those recipies which need exact mat.

grump_message

Helper to play the grump with or without a grump message/sound. Just as a note the sound is appropriate when the machine is reporting the error, if its a grump that the player probably had to think about or find out then theres no "reason" for there to be sound

has_physical_proximity

Check if the target is within arm's reach of the machine

manufacture_as_list

Converts a manufacture datum to a list with string keys to relevant vars for the UI

remove_materials

Go through the material requirements of a blueprint, removing the respective used materials

rockboxes_as_list

Gets rockbox data as list for ui_static_data

scan_card

Scan in some supposed card into the machine, prompting the usr for a PIN. Returns TRUE if we managed to scan the card.

swap_materials

Swap the "position" of two materials in the manufacturer for the sake of priority use management.

try_shock

Try to shock the target if the machine is electrified, returns whether or not the target got shocked