diff --git a/code/__DEFINES/genetics.dm b/code/__DEFINES/genetics.dm index 8e7be007d1..d984c37eae 100644 --- a/code/__DEFINES/genetics.dm +++ b/code/__DEFINES/genetics.dm @@ -97,6 +97,13 @@ #define NUTRITION_LEVEL_HUNGRY 250 #define NUTRITION_LEVEL_STARVING 150 +//Thirsty boi values. Putting it here for the sake of consistency with nutrition. +#define THIRST_LEVEL_HYPONATREMIA 800//serious effects begin here +#define THIRST_LEVEL_DANGERZONE 750//headaches begin here +#define THIRST_LEVEL_QUENCHED 500//satisfied bois have more than this +#define THIRST_LEVEL_THIRSTY 250//dry mouth begins here +#define THIRST_LEVEL_PARCHED 100//headaches begin here, serious effects begin under this + //Blood levels #define BLOOD_VOLUME_NORMAL 560 #define BLOOD_VOLUME_SAFE 501 diff --git a/code/__DEFINES/mob.dm b/code/__DEFINES/mob.dm index c2295b9c5d..2aac94c7c3 100644 --- a/code/__DEFINES/mob.dm +++ b/code/__DEFINES/mob.dm @@ -67,6 +67,9 @@ // Factor of how fast mob nutrition decreases #define HUNGER_FACTOR 0.1 +// How fast mob thirst decreases +#define THIRST_FACTOR 0.12 + // Reagent type flags, defines the types of mobs this reagent will affect #define ORGANIC 1 #define SYNTHETIC 2 diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 1f31db4f01..05efebb17c 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -32,10 +32,15 @@ /mob/living/carbon/Move(NewLoc, direct) . = ..() if(.) - if(nutrition && stat != DEAD) - nutrition -= hunger_drain / 10 - if(m_intent == "run") + if(stat != DEAD) + if(nutrition) nutrition -= hunger_drain / 10 + if(m_intent == "run") + nutrition -= hunger_drain / 10 + if(thirst) + thirst -= thirst_drain / 10 + if(m_intent == "run") + thirst -= thirst_drain / 10 if((FAT in mutations) && m_intent == "run" && bodytemperature <= 360) bodytemperature += 2 @@ -114,6 +119,7 @@ if(T) T.add_vomit_floor(src) nutrition -= lost_nutrition + thirst -= lost_nutrition * 1.5 if(stun) adjustToxLoss(-3) T = get_step(T, dir) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 4bd81ff219..631bd7509a 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1472,6 +1472,7 @@ add_language(species.default_language) hunger_drain = species.hunger_drain + thirst_drain = species.thirst_drain digestion_ratio = species.digestion_ratio if(species.base_color && default_colour) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 00dbc50e8d..4ec9e18f95 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -35,6 +35,7 @@ handle_heartbeat() handle_heartattack() handle_drunk() + handle_thirst() species.handle_life(src) if(!client) @@ -672,18 +673,21 @@ if(overeatduration > 500) becomeFat() - // nutrition decrease - if(nutrition > 0 && stat != DEAD) - // THEY HUNGER - var/hunger_rate = hunger_drain - if(satiety > 0) - satiety-- - if(satiety < 0) - satiety++ - if(prob(round(-satiety/40))) - Jitter(5) - hunger_rate = 3 * hunger_drain - nutrition = max(0, nutrition - hunger_rate) + // nutrition and thirst decrease + if(stat != DEAD) + if(nutrition > 0) + // THEY HUNGER + var/hunger_rate = hunger_drain + if(satiety > 0) + satiety-- + if(satiety < 0) + satiety++ + if(prob(round(-satiety/40))) + Jitter(5) + hunger_rate = 3 * hunger_drain + nutrition = max(0, nutrition - hunger_rate) + if(thirst > 0) + thirst = max(0, thirst - thirst_drain) if(nutrition > NUTRITION_LEVEL_FULL) if(overeatduration < 600) //capped so people don't take forever to unfat @@ -808,6 +812,69 @@ return 1 return 0 +/mob/living/carbon/human/proc/handle_thirst() + if(thirst >= THIRST_LEVEL_HYPONATREMIA) + if(prob((thirst - THIRST_LEVEL_HYPONATREMIA) * 0.001)) + vomit((thirst - THIRST_LEVEL_HYPONATREMIA) * 0.01) + if(prob((thirst - THIRST_LEVEL_HYPONATREMIA) * 0.05)) + if(prob(5)) + to_chat(src, "You feel pretty exhausted") + adjustStaminaLoss((thirst - THIRST_LEVEL_HYPONATREMIA) * 0.1) + adjustStaminaLoss((thirst - THIRST_LEVEL_HYPONATREMIA) * 0.005) + if(thirst >= THIRST_LEVEL_DANGERZONE) + if(prob((thirst - THIRST_LEVEL_DANGERZONE) * 0.01)) + var/thirstnagmessage + switch(thirst) + if(THIRST_LEVEL_DANGERZONE to THIRST_LEVEL_HYPONATREMIA) + thirstnagmessage = "Your head hurts." + if(THIRST_LEVEL_HYPONATREMIA to THIRST_LEVEL_HYPONATREMIA + 100) + thirstnagmessage = "You feel a painful pressure in your head." + if(THIRST_LEVEL_HYPONATREMIA + 100 to INFINITY) + thirstnagmessage = "You feel as though your brain is pounding against your skull." + if(thirstnagmessage) + custom_pain(thirstnagmessage, ((thirst - THIRST_LEVEL_DANGERZONE) * 0.01)) + if(thirst <= THIRST_LEVEL_THIRSTY) + if(prob((thirst - THIRST_LEVEL_THIRSTY) * -0.01)) + var/thirstnagmessage + switch(thirst) + if(-INFINITY to THIRST_LEVEL_PARCHED) + thirstnagmessage = "Your head hurts, and your mouth is painfully dry." + if(THIRST_LEVEL_PARCHED to THIRST_LEVEL_THIRSTY - 100) + thirstnagmessage = "Your mouth feels dry." + if(THIRST_LEVEL_THIRSTY - 100 to INFINITY) + thirstnagmessage = "You feel thirsty." + if(thirstnagmessage) + custom_pain(thirstnagmessage, ((thirst - THIRST_LEVEL_THIRSTY)* -0.01)) + if(thirst <= THIRST_LEVEL_PARCHED) + if(prob((thirst - THIRST_LEVEL_PARCHED) * -0.01)) + if(prob(5)) + to_chat(src, "You feel light-headed.") + AdjustConfused((thirst - THIRST_LEVEL_PARCHED) * -0.1) + adjustStaminaLoss((thirst - THIRST_LEVEL_PARCHED) * -0.1) + adjustStaminaLoss((thirst - THIRST_LEVEL_PARCHED) * -0.005) + switch(thirst) + if(THIRST_LEVEL_HYPONATREMIA to INFINITY) + staminaminimum = min(staminaminimum + ((thirst - THIRST_LEVEL_HYPONATREMIA) * 0.01), 70) + if(THIRST_LEVEL_DANGERZONE to THIRST_LEVEL_HYPONATREMIA) + if(staminaminimum <= 40) + staminaminimum = min(staminaminimum + ((thirst - THIRST_LEVEL_DANGERZONE) * 0.005), 40) + else + staminaminimum = max(staminaminimum - ((thirst - THIRST_LEVEL_DANGERZONE) * 0.005), 40) + if(THIRST_LEVEL_QUENCHED to THIRST_LEVEL_DANGERZONE) + staminaminimum = max(staminaminimum - ((thirst - THIRST_LEVEL_QUENCHED) * 0.1), 0) + if(THIRST_LEVEL_THIRSTY to THIRST_LEVEL_QUENCHED) + if(staminaminimum <= 10) + staminaminimum = min(staminaminimum + ((thirst - THIRST_LEVEL_QUENCHED) * -0.01), 10) + else + staminaminimum = max(staminaminimum - ((thirst - THIRST_LEVEL_QUENCHED) * -0.01), 10) + if(THIRST_LEVEL_PARCHED to THIRST_LEVEL_THIRSTY) + if(staminaminimum <= 25) + staminaminimum = min(staminaminimum + ((thirst - THIRST_LEVEL_THIRSTY) * -0.01), 25) + else + staminaminimum = max(staminaminimum - ((thirst - THIRST_LEVEL_THIRSTY) * -0.01), 25) + if(-INFINITY to THIRST_LEVEL_PARCHED) + staminaminimum = min(staminaminimum + ((thirst - THIRST_LEVEL_PARCHED) * -0.01), 80) + /mob/living/carbon/human/handle_regular_status_updates() if(status_flags & GODMODE) return 0 diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 556214d483..35865ee2bb 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -47,6 +47,7 @@ var/reagent_tag //Used for metabolizing reagents. var/hunger_drain = HUNGER_FACTOR var/digestion_ratio = 1 //How quickly the species digests/absorbs reagents. + var/thirst_drain = THIRST_FACTOR var/siemens_coeff = 1 //base electrocution coefficient @@ -644,6 +645,15 @@ H.throw_alert("nutrition", /obj/screen/alert/hungry) else H.throw_alert("nutrition", /obj/screen/alert/starving) + + switch(H.thirst) //todo: yell about lack of sprites + if(THIRST_LEVEL_QUENCHED to INFINITY)//hyponatremia doesnt really need its own alert + H.throw_alert("nutrition", /obj/screen/alert/full) + if(THIRST_LEVEL_THIRSTY to THIRST_LEVEL_QUENCHED) + H.throw_alert("nutrition", /obj/screen/alert/fed) + else + H.throw_alert("nutrition", /obj/screen/alert/hungry) + return 1 /* diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index da764cafda..28da88bbb1 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -277,7 +277,7 @@ Weaken(5) setStaminaLoss(health - 2) return - setStaminaLoss(max((staminaloss - 3), 0)) + setStaminaLoss(max((staminaloss - 3), staminaminimum)) //this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc.. /mob/living/carbon/handle_status_effects() diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 397ce90af6..70cb47f551 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -15,6 +15,7 @@ var/brainloss = 0 //'Retardation' damage caused by someone hitting you in the head with a bible or being infected with brainrot. var/staminaloss = 0 //Stamina damage, or exhaustion. You recover it slowly naturally, and are stunned if it gets too high. Holodeck and hallucinations deal this. + var/staminaminimum = 0 //Minimum stamina damage, controlled by thirst. var/last_special = 0 //Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out. diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 2988363ffb..3a56933866 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -72,6 +72,9 @@ var/satiety = 0 //Carbon var/hunger_drain = HUNGER_FACTOR // how quickly the mob gets hungry; largely utilized by species. + var/thirst = THIRST_LEVEL_QUENCHED + 150 + var/thirst_drain = THIRST_FACTOR + var/overeatduration = 0 // How long this guy is overeating //Carbon var/intent = null//Living var/shakecamera = 0 @@ -196,5 +199,5 @@ var/list/permanent_huds = list() var/list/actions = list() - + var/list/progressbars = null //for stacking do_after bars diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index cdc214c308..cd36213d20 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -29,6 +29,7 @@ var/drink_icon = null var/drink_name = "Glass of ..what?" var/drink_desc = "You can't really tell what this is." + var/quench_amount = 0 //how much thirst will be quenched per processing cycle /datum/reagent/Destroy() . = ..() @@ -70,6 +71,8 @@ /datum/reagent/proc/on_mob_life(mob/living/M) current_cycle++ holder.remove_reagent(id, metabolization_rate * M.metabolism_efficiency * M.digestion_ratio) //By default it slowly disappears. + if(M) + M.thirst += quench_amount * REAGENTS_METABOLISM * M.digestion_ratio /datum/reagent/proc/on_mob_death(mob/living/M) //use this to have chems have a "death-triggered" effect return @@ -148,4 +151,4 @@ if(prob(5)) to_chat(M, "You feel like you can't live without [name]!") if(prob(5)) - to_chat(M, "You would DIE for some [name] right now!") \ No newline at end of file + to_chat(M, "You would DIE for some [name] right now!") diff --git a/code/modules/reagents/chemistry/reagents/alcohol.dm b/code/modules/reagents/chemistry/reagents/alcohol.dm index 9b651a2144..bb74823b72 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol.dm @@ -7,6 +7,7 @@ nutriment_factor = 0 //So alcohol can fill you up! If they want to. color = "#404030" // rgb: 64, 64, 48 can_grow_in_plants = 0 //Alcoholic drinks won't be grown in plants (would "water down" random seed chems too much) + quench_amount = 1 var/dizzy_adj = 3 var/alcohol_perc = 1 //percentage of ethanol in a beverage 0.0 - 1.0 @@ -1139,4 +1140,4 @@ alcohol_perc = 0.25 drink_icon = "synthignonglass" drink_name = "Glass of Synthignon" - drink_desc = "Someone mixed good wine and robot booze. Romantic, but atrocious." \ No newline at end of file + drink_desc = "Someone mixed good wine and robot booze. Romantic, but atrocious." diff --git a/code/modules/reagents/chemistry/reagents/drink_base.dm b/code/modules/reagents/chemistry/reagents/drink_base.dm index 25484983a4..f7fa2c7538 100644 --- a/code/modules/reagents/chemistry/reagents/drink_base.dm +++ b/code/modules/reagents/chemistry/reagents/drink_base.dm @@ -4,6 +4,7 @@ description = "Uh, some kind of drink." reagent_state = LIQUID color = "#E78108" // rgb: 231, 129, 8 + quench_amount = 1 var/adj_dizzy = 0 var/adj_drowsy = 0 var/adj_sleepy = 0 @@ -23,4 +24,4 @@ if(adj_temp_cool) if(M.bodytemperature > 310)//310 is the normal bodytemp. 310.055 M.bodytemperature = max(310, M.bodytemperature - (adj_temp_cool * TEMPERATURE_DAMAGE_COEFFICIENT)) - ..() \ No newline at end of file + ..() diff --git a/code/modules/reagents/chemistry/reagents/drinks.dm b/code/modules/reagents/chemistry/reagents/drinks.dm index 6fb6de480f..b746dbd53d 100644 --- a/code/modules/reagents/chemistry/reagents/drinks.dm +++ b/code/modules/reagents/chemistry/reagents/drinks.dm @@ -6,6 +6,7 @@ drink_icon = "glass_orange" drink_name = "Glass of Orange juice" drink_desc = "Vitamins! Yay!" + quench_amount = 1.5 /datum/reagent/consumable/drink/orangejuicde/on_mob_life(mob/living/M) if(M.getOxyLoss() && prob(30)) @@ -160,6 +161,7 @@ drink_icon = "nothing" drink_name = "Nothing" drink_desc = "Absolutely nothing." + quench_amount = 0 /datum/reagent/consumable/drink/nothing/on_mob_life(mob/living/M) if(ishuman(M) && M.job in list("Mime")) diff --git a/code/modules/reagents/chemistry/reagents/misc.dm b/code/modules/reagents/chemistry/reagents/misc.dm index 8923378990..1139494d9e 100644 --- a/code/modules/reagents/chemistry/reagents/misc.dm +++ b/code/modules/reagents/chemistry/reagents/misc.dm @@ -77,6 +77,7 @@ description = "A chemical element." reagent_state = SOLID color = "#808080" // rgb: 128, 128, 128 + quench_amount = -1 /datum/reagent/phosphorus @@ -520,4 +521,4 @@ id = "triplepiss" description = "Ewwwwwwwww." reagent_state = LIQUID - color = "#857400" \ No newline at end of file + color = "#857400" diff --git a/code/modules/reagents/chemistry/reagents/water.dm b/code/modules/reagents/chemistry/reagents/water.dm index 70d2a9f76c..2b60ecc465 100644 --- a/code/modules/reagents/chemistry/reagents/water.dm +++ b/code/modules/reagents/chemistry/reagents/water.dm @@ -18,6 +18,7 @@ drink_icon = "glass_clear" drink_name = "Glass of Water" drink_desc = "The father of all refreshments." + quench_amount = 2 /datum/reagent/water/reaction_mob(mob/living/M, method=TOUCH, volume) // Put out fire @@ -138,6 +139,7 @@ drink_icon = "glass_red" drink_name = "Glass of Tomato juice" drink_desc = "Are you sure this is tomato juice?" + quench_amount = 0.5 /datum/reagent/blood/reaction_mob(mob/living/M, method=TOUCH, volume) if(data && data["viruses"]) @@ -238,6 +240,7 @@ description = "Smelly water from a fish tank. Gross!" reagent_state = LIQUID color = "#757547" + quench_amount = 1.5 /datum/reagent/fishwater/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == INGEST) @@ -271,6 +274,7 @@ drink_icon = "glass_clear" drink_name = "Glass of Water" drink_desc = "The father of all refreshments." + quench_amount = 5 /datum/reagent/holywater/on_mob_life(mob/living/M) M.AdjustJitter(-5) @@ -388,6 +392,7 @@ color = "#FF9966" description = "You don't even want to think about what's in here." reagent_state = LIQUID + quench_amount = 0.5 /datum/reagent/liquidgibs/reaction_turf(turf/T, volume) //yes i took it from synthflesh... if(volume >= 5 && !istype(T, /turf/space)) @@ -407,6 +412,7 @@ description = "Can be used to dry things." reagent_state = LIQUID color = "#A70FFF" + quench_amount = -1 /datum/reagent/drying_agent/reaction_turf(turf/simulated/T, volume) if(istype(T) && T.wet) @@ -416,4 +422,4 @@ if(istype(O, /obj/item/clothing/shoes/galoshes)) var/t_loc = get_turf(O) qdel(O) - new /obj/item/clothing/shoes/galoshes/dry(t_loc) \ No newline at end of file + new /obj/item/clothing/shoes/galoshes/dry(t_loc)