Merge pull request #2079 from Fox-McCloud/reagent-GC

Fixes Reagents GCing and Runtimes
This commit is contained in:
Mark van Alphen
2015-09-17 22:12:59 +02:00
8 changed files with 55 additions and 52 deletions
@@ -22,7 +22,6 @@
// Sober block makes it more difficult to get drunk
var/sober_str=!(SOBER in M.mutations)?1:2
M:nutrition += nutriment_factor
holder.remove_reagent(src.id, FOOD_METABOLISM)
if(!src.data) data = 1
src.data++
@@ -67,7 +66,6 @@
if (istype(L))
L.take_damage(0.1, 1)
H.adjustToxLoss(0.1)
holder.remove_reagent(src.id, 0.4)
..()
return
@@ -246,7 +244,6 @@
/datum/reagent/ethanol/thirteenloko/on_mob_life(var/mob/living/M as mob)
..()
M:nutrition += nutriment_factor
holder.remove_reagent(src.id, FOOD_METABOLISM)
M:drowsyness = max(0,M:drowsyness-7)
//if(!M:sleeping_willingly)
// M:sleeping = max(0,M.sleeping-2)
@@ -147,7 +147,7 @@
/datum/reagent/drink/milk/on_mob_life(var/mob/living/M as mob)
if(M.getBruteLoss() && prob(20)) M.heal_organ_damage(1,0)
if(holder.has_reagent("capsaicin"))
holder.remove_reagent("capsaicin", 10*REAGENTS_METABOLISM)
holder.remove_reagent("capsaicin", 2)
..()
return
@@ -189,8 +189,8 @@
overdose_threshold = 45
/datum/reagent/drink/coffee/on_mob_life(var/mob/living/M as mob)
if(adj_temp > 0 && holder.has_reagent("frostoil"))
holder.remove_reagent("frostoil", 10*REAGENTS_METABOLISM)
if(holder.has_reagent("frostoil"))
holder.remove_reagent("frostoil", 5)
if(prob(50))
M.AdjustParalysis(-1)
M.AdjustStunned(-1)
@@ -13,14 +13,11 @@
/datum/reagent/drink/on_mob_life(var/mob/living/M as mob)
if(!M) M = holder.my_atom
M.nutrition += nutriment_factor
holder.remove_reagent(src.id, FOOD_METABOLISM)
if (adj_dizzy) M.dizziness = max(0,M.dizziness + adj_dizzy)
if (adj_drowsy) M.drowsyness = max(0,M.drowsyness + adj_drowsy)
if (adj_sleepy) M.sleeping = max(0,M.sleeping + adj_sleepy)
if (adj_temp)
if (M.bodytemperature < 310)//310 is the normal bodytemp. 310.055
M.bodytemperature = min(310, M.bodytemperature + (25 * TEMPERATURE_DAMAGE_COEFFICIENT))
// Drinks should be used up faster than other reagents.
holder.remove_reagent(src.id, FOOD_METABOLISM)
..()
return
@@ -125,7 +125,6 @@
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature -= rand(15,20)
data++
holder.remove_reagent(src.id, FOOD_METABOLISM)
..()
return
@@ -34,6 +34,7 @@
description = "You just don't get it maaaan."
reagent_state = LIQUID
color = "#664300" // rgb: 102, 67, 0
metabolization_rate = 0.2 * REAGENTS_METABOLISM
/datum/reagent/hippies_delight/on_mob_life(var/mob/living/M as mob)
if(!M) M = holder.my_atom
@@ -56,7 +57,6 @@
M.Dizzy(40)
M.druggy = max(M.druggy, 60)
if(prob(30)) M.emote(pick("twitch","giggle"))
holder.remove_reagent(src.id, 0.2)
data++
..()
return
@@ -105,15 +105,61 @@
M.bodytemperature += 10 * TEMPERATURE_DAMAGE_COEFFICIENT
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature += rand(10,20)
if(25 to INFINITY)
if(25 to 35)
M.bodytemperature += 15 * TEMPERATURE_DAMAGE_COEFFICIENT
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature += rand(15,20)
holder.remove_reagent(src.id, FOOD_METABOLISM)
if(35 to INFINITY)
M.bodytemperature += 20 * TEMPERATURE_DAMAGE_COEFFICIENT
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature += rand(20,25)
data++
..()
return
/datum/reagent/frostoil
name = "Frost Oil"
id = "frostoil"
description = "A special oil that noticably chills the body. Extraced from Icepeppers."
reagent_state = LIQUID
color = "#8BA6E9" // rgb: 139, 166, 233
process_flags = ORGANIC | SYNTHETIC
/datum/reagent/frostoil/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 -= 10 * 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 -= 15 * TEMPERATURE_DAMAGE_COEFFICIENT
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature -= rand(10,20)
if(25 to 35)
M.bodytemperature -= 20 * TEMPERATURE_DAMAGE_COEFFICIENT
if(prob(1))
M.emote("shiver")
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature -= rand(15,20)
if(35 to INFINITY)
M.bodytemperature -= 20 * TEMPERATURE_DAMAGE_COEFFICIENT
if(prob(1))
M.emote("shiver")
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature -= rand(20,25)
data++
..()
return
/datum/reagent/frostoil/reaction_turf(var/turf/simulated/T, var/volume)
if(volume >= 5)
for(var/mob/living/carbon/slime/M in T)
M.adjustToxLoss(rand(15,30))
/datum/reagent/sodiumchloride
name = "Salt"
@@ -417,6 +417,7 @@
id = "beer2"
description = "An alcoholic beverage made from malted grains, hops, yeast, and water."
color = "#664300" // rgb: 102, 67, 0
metabolization_rate = 1.5 * REAGENTS_METABOLISM
/datum/reagent/beer2/on_mob_life(var/mob/living/M as mob)
if(!data)
@@ -428,7 +429,6 @@
M.sleeping += 1
M.adjustToxLoss((data - 50)*REM)
data++
holder.remove_reagent(src.id, 0.5 * REAGENTS_METABOLISM)
..()
return
@@ -557,41 +557,4 @@
if(prob(5))
M.visible_message("<span class='warning'>[M] [pick("dry heaves!","coughs!","splutters!")]</span>")
..()
return
/datum/reagent/frostoil
name = "Frost Oil"
id = "frostoil"
description = "A special oil that noticably chills the body. Extraced from Icepeppers."
reagent_state = LIQUID
color = "#8BA6E9" // rgb: 139, 166, 233
process_flags = ORGANIC | SYNTHETIC
/datum/reagent/frostoil/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 -= 10 * 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 -= 15 * TEMPERATURE_DAMAGE_COEFFICIENT
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature -= rand(10,20)
if(25 to INFINITY)
M.bodytemperature -= 20 * TEMPERATURE_DAMAGE_COEFFICIENT
if(prob(1))
M.emote("shiver")
if(istype(M, /mob/living/carbon/slime))
M.bodytemperature -= rand(15,20)
data++
holder.remove_reagent(src.id, FOOD_METABOLISM)
..()
return
/datum/reagent/frostoil/reaction_turf(var/turf/simulated/T, var/volume)
for(var/mob/living/carbon/slime/M in T)
M.adjustToxLoss(rand(15,30))
return
@@ -277,6 +277,7 @@
M.jitteriness = 0
M.stuttering = 0
M.confused = 0
return
if(ishuman(M)) .
if(((M.mind in ticker.mode.vampires) || M.mind.vampire) && (!(VAMP_FULL in M.mind.vampire.powers)) && prob(80))
switch(data)