Adds support for inverse required temp reactions.

Ie. Cooling a mixture to cause a reaction, instead of heating it. Just
set 'is_cold_recipe' to 1 in the reaction.
This commit is contained in:
nullbear
2016-08-28 17:15:03 -07:00
parent 4d6702c08e
commit 982e3e4934
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -344,6 +344,7 @@ var/const/INJECT = 5 //injection
var/matching_other = 0
var/list/multipliers = new/list()
var/required_temp = C.required_temp
var/is_cold_recipe = C.is_cold_recipe
for(var/B in C.required_reagents)
if(!has_reagent(B, C.required_reagents[B]))
@@ -377,7 +378,7 @@ var/const/INJECT = 5 //injection
required_temp = chem_temp
if(total_matching_reagents == total_required_reagents && total_matching_catalysts == total_required_catalysts && matching_container && matching_other && chem_temp >= required_temp)
if(total_matching_reagents == total_required_reagents && total_matching_catalysts == total_required_catalysts && matching_container && matching_other && (is_cold_recipe ? chem_temp <= required_temp : chem_temp >= required_temp))
var/multiplier = min(multipliers)
for(var/B in C.required_reagents)
remove_reagent(B, (multiplier * C.required_reagents[B]), safety = 1)
@@ -13,6 +13,7 @@
var/mob_react = 0 //Determines if a chemical reaction can occur inside a mob
var/required_temp = 0
var/is_cold_recipe = 0 // Set to 1 if you want the recipe to only react when it's BELOW the required temp.
var/mix_message = "The solution begins to bubble." //The message shown to nearby people upon mixing, if applicable
var/mix_sound = 'sound/effects/bubbles.ogg' //The sound played upon mixing, if applicable