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 | |
inhibitors | Reagents that block the reaction from occuring, like an inverse catalyst. |
---|---|
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_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! |
rate_up_lim | Optimal/max rate possible if all conditions are perfect |
reaction_flags | Affects how reactions occur |
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 | Some stupid magic bullshit for slime reactions. Literally what the fuck. |
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 changes per unit of chem used. without REACTION_HEAT_ARBITARY flag the rate of change depends on the holder heat capacity else results are more accurate |
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 |
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 ..() |
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 |
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
inhibitors

Reagents that block the reaction from occuring, like an inverse catalyst.
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_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!
rate_up_lim

Optimal/max rate possible if all conditions are perfect
reaction_flags

Affects how reactions occur
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

Some stupid magic bullshit for slime reactions. Literally what the fuck.
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 changes per unit of chem used. without REACTION_HEAT_ARBITARY flag the rate of change depends on the holder heat capacity else results are more accurate
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
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
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
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.