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

View File

@@ -260,6 +260,7 @@
#define COMPONENT_EXAMINATE_BLIND 3 //outputs the "something is there but you can't see it" message.
#define COMSIG_MOB_DEATH "mob_death" //from base of mob/death(): (gibbed)
#define COMPONENT_BLOCK_DEATH_BROADCAST 1 //stops the death from being broadcasted in deadchat.
#define COMSIG_MOB_STATCHANGE "mob_statchange" //!from base of mob/set_stat(): (new_stat, old_stat)
#define COMSIG_MOB_CLICKON "mob_clickon" //from base of mob/clickon(): (atom/A, params)
#define COMSIG_MOB_CANCEL_CLICKON 1
#define COMSIG_MOB_GHOSTIZE "mob_ghostize" //from base of mob/Ghostize(): (can_reenter_corpse, special, penalize)

View File

@@ -369,7 +369,7 @@
C.set_species(selected)
C.set_resting(TRUE, TRUE)
// Don't want to cause it to deathgasp..
C.stat = DEAD
C.set_stat(DEAD)
C.adjustOxyLoss(200)
// Limb replacement causes toxloss, which can cause too much suffering for the doctor that I don't want
C.adjustCloneLoss(45)

View File

@@ -10,6 +10,7 @@
var/icon_door = null
var/icon_door_override = FALSE //override to have open overlay use icon different to its base's
var/has_door_icon = TRUE // Set to false to skip trying to draw a door icon.
var/secure = FALSE //secure locker or not, also used if overriding a non-secure locker with a secure door overlay to add fancy lights
var/opened = FALSE
var/welded = FALSE
@@ -76,7 +77,7 @@
. += "[icon_door_override ? icon_door : icon_state]_open"
return
if(icon_door)
if(has_door_icon)
. += "[icon_door || icon_state]_door"
if(welded)
. += icon_welded

View File

@@ -3,7 +3,7 @@
name = "large cardboard box"
desc = "Just a box..."
icon_state = "cardboard"
icon_door = null
has_door_icon = FALSE
mob_storage_capacity = 1
resistance_flags = FLAMMABLE
max_integrity = 70

View File

@@ -241,7 +241,7 @@
owner.current.Unconscious(20, 1)
/datum/antagonist/bloodsucker/proc/Torpor_Begin(amInCoffin = FALSE)
owner.current.stat = UNCONSCIOUS
owner.current.set_stat(UNCONSCIOUS)
owner.current.apply_status_effect(STATUS_EFFECT_UNCONSCIOUS)
ADD_TRAIT(owner.current, TRAIT_FAKEDEATH, "bloodsucker") // Come after UNCONSCIOUS or else it fails
ADD_TRAIT(owner.current, TRAIT_NODEATH, "bloodsucker") // Without this, you'll just keep dying while you recover.
@@ -260,7 +260,7 @@
to_chat(owner.current, "<span class='warning'>Your body keeps you going, even as you try to end yourself.</span>")
/datum/antagonist/bloodsucker/proc/Torpor_End()
owner.current.stat = SOFT_CRIT
owner.current.set_stat(SOFT_CRIT)
owner.current.remove_status_effect(STATUS_EFFECT_UNCONSCIOUS)
REMOVE_TRAIT(owner.current, TRAIT_FAKEDEATH, "bloodsucker")
REMOVE_TRAIT(owner.current, TRAIT_NODEATH, "bloodsucker")

View File

@@ -56,7 +56,7 @@
mind.announce_objectives()
/mob/living/carbon/true_devil/death(gibbed)
stat = DEAD
set_stat(DEAD)
..(gibbed)
drop_all_held_items()
INVOKE_ASYNC(mind.has_antag_datum(/datum/antagonist/devil), TYPE_PROC_REF(/datum/antagonist/devil, beginResurrectionCheck), src)

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

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

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()

View File

@@ -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)

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()

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)

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.

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()

View File

@@ -79,7 +79,7 @@
death()
return
else if(stat == UNCONSCIOUS)
stat = CONSCIOUS
set_stat(CONSCIOUS)
adjust_blindness(-1)
diag_hud_set_status()

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()

View File

@@ -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()

View File

@@ -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>")

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

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, .)

View File

@@ -271,7 +271,7 @@ Charged extracts:
if(M.maxHealth <= 0)
to_chat(user, "<span class='warning'>The slime is too unstable to return!</span>")
M.revive(full_heal = 1)
M.stat = CONSCIOUS
M.set_stat(CONSCIOUS)
M.visible_message("<span class='notice'>[M] is filled with renewed vigor and blinks awake!</span>")
M.maxHealth -= 10 //Revival isn't healthy.
M.health -= 10

View File

@@ -217,7 +217,7 @@
LB.brainmob = brainmob
brainmob = null
LB.brainmob.forceMove(LB)
LB.brainmob.stat = DEAD
LB.brainmob.set_stat(DEAD)
/obj/item/organ/eyes/transfer_to_limb(obj/item/bodypart/head/LB, mob/living/carbon/human/C)
LB.eyes = src

View File

@@ -451,7 +451,7 @@
if(H.InCritical())
perma = TRUE
volume = 5
H.stat = DEAD
H.set_stat(DEAD)
catto.origin = H
/datum/reagent/fermi/secretcatchem/on_mob_life(mob/living/carbon/H)
@@ -488,7 +488,7 @@
var/mob/living/simple_animal/pet/cat/custom_cat/catto = L
if(catto.origin)
var/mob/living/carbon/human/H = catto.origin
H.stat = CONSCIOUS
H.set_stat(CONSCIOUS)
log_reagent("FERMICHEM: [catto] ckey: [catto.key] has returned to normal.")
to_chat(catto, "<span class='notice'>Your body shifts back to normal!</span>")
H.forceMove(catto.loc)