mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 02:56:14 +01:00
QoL: Stasis and Defibs
This commit is contained in:
@@ -59,6 +59,7 @@
|
||||
return
|
||||
|
||||
user.visible_message("<span class='notice'>\The [user] sticks \a [O] into \the [src].</span>")
|
||||
B.preserved = TRUE
|
||||
|
||||
brainmob = B.brainmob
|
||||
B.brainmob = null
|
||||
@@ -108,6 +109,7 @@
|
||||
brainobj = null
|
||||
else //Or make a new one if empty.
|
||||
brain = new(user.loc)
|
||||
brain.preserved = FALSE
|
||||
brainmob.container = null//Reset brainmob mmi var.
|
||||
brainmob.loc = brain//Throw mob into brain.
|
||||
living_mob_list -= brainmob//Get outta here
|
||||
|
||||
@@ -87,6 +87,9 @@
|
||||
if(!client)
|
||||
species.handle_npc(src)
|
||||
|
||||
else if(stat == DEAD && !stasis)
|
||||
handle_defib_timer()
|
||||
|
||||
if(!handle_some_updates())
|
||||
return //We go ahead and process them 5 times for HUD images and other stuff though.
|
||||
|
||||
@@ -1826,5 +1829,15 @@
|
||||
traumatic_shock = 0
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/proc/handle_defib_timer()
|
||||
if(!should_have_organ(O_BRAIN))
|
||||
return // No brain.
|
||||
|
||||
var/obj/item/organ/internal/brain/brain = internal_organs_by_name[O_BRAIN]
|
||||
if(!brain)
|
||||
return // Still no brain.
|
||||
|
||||
brain.tick_defib_timer()
|
||||
|
||||
#undef HUMAN_MAX_OXYLOSS
|
||||
#undef HUMAN_CRIT_MAX_OXYLOSS
|
||||
|
||||
@@ -18,6 +18,22 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain)
|
||||
var/clone_source = FALSE
|
||||
var/mob/living/carbon/brain/brainmob = null
|
||||
var/can_assist = TRUE
|
||||
var/defib_timer = -1
|
||||
|
||||
/obj/item/organ/internal/brain/process()
|
||||
..()
|
||||
if(owner && owner.stat != DEAD) // So there's a lower risk of ticking twice.
|
||||
tick_defib_timer()
|
||||
|
||||
// This is called by `process()` when the owner is alive, or brain is not in a body, and by `Life()` directly when dead.
|
||||
/obj/item/organ/internal/brain/proc/tick_defib_timer()
|
||||
if(preserved) // In an MMI/ice box/etc.
|
||||
return
|
||||
|
||||
if(!owner || owner.stat == DEAD)
|
||||
defib_timer = max(--defib_timer, 0)
|
||||
else
|
||||
defib_timer = min(++defib_timer, (config.defib_timer MINUTES) / 2)
|
||||
|
||||
/obj/item/organ/internal/brain/proc/can_assist()
|
||||
return can_assist
|
||||
@@ -65,6 +81,7 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain)
|
||||
/obj/item/organ/internal/brain/New()
|
||||
..()
|
||||
health = config.default_brain_health
|
||||
defib_timer = (config.defib_timer MINUTES) / 2
|
||||
spawn(5)
|
||||
if(brainmob && brainmob.client)
|
||||
brainmob.client.screen.len = null //clear the hud
|
||||
|
||||
Reference in New Issue
Block a user