material_container
Vars | |
allowed_item_typecache | The typecache of things that this material container can accept |
---|---|
allowed_materials | The list of materials that this material container can accept |
mat_container_flags | The material container flags. See __DEFINES/materials.dm. |
materials | Map of material ref -> amount |
max_amount | The maximum amount of materials this material container can contain |
precise_insertion | Whether or not this material container allows specific amounts from sheets to be inserted |
registered_signals | Signals that are registered with this contained |
Procs | |
Initialize | Sets up the proper signals and fills the list of materials with the appropriate references. |
can_hold_material | The default check for whether we can add materials to this material container. |
get_item_material_amount | Returns the amount of material relevant to this container; if this container does not support glass, any glass in 'I' will not be taken into account |
get_material_amount | Returns the amount of a specific material in this container. |
has_enough_of_material | Returns TRUE if you have enough of the specified material. |
has_materials | Checks if its possible to afford a certain amount of materials. Takes a dictionary of materials. coefficient can be thought of as the machines efficiency & multiplier as the print quantity |
has_space | Proc that returns TRUE if the container has space |
insert_amount_mat | For inserting an amount of material. Use this to add materials to the container directly |
insert_item | Proc specifically for inserting items, use this when you want to insert any item into the container this bypasses most of the material flag checks so much be used by machines like recycler, stacking machine etc that does not care for such checks |
insert_item_materials | 3 Types of Procs Material Insertion : Insert materials into the container Material Validation : Checks how much materials are available, Extracts materials from items if the container can hold them Material Removal : Removes material from the container |
on_item_insert | Proc that allows players to fill the parent with mats |
on_requesting_context_from_item | Adds context sensitivy directly to the material container file for screentips Arguments: |
retrieve_all | Proc to get all the materials and dump them as sheets |
retrieve_sheets | For spawning mineral sheets at a specific location. Used by machines to output sheets. |
total_amount | returns the total amount of material in the container |
ui_data | List format is list(material_name = list(amount = ..., ref = ..., etc.)) |
use_amount_mat | Uses an amount of a specific material, effectively removing it. |
use_materials | For consuming a dictionary of materials. |
user_insert | inserts an item from the players hand into the container. Loops through all the contents inside recursively Does all explicit checking for mat flags & callbacks to check if insertion is valid This proc is what you should be using for almost all cases |
Var Details
allowed_item_typecache
The typecache of things that this material container can accept
allowed_materials
The list of materials that this material container can accept
mat_container_flags
The material container flags. See __DEFINES/materials.dm.
materials
Map of material ref -> amount
max_amount
The maximum amount of materials this material container can contain
precise_insertion
Whether or not this material container allows specific amounts from sheets to be inserted
registered_signals
Signals that are registered with this contained
Proc Details
Initialize
Sets up the proper signals and fills the list of materials with the appropriate references.
can_hold_material
The default check for whether we can add materials to this material container.
Arguments:
- mat: The material we are checking for insertability.
get_item_material_amount
Returns the amount of material relevant to this container; if this container does not support glass, any glass in 'I' will not be taken into account
Arguments:
- I: the item whos materials must be retrieved
get_material_amount
Returns the amount of a specific material in this container.
Arguments: -mat : the material type to check for 3 cases a) If it's an path its ref is retrieved b) If it's text then its an category material & there is no way to deal with it so return 0 c) If normal material proceeds as usual
has_enough_of_material
Returns TRUE if you have enough of the specified material.
Arguments:
- req_mat: the material to check for
- amount: how much material do we need
has_materials
Checks if its possible to afford a certain amount of materials. Takes a dictionary of materials. coefficient can be thought of as the machines efficiency & multiplier as the print quantity
Arguments:
- mats: list of materials(key=material, value= 1 unit of material) to check for
- coefficient: scaling applied to 1 unit of material in the mats list
- multiplier: how many units(after scaling) do we require
has_space
Proc that returns TRUE if the container has space
Arguments:
- amt - can this container hold this much amount of materials
insert_amount_mat
For inserting an amount of material. Use this to add materials to the container directly
Arguments:
- amt: amount of said material to insert
- mat: the material type to insert
insert_item
Proc specifically for inserting items, use this when you want to insert any item into the container this bypasses most of the material flag checks so much be used by machines like recycler, stacking machine etc that does not care for such checks
Arguments:
- weapon: the item you are trying to insert
- multiplier: The multiplier for the materials being inserted
- context: the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_ITEM_CONSUMED and is used mostly for silo logging
-
- delete_item: should we delete the item after its materials are consumed. does not apply to stacks if they were split due to lack of space
insert_item_materials
3 Types of Procs Material Insertion : Insert materials into the container Material Validation : Checks how much materials are available, Extracts materials from items if the container can hold them Material Removal : Removes material from the container
Each Proc further belongs to a specific category LOW LEVEL: Procs that are used internally & should not be used anywhere else unless you know what your doing MID LEVEL: Procs that can be used by machines(like recycler, stacking machines) to bypass majority of checks HIGH LEVEL: Procs that can be used by anyone publicly and guarantees safety checks & limits
Inserts the relevant materials from an item into this material container. This low level proc should not be used directly by anyone
Arguments:
- source: The source of the materials we are inserting.
- multiplier: The multiplier for the materials extract from this item being inserted.
- context: the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_ITEM_CONSUMED and is used mostly for silo logging, the silo resends this signal on the context to give it a chance to process the item
on_item_insert
Proc that allows players to fill the parent with mats
on_requesting_context_from_item
Adds context sensitivy directly to the material container file for screentips Arguments:
- source - refers to item that will display its screentip
- context - refers to, in this case, an item in the users hand hovering over the material container, such as an autolathe
- held_item - refers to the item that has materials accepted by the material container
- user - refers to user who will see the screentip when the proper context and tool are there
retrieve_all
Proc to get all the materials and dump them as sheets
Arguments:
- target: drop location of the sheets
- context: the atom which is ejecting the sheets. Used mostly in silo logging
retrieve_sheets
For spawning mineral sheets at a specific location. Used by machines to output sheets.
Arguments: sheet_amt: number of sheets to extract material: type of sheets present in this container to extract target: drop location [atom][context]: context - the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_SHEETS_RETRIEVED and is used mostly for silo logging
total_amount
returns the total amount of material in the container
ui_data
List format is list(material_name = list(amount = ..., ref = ..., etc.))
use_amount_mat
Uses an amount of a specific material, effectively removing it.
Arguments:
- amt: amount of said material to use
- mat: type of mat to use
use_materials
For consuming a dictionary of materials.
Arguments:
- mats: map of materials to consume(key = material type, value = amount)
- coefficient: how much fraction of unit material in the mats list must be consumed. This is usually your machines efficiency
- multiplier: how many units of material in the mats list(after each unit is multiplied and rounded with coefficient) must be consumed, This is usually your print quantity
user_insert
inserts an item from the players hand into the container. Loops through all the contents inside recursively Does all explicit checking for mat flags & callbacks to check if insertion is valid This proc is what you should be using for almost all cases
Arguments:
- held_item - the item to insert
- user - the mob inserting this item
- context - the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_ITEM_CONSUMED and is used mostly for silo logging