Brings over update_stat

This commit is contained in:
Crazylemon64
2016-10-14 17:56:57 -07:00
parent 8a6db8891f
commit 7c8709b360
9 changed files with 121 additions and 8 deletions

View File

@@ -0,0 +1,8 @@
/mob/living/carbon/brain/update_stat()
if(status_flags & GODMODE)
return
// if(health <= min_health)
if(health <= config.health_threshold_dead)
if(stat != DEAD)
death()
// Put brain(organ) damaging code here

View File

@@ -0,0 +1,17 @@
/mob/living/carbon/update_stat()
if(status_flags & GODMODE)
return
if(stat != DEAD)
// if(health <= min_health)
if(health <= config.health_threshold_dead)
death()
return
// if(paralysis || sleeping || getOxyLoss() > low_oxy_ko || (status_flags & FAKEDEATH) || health <= crit_health)
if(paralysis || sleeping || getOxyLoss() > 40 || (status_flags & FAKEDEATH) || health <= config.health_threshold_crit)
if(stat == CONSCIOUS)
KnockOut()
else
if(stat == UNCONSCIOUS)
// updating=FALSE because `WakeUp` will handle canmove up for us
StopResting(updating=FALSE)
WakeUp()

View File

@@ -310,14 +310,6 @@
C.reagents.clear_reagents()
C.reagents.addiction_list.Cut()
/mob/living/proc/update_revive() // handles revival through other means than cloning or adminbus (defib, IPC repair)
stat = CONSCIOUS
dead_mob_list -= src
living_mob_list |= src
mob_list |= src
SetEarDeaf(0)
timeofdeath = null
/mob/living/proc/rejuvenate()
var/mob/living/carbon/human/human_mob = null //Get this declared for use later.

View File

@@ -0,0 +1,10 @@
/mob/living/silicon/ai/update_stat()
if(status_flags & GODMODE)
return
if(stat != DEAD)
if(health <= config.health_threshold_dead)
death()
return
else if(stat == UNCONSCIOUS)
WakeUp()
//diag_hud_set_status()

View File

@@ -0,0 +1,3 @@
/mob/living/silicon/pai/update_stat()
if(health <= 0)
death(gibbed = 0)

View File

@@ -0,0 +1,10 @@
//Easiest to check this here, then check again in the robot proc.
//Standard robots use config for crit, which is somewhat excessive for these guys.
//Drones killed by damage will gib.
/mob/living/silicon/robot/drone/update_stat()
if(status_flags & GODMODE)
return
if(health <= -35 && stat != DEAD)
gib()
return
return ..()

View File

@@ -2,3 +2,20 @@
/mob/living/silicon/robot/incapacitated()
if(stat || lockcharge || weakened || stunned || paralysis || !is_component_functioning("actuator"))
return 1
/mob/living/silicon/robot/update_stat()
if(status_flags & GODMODE)
return
if(stat != DEAD)
if(health <= -maxHealth) //die only once
death()
return
if(!is_component_functioning("actuator") || paralysis || sleeping || stunned || weakened || getOxyLoss() > maxHealth * 0.5)
if(stat == CONSCIOUS)
KnockOut()
else
if(stat == UNCONSCIOUS)
WakeUp()
// diag_hud_set_status()
// diag_hud_set_health()
// update_health_hud()

View File

@@ -0,0 +1,50 @@
// There, now `stat` is a proper state-machine
/mob/living/proc/KnockOut(updating = 1)
if(stat == DEAD)
log_runtime(EXCEPTION("KnockOut called on a dead mob."), src)
return 0
else if(stat == UNCONSCIOUS)
return 0
add_logs(src, null, "fallen unconscious at [atom_loc_line(get_turf(src))]", admin=0)
stat = UNCONSCIOUS
if(updating)
// update_blind_effects()
update_canmove()
return 1
/mob/living/proc/WakeUp(updating = 1)
if(stat == DEAD)
log_runtime(EXCEPTION("WakeUp called on a dead mob."), src)
return 0
else if(stat == CONSCIOUS)
return 0
add_logs(src, null, "woken up at [atom_loc_line(get_turf(src))]", admin=0)
stat = CONSCIOUS
if(updating)
// update_blind_effects()
update_canmove()
return 1
/mob/living/proc/can_be_revived()
. = TRUE
// if(health <= min_health)
if(health <= config.health_threshold_dead)
return FALSE
// death() is used to make a mob die
// handles revival through other means than cloning or adminbus (defib, IPC repair)
/mob/living/proc/update_revive()
if(stat != DEAD)
return
if(!can_be_revived())
return
add_logs(src, null, "came back to life at [atom_loc_line(get_turf(src))]", admin=0)
stat = CONSCIOUS
dead_mob_list -= src
living_mob_list += src
timeofdeath = null
update_canmove()
// update_blind_effects()
updatehealth()