Organ lag fixes

This commit is contained in:
ZomgPonies
2013-11-08 09:50:34 -05:00
parent 2d1229768e
commit 950011d4d8
6 changed files with 100 additions and 189 deletions
+15 -19
View File
@@ -23,11 +23,11 @@
/datum/medical_effect/proc/cure(mob/living/carbon/human/H)
for(var/R in cures)
if(H.reagents.has_reagent(R))
H <<"\red [cure_message]"
if (cure_message)
H <<"\blue [cure_message]"
return 1
return 0
// MOB HELPERS
// ===========
/mob/living/carbon/human/var/list/datum/medical_effect/side_effects = list()
@@ -39,16 +39,20 @@
M.start = life_tick
return
var/list/L = typesof(/datum/medical_effect)-/datum/medical_effect
var/T = side_effects[name]
if (!T)
return
for(var/T in L)
var/datum/medical_effect/M = new T
if(M.name == name)
M.strength = strength
M.start = life_tick
side_effects += M
var/datum/medical_effect/M = new T
if(M.name == name)
M.strength = strength
M.start = life_tick
side_effects += M
/mob/living/carbon/human/proc/handle_medical_side_effects()
//Going to handle those things only every few ticks.
if(life_tick % 15 != 0)
return 0
var/list/L = typesof(/datum/medical_effect)-/datum/medical_effect
for(var/T in L)
@@ -60,18 +64,14 @@
for (var/datum/medical_effect/M in side_effects)
if (!M) continue
var/strength_percent = sin((life_tick - M.start) / 2)
log_debug ("[src], tick [life_tick] : Processing [M], Current phase: [strength_percent]")
// Only do anything if the effect is currently strong enough
if(strength_percent >= 0.4)
log_debug ("[src], tick [life_tick] : Active phase ; strength [M.strength]")
if (M.cure(src) || M.strength > 50)
log_debug ("[src], tick [life_tick] : [M] cured or reached end of lifecycle")
side_effects -= M
del(M)
M = null
else
if(life_tick % 45 == 0)
log_debug ("[src], tick [life_tick] : Activating [M] ")
M.on_life(src, strength_percent*M.strength)
// Effect slowly growing stronger
M.strength+=0.08
@@ -92,7 +92,6 @@
H.custom_pain("You feel a throbbing pain in your head!",1)
if(31 to INFINITY)
H.custom_pain("You feel an excrutiating pain in your head!",1)
H.adjustBrainLoss(1)
// BAD STOMACH
// ===========
@@ -110,7 +109,6 @@
H.custom_pain("Your stomach hurts.",0)
if(31 to INFINITY)
H.custom_pain("You feel sick.",1)
H.adjustToxLoss(1)
// CRAMPS
// ======
@@ -129,7 +127,6 @@
if(31 to INFINITY)
H.emote("me",1,"flinches as all the muscles in their body cramp up.")
H.custom_pain("There's pain all over your body.",1)
H.adjustToxLoss(1)
// ITCH
// ====
@@ -147,5 +144,4 @@
H.custom_pain("You want to scratch your itch badly.",0)
if(31 to INFINITY)
H.emote("me",1,"shivers slightly.")
H.custom_pain("This itch makes it really hard to concentrate.",1)
H.adjustToxLoss(1)
H.custom_pain("This itch makes it really hard to concentrate.",1)