reagents 
////////////////////////////Main reagents code///////////////////////////////////////////// Holder for a bunch of /datum/reagent
Vars | |
chem_temp | Current temp of the holder volume |
---|---|
failed_but_capable_reactions | If a reaction fails due to temperature or pH, this tracks the required temperature or pH for it to be enabled. |
flags | various flags, see code__DEFINES\reagents.dm |
is_reacting | Hard check to see if the reagents is presently reacting |
maximum_volume | Max volume of this holder |
my_atom | The atom this holder is attached to |
ph | pH of the whole system |
previous_reagent_list | cached list of reagents typepaths (not object references), this is a lazylist for optimisation |
reaction_list | list of reactions currently on going, this is a lazylist for optimisation |
reagent_list | The reagents being held |
total_volume | Current volume of all the reagents |
ui_beaker_sync | If we're syncing with the beaker - so return reactions that are actively happening |
ui_reaction_id | UI lookup stuff Keeps the id of the reaction displayed in the ui |
ui_reaction_index | What index we're at if we have multiple reactions for a reagent product |
ui_reagent_id | Keeps the id of the reagent displayed in the ui |
ui_tags_selected | The bitflag of the currently selected tags in the ui |
Procs | |
_on_transfer_creation | For internal purposes. Sends a signal when a new reagent has been created in the target reagent holder upon transfer |
add_reagent | Adds a reagent to this holder |
add_reagent_list | Like add_reagent but you can enter a list. Arguments |
adjust_thermal_energy | |
clear_reagents | Removes all reagents |
convert_reagent | Turn one reagent into another, preserving volume, temp, purity, ph Arguments |
copy_data | Shallow copies (deep copy of viruses) data from the provided reagent into our copy of that reagent Arguments current_reagent - the reagent(not typepath) to copy data from |
copy_to | Copies the reagents to the target object Arguments |
del_reagent | Removes an specific reagent from this holder Arguments |
determine_reaction_thermics | Returns a string descriptor of a reactions themic_constant |
end_metabolization | Signals that metabolization has stopped, triggering the end of trait-based effects Arguments |
expose | Applies the relevant expose_ proc for every reagent in this holder |
expose_temperature | Applies heat to this holder Arguments |
generate_taste_message | Returns what this holder's reagents taste like |
generate_thermodynamic_profile | Generates a (rough) rate vs temperature graph profile |
get_average_purity | Get the average purity of all reagents (or all subtypes of provided typepath) Arguments |
get_master_reagent | Get a reference to the reagent there is the most of in this holder |
get_reagent_amount | Get the amount of this reagent or the sum of all its subtypes if specified Arguments |
get_reagent_log_string | Outputs a log-friendly list of reagents based on the internal reagent_list. |
get_reagent_purity | Get the purity of this reagent Arguments |
handle_reactions | Handle any reactions possible in this holder Also UPDATES the reaction list High potential for infinite loopsa if you're editing this. |
handle_stasis_chems | Processes any chems that have the REAGENT_IGNORE_STASIS bitflag ONLY Arguments |
has_changed_state | Checks to see if the reagents has a difference in reagents_list and previous_reagent_list (I.e. if there's a difference between the previous call and the last) Also checks to see if the saved reactions in failed_but_capable_reactions can start as a result of temp/pH change |
has_reagent | Returns a reagent from this holder if it matches all the specified arguments Arguments |
heat_capacity | Returns the total heat capacity for all of the reagents currently in this holder. |
holder_full | Is this holder full or not |
instant_react | Old reaction mechanics, edited to work on one only This is changed from the old - purity of the reagents will affect yield |
metabolize | Triggers metabolizing for all the reagents in this holder |
multiply | Multiplies reagents inside this holder by a specific amount Arguments |
process_mob_reagent_purity | Processes the reagents in the holder and converts them, only called in a mob/living/carbon on addition |
remove_all | Removes all reagents either proportionally(amount is the direct volume to remove) when proportional the total volume of all reagents removed will equal to amount or relatively(amount is a percentile between 0->1) when relative amount is the % of each reagent to be removed |
remove_reagent | Removes a specific reagent. can supress reactions if needed Arguments |
set_all_reagents_purity | Directly set the purity of all contained reagents to a new value Arguments |
set_temperature | |
trans_to | Transfer some stuff from this holder to a target object |
update_total | Updates /datum/reagents/var/total_volume |
Var Details
chem_temp 
Current temp of the holder volume
failed_but_capable_reactions 
If a reaction fails due to temperature or pH, this tracks the required temperature or pH for it to be enabled.
flags 
various flags, see code__DEFINES\reagents.dm
is_reacting 
Hard check to see if the reagents is presently reacting
maximum_volume 
Max volume of this holder
my_atom 
The atom this holder is attached to
ph 
pH of the whole system
previous_reagent_list 
cached list of reagents typepaths (not object references), this is a lazylist for optimisation
reaction_list 
list of reactions currently on going, this is a lazylist for optimisation
reagent_list 
The reagents being held
total_volume 
Current volume of all the reagents
ui_beaker_sync 
If we're syncing with the beaker - so return reactions that are actively happening
ui_reaction_id 
UI lookup stuff Keeps the id of the reaction displayed in the ui
ui_reaction_index 
What index we're at if we have multiple reactions for a reagent product
ui_reagent_id 
Keeps the id of the reagent displayed in the ui
ui_tags_selected 
The bitflag of the currently selected tags in the ui
Proc Details
_on_transfer_creation
For internal purposes. Sends a signal when a new reagent has been created in the target reagent holder upon transfer
add_reagent
Adds a reagent to this holder
Arguments:
- reagent - The reagent id to add
- amount - Amount to add
- list/data - Any reagent data for this reagent, used for transferring data with reagents
- reagtemp - Temperature of this reagent, will be equalized
- no_react - prevents reactions being triggered by this addition
- added_purity - override to force a purity when added
- added_ph - override to force a pH when added
- override_base_ph - ingore the present pH of the reagent, and instead use the default (i.e. if buffers/reactions alter it)
- ignore splitting - Don't call the process that handles reagent spliting in a mob (impure/inverse) - generally leave this false unless you care about REAGENTS_DONOTSPLIT flags (see reagent defines)
- list/reagent_added - If not null use this as an holder to store and retrive the reagent datum that was just added without having to locate it after this proc returns. Clear the list to erase old values
- creation_callback - Callback to invoke when the reagent is created
add_reagent_list
Like add_reagent but you can enter a list. Arguments
- [list_reagents][list] - list to add. Format it like this: list(/datum/reagent/toxin = 10, "beer" = 15)
- [data][list] - additional data to add
- [added_purity][number] - an override to the default purity for each reagent to add.
adjust_thermal_energy
-
Adjusts the thermal energy of the reagents in this holder by an amount.
-
Arguments:
-
- delta_energy: The amount to change the thermal energy by.
-
- min_temp: The minimum temperature that can be reached.
-
- max_temp: The maximum temperature that can be reached.
clear_reagents
Removes all reagents
convert_reagent
Turn one reagent into another, preserving volume, temp, purity, ph Arguments
- source_reagent_typepath - the typepath of the reagent you are trying to convert
- target_reagent_typepath - the final typepath the source_reagent_typepath will be converted into
- multiplier - the multiplier applied on the source_reagent_typepath volume before converting
- include_source_subtypes- if TRUE will convert all subtypes of source_reagent_typepath into target_reagent_typepath as well
copy_data
Shallow copies (deep copy of viruses) data from the provided reagent into our copy of that reagent Arguments current_reagent - the reagent(not typepath) to copy data from
copy_to
Copies the reagents to the target object Arguments
- target - the target to transfer reagents to
- multiplier - multiplies each reagent amount by this number well byond their available volume before transfering. used to create reagents from thin air if you ever need to
- preserve_data - preserve user data of all reagents after transfering
- no_react - if TRUE will not handle reactions
- copy_methods - forwards reagent exposure method flags like INGEST & INHALE to reagent.on_transfer to trigger transfer effects.
del_reagent
Removes an specific reagent from this holder Arguments
- target_reagent_typepath - type typepath of the reagent to remove
determine_reaction_thermics
Returns a string descriptor of a reactions themic_constant
end_metabolization
Signals that metabolization has stopped, triggering the end of trait-based effects Arguments
- C - the mob to end metabolization on
- keep_liverless - if true will work without a liver
expose
Applies the relevant expose_ proc for every reagent in this holder
Arguments
- Atom/target: What mob/turf/object is being exposed to reagents? This is your reaction target.
- Methods: What reaction type is the reagent itself going to call on the reaction target? Types are TOUCH, INGEST, VAPOR, PATCH, INJECT and INHALE.
- Volume_modifier: What is the reagent volume multiplied by when exposed? Note that this is called on the volume of EVERY reagent in the base body, so factor in your Maximum_Volume if necessary!
- Show_message: Whether to display anything to mobs when they are exposed.
- list/datum/reagent/r_to_expose: list of reagents to expose. if null will expose the reagents present in this holder instead
expose_temperature
Applies heat to this holder Arguments
- temperature - the temperature we to heat/cool by
- coeff - multiplier to be applied on temp diff between param temp and current temp
generate_taste_message
Returns what this holder's reagents taste like
Arguments:
- mob/living/taster - who is doing the tasting. Some mobs can pick up specific flavours.
- minimum_percent - the lower the minimum percent, the more sensitive the message is.
generate_thermodynamic_profile
Generates a (rough) rate vs temperature graph profile
get_average_purity
Get the average purity of all reagents (or all subtypes of provided typepath) Arguments
- parent_type - the typepath of specific reagents to look for
get_master_reagent
Get a reference to the reagent there is the most of in this holder
get_reagent_amount
Get the amount of this reagent or the sum of all its subtypes if specified Arguments
- reagent - the typepath of the reagent to look for
- type_check - see defines under reagents.dm file
get_reagent_log_string
Outputs a log-friendly list of reagents based on the internal reagent_list.
get_reagent_purity
Get the purity of this reagent Arguments
- reagent - the typepath of the specific reagent to get purity of
handle_reactions
Handle any reactions possible in this holder Also UPDATES the reaction list High potential for infinite loopsa if you're editing this.
handle_stasis_chems
Processes any chems that have the REAGENT_IGNORE_STASIS bitflag ONLY Arguments
- owner - the mob we are doing stasis handlng on
- seconds_per_tick - passed from process
- times_fired - number of times to metabolize this reagent
has_changed_state
Checks to see if the reagents has a difference in reagents_list and previous_reagent_list (I.e. if there's a difference between the previous call and the last) Also checks to see if the saved reactions in failed_but_capable_reactions can start as a result of temp/pH change
has_reagent
Returns a reagent from this holder if it matches all the specified arguments Arguments
- target_reagent - the reagent typepath to check for. can be null to return any reagent
- amount - checks for having a specific amount of that chemical
- needs_metabolizing - takes into consideration if the chemical is matabolizing when it's checked.
- check_subtypes - controls whether it should it should also include subtypes: ispath(type, reagent) versus type == reagent.
- chemical_flags - checks for reagent flags.
heat_capacity
Returns the total heat capacity for all of the reagents currently in this holder.
holder_full
Is this holder full or not
instant_react
Old reaction mechanics, edited to work on one only This is changed from the old - purity of the reagents will affect yield
Arguments
- selected_reaction - the chemical reaction to finish instantly
metabolize
Triggers metabolizing for all the reagents in this holder
Arguments:
- mob/living/carbon/carbon - The mob to metabolize in, if null it uses /datum/reagents/var/my_atom
- seconds_per_tick - the time in server seconds between proc calls (when performing normally it will be 2)
- times_fired - the number of times the owner's life() tick has been called aka The number of times SSmobs has fired
- can_overdose - Allows overdosing
- liverless - Stops reagents that aren't set as /datum/reagent/var/self_consuming from metabolizing
multiply
Multiplies reagents inside this holder by a specific amount Arguments
- multiplier - the amount to multiply each reagent, its a percentile value where < 1 will reduce the volume and
-
1 will increase the volume. Final multiplier applied to the reagent volume is (1 - multiplier)
- datum/reagent/target_id - multiply only this reagent in this holder leaving others untouched
process_mob_reagent_purity
Processes the reagents in the holder and converts them, only called in a mob/living/carbon on addition
Arguments:
- reagent - the added reagent datum/object
- added_volume - the volume of the reagent that was added (since it can already exist in a mob)
- added_purity - the purity of the added volume
- list/reagent_datum - a holder that will contain the inverse reagent datum that got added if this returns FALSE returns the volume of the original, pure, reagent to add / keep
remove_all
Removes all reagents either proportionally(amount is the direct volume to remove) when proportional the total volume of all reagents removed will equal to amount or relatively(amount is a percentile between 0->1) when relative amount is the % of each reagent to be removed
Arguments
- amount - the amount to remove
- relative - if TRUE amount is treated as an percentage between 0->1. If FALSE amount is the direct volume to remove
remove_reagent
Removes a specific reagent. can supress reactions if needed Arguments
- reagent_type - the type of reagent
- amount - the volume to remove
- safety - if FALSE will initiate reactions upon removing. used for trans_id_to
- include_subtypes - if TRUE will remove the specified amount from all subtypes of reagent_type as well
set_all_reagents_purity
Directly set the purity of all contained reagents to a new value Arguments
- new_purity - the new purity value
set_temperature
-
Sets the temperature of this reagent container to a new value.
-
Handles setter signals.
-
Arguments:
-
- _temperature: The new temperature value.
trans_to
Transfer some stuff from this holder to a target object
Arguments:
- obj/target - Target to attempt transfer to
- amount - amount of reagent volume to transfer
- multiplier - multiplies each reagent amount by this number well byond their available volume before transfering. used to create reagents from thin air if you ever need to
- datum/reagent/target_id - transfer only this reagent in this holder leaving others untouched
- preserve_data - if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred.
- no_react - passed through to /datum/reagents/proc/add_reagent
- mob/transferred_by - used for logging
- remove_blacklisted - skips transferring of reagents without REAGENT_CAN_BE_SYNTHESIZED in chemical_flags
- methods - passed through to /datum/reagents/proc/expose and /datum/reagent/proc/on_transfer
- show_message - passed through to /datum/reagents/proc/expose
- ignore_stomach - when using methods INGEST will not use the stomach as the target
update_total
Updates /datum/reagents/var/total_volume