manufacturing unit
Vars | |
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. |
cached_producibility_data | List which stores producibility data to be returned early in get_producibility_for_blueprints |
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]" |
link | 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 |
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. |
stored_previous_blueprint_data | JSON-encoded string of the blueprint data. used for comparisons in get_producibility_for_blueprints |
stored_previous_materials_data | List which stores the materials as they were last seen in get_producibility_for_blueprints |
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 |
Procs | |
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 |
compute_producibility_for_blueprints | Runs the actual computation for the above proc. Split apart so the caching can still be a bit more performant |
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_producibility_for_blueprints | Get an associated list for the UI of blueprintRef to associated list of requirement name to whether that one's producible, but only when necessary |
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 |
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.
cached_producibility_data
List which stores producibility data to be returned early in get_producibility_for_blueprints
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]"
link
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
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.
stored_previous_blueprint_data
JSON-encoded string of the blueprint data. used for comparisons in get_producibility_for_blueprints
stored_previous_materials_data
List which stores the materials as they were last seen in get_producibility_for_blueprints
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
compute_producibility_for_blueprints
Runs the actual computation for the above proc. Split apart so the caching can still be a bit more performant
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_producibility_for_blueprints
Get an associated list for the UI of blueprintRef to associated list of requirement name to whether that one's producible, but only when necessary
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