Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions code/__DEFINES/genetics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
91 changes: 79 additions & 12 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
handle_heartbeat()
handle_heartattack()
handle_drunk()
handle_thirst()
species.handle_life(src)

if(!client)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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, "<span class ='warning'>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, "<span class='warning'>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
Expand Down
10 changes: 10 additions & 0 deletions code/modules/mob/living/carbon/human/species/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

/*
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/living_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
5 changes: 4 additions & 1 deletion code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -196,5 +199,5 @@
var/list/permanent_huds = list()

var/list/actions = list()

var/list/progressbars = null //for stacking do_after bars
5 changes: 4 additions & 1 deletion code/modules/reagents/chemistry/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
. = ..()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -148,4 +151,4 @@
if(prob(5))
to_chat(M, "<span class='warning'>You feel like you can't live without [name]!</span>")
if(prob(5))
to_chat(M, "<span class='warning'>You would DIE for some [name] right now!</span>")
to_chat(M, "<span class='warning'>You would DIE for some [name] right now!</span>")
3 changes: 2 additions & 1 deletion code/modules/reagents/chemistry/reagents/alcohol.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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."
drink_desc = "Someone mixed good wine and robot booze. Romantic, but atrocious."
3 changes: 2 additions & 1 deletion code/modules/reagents/chemistry/reagents/drink_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
..()
..()
2 changes: 2 additions & 0 deletions code/modules/reagents/chemistry/reagents/drinks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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"))
Expand Down
3 changes: 2 additions & 1 deletion code/modules/reagents/chemistry/reagents/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
description = "A chemical element."
reagent_state = SOLID
color = "#808080" // rgb: 128, 128, 128
quench_amount = -1


/datum/reagent/phosphorus
Expand Down Expand Up @@ -520,4 +521,4 @@
id = "triplepiss"
description = "Ewwwwwwwww."
reagent_state = LIQUID
color = "#857400"
color = "#857400"
8 changes: 7 additions & 1 deletion code/modules/reagents/chemistry/reagents/water.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand All @@ -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)
new /obj/item/clothing/shoes/galoshes/dry(t_loc)