From 97527cbd8214b333559aafa7b161298e70e99730 Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Mon, 9 Mar 2020 18:15:20 -0400 Subject: [PATCH 1/2] Hypoglycemia --- code/__DEFINES/genetics.dm | 1 + code/datums/diseases/critical.dm | 76 +++++++++++++++++-- .../mob/living/carbon/human/examine.dm | 4 +- code/modules/mob/living/carbon/human/life.dm | 4 + 4 files changed, 78 insertions(+), 7 deletions(-) diff --git a/code/__DEFINES/genetics.dm b/code/__DEFINES/genetics.dm index c8f98c1fbeb..81790096e64 100644 --- a/code/__DEFINES/genetics.dm +++ b/code/__DEFINES/genetics.dm @@ -104,6 +104,7 @@ #define NUTRITION_LEVEL_FED 350 #define NUTRITION_LEVEL_HUNGRY 250 #define NUTRITION_LEVEL_STARVING 150 +#define NUTRITION_LEVEL_HYPOGLYCEMIA 100 #define NUTRITION_LEVEL_CURSED 0 //Used as an upper limit for species that continuously gain nutriment diff --git a/code/datums/diseases/critical.dm b/code/datums/diseases/critical.dm index 37d77687d8c..71b387428c6 100644 --- a/code/datums/diseases/critical.dm +++ b/code/datums/diseases/critical.dm @@ -6,12 +6,17 @@ if(prob(stage_prob)) stage = min(stage + 1, max_stages) + if(has_cure()) + cure() + return FALSE + return TRUE + +/datum/disease/critical/has_cure() for(var/C_id in cures) if(affected_mob.reagents.has_reagent(C_id)) if(prob(cure_chance)) - cure() - return FALSE - return TRUE + return TRUE + return FALSE /datum/disease/critical/shock name = "Shock" @@ -31,7 +36,7 @@ /datum/disease/critical/shock/stage_act() if(..()) - if(affected_mob.health >= 25) + if(affected_mob.health >= 25 && affected_mob.nutrition >= NUTRITION_LEVEL_HYPOGLYCEMIA) to_chat(affected_mob, "You feel better.") cure() return @@ -133,4 +138,65 @@ affected_mob.emote(pick("twitch", "gasp")) if(prob(5) && ishuman(affected_mob)) var/mob/living/carbon/human/H = affected_mob - H.set_heartattack(TRUE) \ No newline at end of file + H.set_heartattack(TRUE) + +/datum/disease/critical/hypoglycemia + name = "Hypoglycemia" + form = "Medical Emergency" + max_stages = 3 + spread_flags = SPECIAL + spread_text = "The patient has low blood sugar." + cure_text = "Eating or glucose treatment" + viable_mobtypes = list(/mob/living/carbon/human) + stage_prob = 1 + severity = DANGEROUS + disease_flags = CURABLE + bypasses_immunity = TRUE + virus_heal_resistant = TRUE + +/datum/disease/critical/hypoglycemia/has_cure() + if(ishuman(affected_mob)) + var/mob/living/carbon/human/H = affected_mob + if(NO_HUNGER in H.dna.species.species_traits) + return TRUE + if(ismachine(H)) + return TRUE + return ..() + +/datum/disease/critical/hypoglycemia/stage_act() + if(..()) + if(affected_mob.nutrition > NUTRITION_LEVEL_HYPOGLYCEMIA) + to_chat(affected_mob, "You feel a lot better!") + cure() + return + switch(stage) + if(1) + if(prob(4)) + to_chat(affected_mob, "You feel hungry!") + if(prob(2)) + to_chat(affected_mob, "You have a headache!") + if(prob(2)) + to_chat(affected_mob, "You feel [pick("anxious", "depressed")]!") + if(2) + if(prob(4)) + to_chat(affected_mob, "You feel like everything is wrong with your life!") + if(prob(5)) + affected_mob.Slowed(rand(4, 16)) + to_chat(affected_mob, "You feel [pick("tired", "exhausted", "sluggish")].") + if(prob(5)) + affected_mob.Weaken(6) + affected_mob.Stuttering(10) + to_chat(affected_mob, "You feel [pick("numb", "confused", "dizzy", "lightheaded")].") + affected_mob.emote("collapse") + if(3) + if(prob(8)) + var/datum/disease/D = new /datum/disease/critical/shock + affected_mob.ForceContractDisease(D) + if(prob(12)) + affected_mob.Weaken(6) + affected_mob.Stuttering(10) + to_chat(affected_mob, "You feel [pick("numb", "confused", "dizzy", "lightheaded")].") + affected_mob.emote("collapse") + if(prob(12)) + to_chat(affected_mob, "You feel [pick("tired", "exhausted", "sluggish")].") + affected_mob.Slowed(rand(4, 16)) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 85bb90a168e..f352f661cd0 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -290,10 +290,10 @@ if(5) msg += "[p_they(TRUE)] looks absolutely soaked.\n" - if(nutrition < NUTRITION_LEVEL_STARVING - 50) + if(nutrition < NUTRITION_LEVEL_HYPOGLYCEMIA) msg += "[p_they(TRUE)] [p_are()] severely malnourished.\n" else if(nutrition >= NUTRITION_LEVEL_FAT) - if(user.nutrition < NUTRITION_LEVEL_STARVING - 50) + if(user.nutrition < NUTRITION_LEVEL_HYPOGLYCEMIA) msg += "[p_they(TRUE)] [p_are()] plump and delicious looking - Like a fat little piggy. A tasty piggy.\n" else msg += "[p_they(TRUE)] [p_are()] quite chubby.\n" diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 2643d1f3102..587d76a78ed 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -631,6 +631,10 @@ else overeatduration -= 2 + if(!ismachine(src) && nutrition < NUTRITION_LEVEL_HYPOGLYCEMIA) //Gosh damn snowflakey IPCs + var/datum/disease/D = new /datum/disease/critical/hypoglycemia + ForceContractDisease(D) + //metabolism change if(nutrition > NUTRITION_LEVEL_FAT) metabolism_efficiency = 1 From e75c926a62398b35a10e18f80f1aabc5cb86e75f Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Tue, 10 Mar 2020 16:53:55 -0400 Subject: [PATCH 2/2] tweak --- code/datums/diseases/critical.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/diseases/critical.dm b/code/datums/diseases/critical.dm index 71b387428c6..33895132428 100644 --- a/code/datums/diseases/critical.dm +++ b/code/datums/diseases/critical.dm @@ -146,7 +146,7 @@ max_stages = 3 spread_flags = SPECIAL spread_text = "The patient has low blood sugar." - cure_text = "Eating or glucose treatment" + cure_text = "Eating or administration of vitamins or nutrients" viable_mobtypes = list(/mob/living/carbon/human) stage_prob = 1 severity = DANGEROUS