From 982e3e4934b01234a1b616237edab69e20d5b4cc Mon Sep 17 00:00:00 2001 From: nullbear Date: Sun, 28 Aug 2016 17:15:03 -0700 Subject: [PATCH] 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. --- code/modules/reagents/chemistry/holder.dm | 3 ++- code/modules/reagents/chemistry/recipes.dm | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 87cb467f228..651dc767ccc 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -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) diff --git a/code/modules/reagents/chemistry/recipes.dm b/code/modules/reagents/chemistry/recipes.dm index dec6a64ad18..5943577d59c 100644 --- a/code/modules/reagents/chemistry/recipes.dm +++ b/code/modules/reagents/chemistry/recipes.dm @@ -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