From 97eb42b35b115bb5ea8fea555c05959d87a9538f Mon Sep 17 00:00:00 2001 From: DeltaFire Date: Mon, 4 Oct 2021 15:49:12 +0200 Subject: [PATCH] defib policy hook & oxyheal --- .../research/nanites/nanite_programs/healing.dm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/code/modules/research/nanites/nanite_programs/healing.dm b/code/modules/research/nanites/nanite_programs/healing.dm index 81a837504a..e3cc63c3a0 100644 --- a/code/modules/research/nanites/nanite_programs/healing.dm +++ b/code/modules/research/nanites/nanite_programs/healing.dm @@ -242,13 +242,24 @@ sleep(30) playsound(C, 'sound/machines/defib_zap.ogg', 50, FALSE) if(check_revivable()) + var/tplus = world.time - C.timeofdeath playsound(C, 'sound/machines/defib_success.ogg', 50, FALSE) C.set_heartattack(FALSE) + var/oxydamage = C.getOxyLoss() + if(C.health < HEALTH_THRESHOLD_FULLCRIT && oxydamage) + var/diff = C.health - HEALTH_THRESHOLD_FULLCRIT + C.adjustOxyLoss(diff) //Heal their oxydamage up to hardcrit (or if less, as much as they have, since the proc has sanity) C.revive(full_heal = FALSE, admin_revive = FALSE) C.emote("gasp") C.Jitter(100) SEND_SIGNAL(C, COMSIG_LIVING_MINOR_SHOCK) - log_game("[C] has been successfully defibrillated by nanites.") + var/list/policies = CONFIG_GET(keyed_list/policy) + var/timelimit = CONFIG_GET(number/defib_cmd_time_limit) * 10 //the config is in seconds, not deciseconds + var/late = timelimit && (tplus > timelimit) + var/policy = late? policies[POLICYCONFIG_ON_DEFIB_LATE] : policies[POLICYCONFIG_ON_DEFIB_INTACT] + if(policy) + to_chat(C, policy) + C.log_message("has been successfully defibrillated by nanites, [tplus] deciseconds from time of death, considered [late? "late" : "memory-intact"] revival under configured policy limits.", LOG_GAME) else playsound(C, 'sound/machines/defib_failed.ogg', 50, FALSE)