From 342fbdd136916510addac177348de41c2962de9e Mon Sep 17 00:00:00 2001 From: Walter0o Date: Mon, 11 Aug 2014 12:46:43 +0200 Subject: [PATCH] fixes #5919 and some other reagent value issues negative values everywhere. --- code/modules/reagents/Chemistry-Reagents.dm | 60 +++++++-------------- 1 file changed, 19 insertions(+), 41 deletions(-) diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index 88fa6a13c2..42c28113c2 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -1315,7 +1315,7 @@ datum var/datum/organ/internal/eyes/E = H.internal_organs_by_name["eyes"] if(istype(E)) if(E.damage > 0) - E.damage -= 1 + E.damage = max(E.damage - 1, 0) ..() return @@ -1336,7 +1336,7 @@ datum //Peridaxon is hard enough to get, it's probably fair to make this all internal organs for(var/datum/organ/internal/I in H.internal_organs) if(I.damage > 0) - I.damage -= 0.20 + I.damage = max(I.damage - 0.20, 0) ..() return @@ -2039,7 +2039,7 @@ datum on_mob_life(var/mob/living/M as mob) if(!M) M = holder.my_atom - M.nutrition -= nutriment_factor + M.nutrition = max(M.nutrition - nutriment_factor, 0) M.overeatduration = 0 if(M.nutrition < 0)//Prevent from going into negatives. M.nutrition = 0 @@ -2189,25 +2189,14 @@ datum color = "#B31008" // rgb: 139, 166, 233 on_mob_life(var/mob/living/M as mob) - if(!M) M = holder.my_atom - if(!data) data = 1 - switch(data) - if(1 to 15) - M.bodytemperature -= 5 * TEMPERATURE_DAMAGE_COEFFICIENT - if(holder.has_reagent("capsaicin")) - holder.remove_reagent("capsaicin", 5) - if(istype(M, /mob/living/carbon/slime)) - M.bodytemperature -= rand(5,20) - if(15 to 25) - M.bodytemperature -= 10 * TEMPERATURE_DAMAGE_COEFFICIENT - if(istype(M, /mob/living/carbon/slime)) - M.bodytemperature -= rand(10,20) - if(25 to INFINITY) - M.bodytemperature -= 15 * TEMPERATURE_DAMAGE_COEFFICIENT - if(prob(1)) M.emote("shiver") - if(istype(M, /mob/living/carbon/slime)) - M.bodytemperature -= rand(15,20) - data++ + if(!M) + M = holder.my_atom + M.bodytemperature = max(M.bodytemperature - 10 * TEMPERATURE_DAMAGE_COEFFICIENT, 0) + if(prob(1)) + M.emote("shiver") + if(istype(M, /mob/living/carbon/slime)) + M.bodytemperature = max(M.bodytemperature - rand(10,20), 0) + holder.remove_reagent("capsaicin", 5) holder.remove_reagent(src.id, FOOD_METABOLISM) ..() return @@ -2830,25 +2819,14 @@ datum adj_temp = -9 on_mob_life(var/mob/living/M as mob) - if(!M) M = holder.my_atom - if(!data) data = 1 - switch(data) - if(1 to 15) - M.bodytemperature -= 5 * TEMPERATURE_DAMAGE_COEFFICIENT - if(holder.has_reagent("capsaicin")) - holder.remove_reagent("capsaicin", 5) - if(istype(M, /mob/living/carbon/slime)) - M.bodytemperature -= rand(5,20) - if(15 to 25) - M.bodytemperature -= 10 * TEMPERATURE_DAMAGE_COEFFICIENT - if(istype(M, /mob/living/carbon/slime)) - M.bodytemperature -= rand(10,20) - if(25 to INFINITY) - M.bodytemperature -= 15 * TEMPERATURE_DAMAGE_COEFFICIENT - if(prob(1)) M.emote("shiver") - if(istype(M, /mob/living/carbon/slime)) - M.bodytemperature -= rand(15,20) - data++ + if(!M) + M = holder.my_atom + M.bodytemperature = max(M.bodytemperature - 10 * TEMPERATURE_DAMAGE_COEFFICIENT, 0) + if(prob(1)) + M.emote("shiver") + if(istype(M, /mob/living/carbon/slime)) + M.bodytemperature = max(M.bodytemperature - rand(10,20), 0) + holder.remove_reagent("capsaicin", 5) holder.remove_reagent(src.id, FOOD_METABOLISM) ..() return