Port set_stat and COMSIG_MOB_STATCHANGE from TG

This commit is contained in:
Elizabeth Lavenza
2024-04-13 18:04:11 -04:00
parent dd8c641520
commit 174aca4b01
25 changed files with 47 additions and 33 deletions
+2 -2
View File
@@ -75,7 +75,7 @@
brainmob.forceMove(src)
brainmob.container = src
if(!(newbrain.organ_flags & ORGAN_FAILING)) // the brain organ hasn't been beaten to death.
brainmob.stat = CONSCIOUS //we manually revive the brain mob
brainmob.set_stat(CONSCIOUS) //we manually revive the brain mob
brainmob.remove_from_dead_mob_list()
brainmob.add_to_alive_mob_list()
@@ -112,7 +112,7 @@
if(brain.brainmob)
brainmob.container = null //Reset brainmob mmi var.
brainmob.forceMove(brain) //Throw mob into brain.
brainmob.stat = DEAD
brainmob.set_stat(DEAD)
brainmob.emp_damage = 0
brainmob.reset_perspective() //so the brainmob follows the brain organ instead of the mmi. And to update our vision
brain.brainmob = brainmob //Set the brain to use the brainmob
+1 -1
View File
@@ -1,7 +1,7 @@
/mob/living/brain/death(gibbed)
if(stat == DEAD)
return
stat = DEAD
set_stat(DEAD)
if(!gibbed && container)//If not gibbed but in a container.
var/obj/item/mmi = container
+2 -2
View File
@@ -135,7 +135,7 @@ GLOBAL_VAR(posibrain_notify_cooldown)
brainmob.stored_dna = new /datum/dna/stored(brainmob)
C.dna.copy_dna(brainmob.stored_dna)
brainmob.timeofhostdeath = C.timeofdeath
brainmob.stat = CONSCIOUS
brainmob.set_stat(CONSCIOUS)
if(brainmob.mind)
brainmob.mind.assigned_role = new_role
if(C.mind)
@@ -158,7 +158,7 @@ GLOBAL_VAR(posibrain_notify_cooldown)
name = "[initial(name)] ([brainmob.name])"
to_chat(brainmob, welcome_message)
brainmob.mind.assigned_role = new_role
brainmob.stat = CONSCIOUS
brainmob.set_stat(CONSCIOUS)
brainmob.remove_from_dead_mob_list()
brainmob.add_to_alive_mob_list()
@@ -16,12 +16,12 @@
return
if(IsUnconscious() || IsSleeping() || getOxyLoss() > 50 || (HAS_TRAIT(src, TRAIT_DEATHCOMA)) || health <= crit_threshold)
if(stat == CONSCIOUS)
stat = UNCONSCIOUS
set_stat(UNCONSCIOUS)
if(!eye_blind)
blind_eyes(1)
update_mobility()
else if(stat == UNCONSCIOUS)
stat = CONSCIOUS
set_stat(CONSCIOUS)
if(!(combat_flags & COMBAT_FLAG_HARD_STAMCRIT))
set_resting(FALSE, TRUE)
if(eye_blind <= 1)
+3 -3
View File
@@ -807,16 +807,16 @@
death()
return
if(IsUnconscious() || IsSleeping() || getOxyLoss() > 50 || (HAS_TRAIT(src, TRAIT_DEATHCOMA)) || (health <= HEALTH_THRESHOLD_FULLCRIT && !HAS_TRAIT(src, TRAIT_NOHARDCRIT)))
stat = UNCONSCIOUS
set_stat(UNCONSCIOUS)
SEND_SIGNAL(src, COMSIG_DISABLE_COMBAT_MODE)
if(!eye_blind)
blind_eyes(1)
else
if(health <= crit_threshold && !HAS_TRAIT(src, TRAIT_NOSOFTCRIT))
stat = SOFT_CRIT
set_stat(SOFT_CRIT)
SEND_SIGNAL(src, COMSIG_DISABLE_COMBAT_MODE)
else
stat = CONSCIOUS
set_stat(CONSCIOUS)
if(eye_blind <= 1)
adjust_blindness(-1)
update_mobility()
+1 -1
View File
@@ -57,7 +57,7 @@
/mob/living/death(gibbed)
SEND_SIGNAL(src, COMSIG_LIVING_PREDEATH, gibbed)
stat = DEAD
set_stat(DEAD)
unset_machine()
timeofdeath = world.time
tod = STATION_TIME_TIMESTAMP("hh:mm:ss", world.time)
+1 -1
View File
@@ -626,7 +626,7 @@
remove_from_dead_mob_list()
add_to_alive_mob_list()
suiciding = 0
stat = UNCONSCIOUS //the mob starts unconscious,
set_stat(UNCONSCIOUS) //the mob starts unconscious,
if(!eye_blind)
blind_eyes(1)
updatehealth() //then we check if the mob should wake up.
+1 -1
View File
@@ -413,7 +413,7 @@
else
the_mmi.forceMove(get_turf(src))
if(the_mmi.brainmob.stat == DEAD && !suiciding)
the_mmi.brainmob.stat = CONSCIOUS
the_mmi.brainmob.set_stat(CONSCIOUS)
if(mind)
mind.transfer_to(the_mmi.brainmob)
the_mmi.update_appearance()
+1 -1
View File
@@ -79,7 +79,7 @@
death()
return
else if(stat == UNCONSCIOUS)
stat = CONSCIOUS
set_stat(CONSCIOUS)
adjust_blindness(-1)
diag_hud_set_status()
+1 -1
View File
@@ -1,7 +1,7 @@
/mob/living/silicon/pai/death(gibbed)
if(stat == DEAD)
return
stat = DEAD
set_stat(DEAD)
update_mobility()
update_sight()
wipe_fullscreens()
@@ -106,7 +106,7 @@
mmi.forceMove(T)
if(mmi.brainmob)
if(mmi.brainmob.stat == DEAD)
mmi.brainmob.stat = CONSCIOUS
mmi.brainmob.set_stat(CONSCIOUS)
mmi.brainmob.remove_from_dead_mob_list()
mmi.brainmob.add_to_alive_mob_list()
mind.transfer_to(mmi.brainmob)
@@ -922,9 +922,9 @@
toggle_headlamp(1)
return
if(IsUnconscious() || IsStun() || IsKnockdown() || IsParalyzed() || getOxyLoss() > maxHealth * 0.5)
stat = UNCONSCIOUS
set_stat(UNCONSCIOUS)
else
stat = CONSCIOUS
set_stat(CONSCIOUS)
update_mobility()
diag_hud_set_status()
diag_hud_set_health()
@@ -112,7 +112,7 @@ Difficulty: Normal
if(health > 0 || stat == DEAD)
return
else
stat = DEAD
set_stat(DEAD)
blinking = TRUE //we do a fancy animation, release a huge burst(), and leave our staff.
burst_range = 10
visible_message("<span class='hierophant'>\"Mrmxmexmrk wipj-hiwxvygx wiuyirgi...\"</span>")
@@ -197,7 +197,7 @@
if(health <= 0)
death()
else
stat = CONSCIOUS
set_stat(CONSCIOUS)
med_hud_set_status()
/mob/living/simple_animal/proc/handle_automated_action()
@@ -21,7 +21,7 @@
if(buckled)
Feedstop(silent = TRUE) //releases ourselves from the mob we fed on.
stat = DEAD
set_stat(DEAD)
cut_overlays()
update_mobility()
@@ -134,14 +134,14 @@
if(stat == CONSCIOUS && stasis)
to_chat(src, "<span class='danger'>Nerve gas in the air has put you in stasis!</span>")
stat = UNCONSCIOUS
set_stat(UNCONSCIOUS)
powerlevel = 0
rabid = 0
update_mobility()
regenerate_icons()
else if(stat == UNCONSCIOUS && !stasis)
to_chat(src, "<span class='notice'>You wake up from the stasis.</span>")
stat = CONSCIOUS
set_stat(CONSCIOUS)
update_mobility()
regenerate_icons()
+12
View File
@@ -1009,3 +1009,15 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
*/
/mob/proc/on_item_dropped(obj/item/I)
return
/**
* Used to wrap stat setting to trigger on-stat-change functionality.
* Must be used instead of directly setting a mob's stat var,
* so that the signal is sent properly.
*/
/mob/proc/set_stat(new_stat)
if(new_stat == stat)
return
. = stat
stat = new_stat
SEND_SIGNAL(src, COMSIG_MOB_STATCHANGE, new_stat, .)