Files
CHOMPStation2/code/datums/observation/stat_set.dm
Cadyn b90f7ec922 The 515 MegaPR early downport (#7783)
Co-authored-by: Selis <selis@xynolabs.com>
Co-authored-by: Selis <sirlionfur@hotmail.de>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
Co-authored-by: SatinIsle <thesatinisle@gmail.com>
Co-authored-by: Heroman <alesha3000@list.ru>
Co-authored-by: Casey <a.roaming.shadow@gmail.com>
Co-authored-by: Raeschen <rycoop29@gmail.com>
2024-02-27 20:17:32 +01:00

36 lines
1.0 KiB
Plaintext

// Observer Pattern Implementation: Stat Set
// Registration type: /mob/living
//
// Raised when: A /mob/living changes stat, using the set_stat() proc
//
// Arguments that the called proc should expect:
// /mob/living/stat_mob: The mob whose stat changed
// /old_stat: Status before the change.
// /new_stat: Status after the change.
/*
stat_set_event, /decl/observ/stat_set, new)
/decl/observ/stat_set
name = "Stat Set"
expected_type = /mob/living
*/
//Deprecated in favor of Comsigs
/****************
* Stat Handling *
****************/
/mob/living/set_stat(var/new_stat)
var/old_stat = stat
. = ..()
if(stat != old_stat)
SEND_SIGNAL(src, COMSIG_MOB_STATCHANGE, old_stat, new_stat)
if(isbelly(src.loc))
var/obj/belly/ourbelly = src.loc
if(!ourbelly.owner.client)
return
if(stat == CONSCIOUS)
to_chat(ourbelly.owner, "<span class='notice'>\The [src.name] is awake.</span>")
else if(stat == UNCONSCIOUS)
to_chat(ourbelly.owner, "<span class='red'>\The [src.name] has fallen unconscious!</span>")