Added mob.set_stat() proc so we can capture mob stat changes.

Also added a canary to detect attempts to set_stat() on ghosts.
This commit is contained in:
Leshana
2020-03-20 23:05:50 -04:00
parent efeaf058ff
commit 252acb5011
4 changed files with 13 additions and 6 deletions

View File

@@ -94,8 +94,6 @@
plane = PLANE_GHOSTS //Why doesn't the var above work...???
verbs += /mob/observer/dead/proc/dead_tele
stat = DEAD
var/turf/T
if(ismob(body))
T = get_turf(body) //Where is the body located?
@@ -149,6 +147,11 @@
/mob/observer/dead/CanPass(atom/movable/mover, turf/target)
return TRUE
/mob/observer/dead/set_stat(var/new_stat)
if(new_stat != DEAD)
CRASH("It is best if observers stay dead, thank you.")
/*
Transfer_mind is there to check if mob is being deleted/not going to have a body.
Works together with spawning an observer, noted above.

View File

@@ -1089,9 +1089,9 @@
return 1
/mob/living/carbon/human/proc/set_stat(var/new_stat)
stat = new_stat
if(stat)
/mob/living/carbon/human/set_stat(var/new_stat)
. = ..()
if(. && stat)
update_skin(1)
/mob/living/carbon/human/handle_regular_hud_updates()

View File

@@ -211,7 +211,6 @@ default behaviour is:
else
health = getMaxHealth() - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() - halloss
//This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually
//affects them once clothing is factored in. ~Errorage
/mob/living/proc/calculate_affecting_pressure(var/pressure)

View File

@@ -1016,6 +1016,11 @@ mob/proc/yank_out_object()
/mob/proc/updateicon()
return
// Please always use this proc, never just set the var directly.
/mob/proc/set_stat(var/new_stat)
. = (stat != new_stat)
stat = new_stat
/mob/verb/face_direction()
set name = "Face Direction"