/tg/ Station 13 - Modules - TypesVar Details - Proc Details

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_releasepH change per 1u reaction
determin_ph_rangeHow far out pH wil react, giving impurity place (Exponential phase)
is_cold_recipeSet to TRUE if you want the recipe to only react when it's BELOW the required temp.
mix_messageThe message shown to nearby people upon mixing, if applicable
mix_soundThe sound played upon mixing, if applicable
mob_reactDetermines if a chemical reaction can occur inside a mob
optimal_ph_maxHigest value for above
optimal_ph_minLowest value of pH determining pH a 1 value for pH based rate reactions (Plateu phase)
optimal_tempUpper end for above (i.e. the end of the curve section defined by temp_exponent_factor)
overheat_tempTemperature at which reaction explodes - If any reaction is this hot, it explodes!
ph_exponent_factorHow sharp the pH exponential curve is (to the power of value)
purity_minIf purity is below 0.15, it calls OverlyImpure() too. Set to 0 to disable this.
rate_up_limOptimal/max rate possible if all conditions are perfect
reaction_flagsbitflags for clear conversions; REACTION_CLEAR_IMPURE, REACTION_CLEAR_INVERSE, REACTION_CLEAR_RETAIN, REACTION_INSTANT
reaction_tagsTagging vars A bitflag var for tagging reagents for the reagent loopup functon
required_catalystsRequired chemicals that must be present in the container but are not USED.
required_containerthe exact container path required for the reaction to happen
required_otheran integer required for the reaction to happen
required_reagentsRequired chemicals that are USED in the reaction
required_tempFermiChem! - 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
resultsResults of the chemical reactions
temp_exponent_factorHow sharp the temperature exponential curve is (to the power of value)
thermic_constantHow 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_spawnMagical mob spawning when chemicals react
clear_productsClears the beaker of the product only
clear_reactantsClears the beaker of the reagents only if volume is not set, it will remove all of the reactant
clear_reagentsClears the beaker of ALL reagents inside
convert_into_failedConverts a reagent into the type specified by the failed_chem var of the input reagent
default_explodeGeneric explosions/failures
explode_fireBEGIN FIRE BASED EXPLOSIONS
freeze_radiusEND FIRE BASED EXPLOSIONS
on_reactionREACTION 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.
overheatedOccurs 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_impureOccurs 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_checkREACTION_CLEAR handler If the reaction has the REACTION_CLEAR flag, then it will split using purity methods in the beaker instead
reaction_finishStuff 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_stepStuff 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_infoUpdates 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:

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:

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:

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:

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:

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:

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:

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:

Outputs:

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.