[MIRROR] Cryo improvements: Auto eject dead and turn on automatically [MDB IGNORE] (#23422)

* Cryo improvements: Auto eject dead and turn on automatically (#77919)

## About The Pull Request
This PR makes two changes to cryo. First, if the patient inside is dead,
it will notify medical over comms, and if auto mode is on, it will eject
them. This is the exact same behaviour as if the patient is fully
healed. Second, if auto is on, the tube will turn on as soon as it's
closed, preventing negligent doctors from leaving people to die in a
locked tube. To prevent people from putting themselves in cryo, you can
no longer close the cryo tube yourself when you're standing in it. This
is effectively the exact same as it was before, except now the game
explicitly tells you that you cannot cryo yourself, instead of letting
you jump in and die.

## Why It's Good For The Game
For the first change, there is absolutely zero reasons for a dead body
to be in a cryotube, and it makes sense that a machine that can tell if
someone is fully healed and eject them can tell if they're dead and
eject them.

For the second change, there are few things worse than being left to die
in a cryotube just because the doctor didn't turn it on. You're just
locked in there until another doctor walks by and notices that the tube
isn't actually on (if they ever do), and you likely die before then,
leaving your organs decay, and turn what was once some simple brute and
burn into a whole revival ordeal. "Auto" implies that treatment is
automatic, so it makes sense that it actually is.
## Changelog
🆑
qol: Cryotubes will now notify medbay if the patient within is dead, and
will eject them if auto is on.
qol: Cryotubes will now automatically turn on when a patient enters it
if auto is on, but you can no longer close the cryotube on yourself.
/🆑

* Cryo improvements: Auto eject dead and turn on automatically

---------

Co-authored-by: Nick <42454181+Momo8289@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-08-30 21:44:02 -04:00
committed by GitHub
co-authored by Nick
parent 55df0942fd
commit b87c6bca76
@@ -109,6 +109,8 @@
var/message_cooldown
///Cryo will continue to treat people with 0 damage but existing wounds, but will sound off when damage healing is done in case doctors want to directly treat the wounds instead
var/treating_wounds = FALSE
/// Cryo should notify doctors if the patient is dead, and eject them if autoeject is enabled
var/patient_dead = FALSE
fair_market_price = 10
payment_department = ACCOUNT_MED
@@ -268,19 +270,36 @@
/obj/machinery/atmospherics/components/unary/cryo_cell/process(seconds_per_tick)
..()
if(!on)
return
if(!occupant)
return
if(!on)
// Should turn on if set to auto
if(autoeject)
set_on(TRUE)
else
return
var/mob/living/mob_occupant = occupant
if(mob_occupant.on_fire)
mob_occupant.extinguish_mob()
if(!check_nap_violations())
return
if(mob_occupant.stat == DEAD) // We don't bother with dead people.
if(mob_occupant.stat == DEAD) // Notify doctors and potentially eject if the patient is dead
set_on(FALSE)
var/msg = "Patient is deceased."
if(autoeject) // Eject if configured.
msg += " Auto ejecting patient now."
open_machine()
// Only need to tell them once
if(!patient_dead)
playsound(src, 'sound/machines/cryo_warning.ogg', volume)
patient_dead = TRUE
radio.talk_into(src, msg, radio_channel)
return
patient_dead = FALSE
if(mob_occupant.get_organic_health() >= mob_occupant.getMaxHealth()) // Don't bother with fully healed people.
if(iscarbon(mob_occupant))
var/mob/living/carbon/C = mob_occupant
@@ -383,6 +402,9 @@
/obj/machinery/atmospherics/components/unary/cryo_cell/close_machine(mob/living/carbon/user, density_to_set = TRUE)
treating_wounds = FALSE
if((isnull(user) || istype(user)) && state_open && !panel_open)
if(loc == user?.loc)
to_chat(user, span_warning("You can't close [src] on yourself!"))
return
flick("pod-close-anim", src)
..(user)
return occupant