From b508640e3988266935ea2a1201902f8a24335bb0 Mon Sep 17 00:00:00 2001
From: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com>
Date: Sun, 22 Oct 2023 12:52:51 -0400
Subject: [PATCH] IPCs can die from low power (#22846)
* im so not full from electricity grrr
* Update code/modules/mob/living/carbon/human/species/machine.dm
whitespace fix
Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
* now its the microbattery dying
* Update code/modules/mob/living/carbon/human/species/machine.dm
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
---------
Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
---
code/modules/mob/living/carbon/examine.dm | 5 ++++-
.../living/carbon/human/species/machine.dm | 22 +++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/code/modules/mob/living/carbon/examine.dm b/code/modules/mob/living/carbon/examine.dm
index f9991c2e714..f6dcb76dd2d 100644
--- a/code/modules/mob/living/carbon/examine.dm
+++ b/code/modules/mob/living/carbon/examine.dm
@@ -247,7 +247,10 @@
msg += "[p_they(TRUE)] look[p_s()] absolutely soaked.\n"
if(nutrition < NUTRITION_LEVEL_HYPOGLYCEMIA)
- msg += "[p_they(TRUE)] [p_are()] severely malnourished.\n"
+ if(ismachineperson(src))
+ msg += "[p_their(TRUE)] power indicator is flashing red.\n"
+ else
+ msg += "[p_they(TRUE)] [p_are()] severely malnourished.\n"
if(HAS_TRAIT(src, TRAIT_FAT))
msg += "[p_they(TRUE)] [p_are()] morbidly obese.\n"
diff --git a/code/modules/mob/living/carbon/human/species/machine.dm b/code/modules/mob/living/carbon/human/species/machine.dm
index 6f75c43a801..aa4d306a9ad 100644
--- a/code/modules/mob/living/carbon/human/species/machine.dm
+++ b/code/modules/mob/living/carbon/human/species/machine.dm
@@ -127,6 +127,28 @@
H.update_hair()
H.update_fhair()
+/datum/species/machine/handle_life(mob/living/carbon/human/H) // Handles IPC starvation
+ if(isLivingSSD(H)) // We don't want AFK people dying from this
+ return
+ if(H.nutrition >= NUTRITION_LEVEL_HYPOGLYCEMIA)
+ return
+
+ var/obj/item/organ/internal/cell/microbattery = H.get_organ_slot("heart")
+ if(!istype(microbattery)) //Maybe they're powered by an abductor gland or sheer force of will
+ return
+ if(prob(6))
+ to_chat(H, "Error 74: Microbattery critical malfunction, likely cause: Extended strain.")
+ microbattery.receive_damage(4, TRUE)
+ else if(prob(4))
+ H.Weaken(6 SECONDS)
+ H.Stuttering(20 SECONDS)
+ to_chat(H, "Power critical, shutting down superfluous functions.")
+ H.emote("collapse")
+ microbattery.receive_damage(2, TRUE)
+ else if(prob(4))
+ to_chat(H, "Redirecting excess power from servos to vital components.")
+ H.Slowed(rand(15 SECONDS, 32 SECONDS))
+
// Allows IPC's to change their monitor display
/datum/action/innate/change_monitor
name = "Change Monitor"