chemical_reaction

#Chemical Reaction
Datum that makes the magic between reagents happen.
Chemical reactions is a class that is instantiated and stored in a global list 'chemical_reactions_list'
Vars | |
H_ion_release | pH change per 1u reaction |
---|---|
determin_ph_range | How far out pH wil react, giving impurity place (Exponential phase) |
is_cold_recipe | Set to TRUE if you want the recipe to only react when it's BELOW the required temp. |
mix_message | The message shown to nearby people upon mixing, if applicable |
mix_sound | The sound played upon mixing, if applicable |
mob_react | Determines if a chemical reaction can occur inside a mob |
optimal_ph_max | Higest value for above |
optimal_ph_min | Lowest value of pH determining pH a 1 value for pH based rate reactions (Plateu phase) |
optimal_temp | Upper end for above (i.e. the end of the curve section defined by temp_exponent_factor) |
overheat_temp | Temperature at which reaction explodes - If any reaction is this hot, it explodes! |
ph_exponent_factor | How sharp the pH exponential curve is (to the power of value) |
purity_min | If purity is below 0.15, it calls OverlyImpure() too. Set to 0 to disable this. |
rate_up_lim | Optimal/max rate possible if all conditions are perfect |
reaction_flags | bitflags for clear conversions; REACTION_CLEAR_IMPURE, REACTION_CLEAR_INVERSE, REACTION_CLEAR_RETAIN, REACTION_INSTANT |
reaction_tags | Tagging vars A bitflag var for tagging reagents for the reagent loopup functon |
required_catalysts | Required chemicals that must be present in the container but are not USED. |
required_container | the exact container path required for the reaction to happen |
required_other | an integer required for the reaction to happen |
required_reagents | Required chemicals that are USED in the reaction |
required_temp | FermiChem! - See fermi_readme.md Required temperature for the reaction to begin, for fermimechanics it defines the lower area of bell curve for determining heat based rate reactions, aka the minimum |
results | Results of the chemical reactions |
temp_exponent_factor | How sharp the temperature exponential curve is (to the power of value) |
thermic_constant | How much the temperature will change (with no intervention) (i.e. for 30u made the temperature will increase by 100, same with 300u. The final temp will always be start + this value, with the exception con beakers with different specific heats) |
Procs | |
chemical_mob_spawn | Magical mob spawning when chemicals react |
clear_products | Clears the beaker of the product only |
clear_reactants | Clears the beaker of the reagents only if volume is not set, it will remove all of the reactant |
clear_reagents | Clears the beaker of ALL reagents inside |
convert_into_failed | Converts a reagent into the type specified by the failed_chem var of the input reagent |
default_explode | Generic explosions/failures |
explode_fire | BEGIN FIRE BASED EXPLOSIONS |
freeze_radius | END FIRE BASED EXPLOSIONS |
on_reaction | REACTION PROCS Shit that happens on reaction Only procs at the START of a reaction use reaction_step() for each step of a reaction or reaction_end() when the reaction stops If reaction_flags & REACTION_INSTANT then this is the only proc that is called. |
overheated | Occurs when a reation is overheated (i.e. past it's overheatTemp) Will be called every tick in the reaction that it is overheated If you want this to be a once only proc (i.e. the reaction is stopped after) set reaction.toDelete = TRUE The above is useful if you're writing an explosion By default the parent proc will reduce the final yield slightly. If you don't want that don't add ..() |
overly_impure | Occurs when a reation is too impure (i.e. it's below purity_min) Will be called every tick in the reaction that it is too impure If you want this to be a once only proc (i.e. the reaction is stopped after) set reaction.toDelete = TRUE The above is useful if you're writing an explosion By default the parent proc will reduce the purity of all reagents involved in the reaction in the beaker slightly. If you don't want that don't add ..() |
reaction_clear_check | REACTION_CLEAR handler If the reaction has the REACTION_CLEAR flag, then it will split using purity methods in the beaker instead |
reaction_finish | Stuff that occurs at the end of a reaction. This will proc if the beaker is forced to stop and start again (say for sudden temperature changes). Only procs at the END of reaction If reaction_flags & REACTION_INSTANT then this isn't called if reaction_flags REACTION_CLEAR_IMPURE then the impurity chem is handled here, producing the result in the beaker instead of in a mob Likewise for REACTION_CLEAR_INVERSE the inverse chem is produced at the end of the reaction in the beaker You should be calling ..() if you're writing a child function of this proc otherwise purity methods won't work correctly |
reaction_step | Stuff that occurs in the middle of a reaction Only procs DURING a reaction If reaction_flags & REACTION_INSTANT then this isn't called returning END_REACTION will END the reaction |
update_info | Updates information during the roundstart |
Var Details
H_ion_release

pH change per 1u reaction
determin_ph_range

How far out pH wil react, giving impurity place (Exponential phase)
is_cold_recipe

Set to TRUE if you want the recipe to only react when it's BELOW the required temp.
mix_message

The message shown to nearby people upon mixing, if applicable
mix_sound

The sound played upon mixing, if applicable
mob_react

Determines if a chemical reaction can occur inside a mob
optimal_ph_max

Higest value for above
optimal_ph_min

Lowest value of pH determining pH a 1 value for pH based rate reactions (Plateu phase)
optimal_temp

Upper end for above (i.e. the end of the curve section defined by temp_exponent_factor)
overheat_temp

Temperature at which reaction explodes - If any reaction is this hot, it explodes!
ph_exponent_factor

How sharp the pH exponential curve is (to the power of value)
purity_min

If purity is below 0.15, it calls OverlyImpure() too. Set to 0 to disable this.
rate_up_lim

Optimal/max rate possible if all conditions are perfect
reaction_flags

bitflags for clear conversions; REACTION_CLEAR_IMPURE, REACTION_CLEAR_INVERSE, REACTION_CLEAR_RETAIN, REACTION_INSTANT
reaction_tags

Tagging vars A bitflag var for tagging reagents for the reagent loopup functon
required_catalysts

Required chemicals that must be present in the container but are not USED.
required_container

the exact container path required for the reaction to happen
required_other

an integer required for the reaction to happen
required_reagents

Required chemicals that are USED in the reaction
required_temp

FermiChem! - See fermi_readme.md Required temperature for the reaction to begin, for fermimechanics it defines the lower area of bell curve for determining heat based rate reactions, aka the minimum
results

Results of the chemical reactions
temp_exponent_factor

How sharp the temperature exponential curve is (to the power of value)
thermic_constant

How much the temperature will change (with no intervention) (i.e. for 30u made the temperature will increase by 100, same with 300u. The final temp will always be start + this value, with the exception con beakers with different specific heats)
Proc Details
chemical_mob_spawn
Magical mob spawning when chemicals react
Your go to proc when you want to create new mobs from chemicals. please dont use on_reaction. Arguments:
- holder - the datum that holds this reagent, be it a beaker or anything else
- amount_to_spawn - how much /mob to spawn
- reaction_name - what is the name of this reaction. be creative, the world is your oyster after all!
- mob_class - determines if the mob will be friendly, neutral or hostile
- mob_faction - used in determining targets, mobs from the same faction won't harm eachother.
- random - creates random mobs. self explanatory.
clear_products
Clears the beaker of the product only
clear_reactants
Clears the beaker of the reagents only if volume is not set, it will remove all of the reactant
clear_reagents
Clears the beaker of ALL reagents inside
convert_into_failed
Converts a reagent into the type specified by the failed_chem var of the input reagent
Arguments:
- reagent - the target reagent to convert
default_explode
Generic explosions/failures
explode_fire
BEGIN FIRE BASED EXPLOSIONS
freeze_radius
END FIRE BASED EXPLOSIONS
on_reaction
REACTION PROCS Shit that happens on reaction Only procs at the START of a reaction use reaction_step() for each step of a reaction or reaction_end() when the reaction stops If reaction_flags & REACTION_INSTANT then this is the only proc that is called.
Proc where the additional magic happens. You dont want to handle mob spawning in this since there is a dedicated proc for that.client Arguments:
- holder - the datum that holds this reagent, be it a beaker or anything else
- created_volume - volume created when this is mixed. look at 'var/list/results'.
overheated
Occurs when a reation is overheated (i.e. past it's overheatTemp) Will be called every tick in the reaction that it is overheated If you want this to be a once only proc (i.e. the reaction is stopped after) set reaction.toDelete = TRUE The above is useful if you're writing an explosion By default the parent proc will reduce the final yield slightly. If you don't want that don't add ..()
Arguments:
- holder - the datum that holds this reagent, be it a beaker or anything else
- equilibrium - the equilibrium datum that contains the equilibrium reaction properties and methods
- step_volume_added - how much product (across all products) was added for this single step
overly_impure
Occurs when a reation is too impure (i.e. it's below purity_min) Will be called every tick in the reaction that it is too impure If you want this to be a once only proc (i.e. the reaction is stopped after) set reaction.toDelete = TRUE The above is useful if you're writing an explosion By default the parent proc will reduce the purity of all reagents involved in the reaction in the beaker slightly. If you don't want that don't add ..()
Arguments:
- holder - the datum that holds this reagent, be it a beaker or anything else
- equilibrium - the equilibrium datum that contains the equilibrium reaction properties and methods
- step_volume_added - how much product (across all products) was added for this single step
reaction_clear_check
REACTION_CLEAR handler If the reaction has the REACTION_CLEAR flag, then it will split using purity methods in the beaker instead
Arguments:
- reagent - the target reagent to convert
reaction_finish
Stuff that occurs at the end of a reaction. This will proc if the beaker is forced to stop and start again (say for sudden temperature changes). Only procs at the END of reaction If reaction_flags & REACTION_INSTANT then this isn't called if reaction_flags REACTION_CLEAR_IMPURE then the impurity chem is handled here, producing the result in the beaker instead of in a mob Likewise for REACTION_CLEAR_INVERSE the inverse chem is produced at the end of the reaction in the beaker You should be calling ..() if you're writing a child function of this proc otherwise purity methods won't work correctly
Proc where the additional magic happens. You dont want to handle mob spawning in this since there is a dedicated proc for that.client Arguments:
- holder - the datum that holds this reagent, be it a beaker or anything else
- react_volume - volume created across the whole reaction
reaction_step
Stuff that occurs in the middle of a reaction Only procs DURING a reaction If reaction_flags & REACTION_INSTANT then this isn't called returning END_REACTION will END the reaction
Arguments:
- reaction - the equilibrium reaction holder that is reaction is processed within - use this to edit delta_t and delta
- holder - the datum that holds this reagent, be it a beaker or anything else
- created_volume - volume created per step
- added_purity - how pure the created volume is per step
Outputs:
- returning END_REACTION will end the associated reaction - flagging it for deletion and preventing any reaction in that timestep from happening. Make sure to set the vars in the holder to one that can't start it from starting up again.
update_info
Updates information during the roundstart
This proc is mainly used by explosives but can be used anywhere else You should generally use the special reactions in /datum/chemical_reaction/randomized But for simple variable edits, like changing the temperature or adding/subtracting required reagents it is better to use this.