Changed the fast move code from a bunch of has_reagents checks to a bitflag check.

The reagents turn on the flag per on_mob_life proc run, the flag is turned off if a check for the reagents fails, the check is called when reagents are deleted
This commit is contained in:
Malkevin
2014-04-01 00:50:42 +01:00
parent 0725ba44a4
commit a35f993c69
4 changed files with 13 additions and 5 deletions
@@ -1,11 +1,7 @@
/mob/living/carbon/human/movement_delay()
if(!has_gravity(src))
return -1 //It's hard to be slowed down in space by... anything
else if(reagents.has_reagent("hyperzine"))
return -1
else if(reagents.has_reagent("nuka_cola"))
return -1
else if(reagents.has_reagent("unholywater"))
else if(status_flags & GOTTAGOFAST)
return -1
. = 0
@@ -312,11 +312,19 @@ datum
del(A)
update_total()
my_atom.on_reagent_change()
check_gofast(my_atom)
return 0
return 1
check_gofast(var/mob/M)
if(istype(M, /mob))
if(M.reagents.has_reagent("hyperzine")||M.reagents.has_reagent("unholywater")||M.reagents.has_reagent("nuka_cola"))
return 1
else
M.status_flags &= ~GOTTAGOFAST
update_total()
total_volume = 0
for(var/datum/reagent/R in reagent_list)
@@ -297,6 +297,7 @@ datum
on_mob_life(var/mob/living/M as mob)
M.adjustBrainLoss(3)
if(iscultist(M))
M.status_flags |= GOTTAGOFAST
M.drowsyness = max(M.drowsyness-5, 0)
M.AdjustParalysis(-2)
M.AdjustStunned(-2)
@@ -1131,6 +1132,7 @@ datum
on_mob_life(var/mob/living/M as mob)
if(!M) M = holder.my_atom
if(prob(5)) M.emote(pick("twitch","blink_r","shiver"))
M.status_flags |= GOTTAGOFAST
holder.remove_reagent(src.id, 0.5 * REAGENTS_METABOLISM)
// ..() //this was causing hyperzine to be consumed twice...
return
@@ -2524,6 +2526,7 @@ datum
M.dizziness +=5
M.drowsyness = 0
M.sleeping = max(0,M.sleeping-2)
M.status_flags |= GOTTAGOFAST
if (M.bodytemperature > 310)//310 is the normal bodytemp. 310.055
M.bodytemperature = max(310, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT))
M.nutrition += 1