sorting thirst code + not-water replenishes hydration

This commit is contained in:
DragonTrance
2021-02-23 17:19:06 -07:00
parent 300b8bfc08
commit cd3ca2b8d1
11 changed files with 32 additions and 20 deletions

View File

@@ -44,7 +44,7 @@
//Blood regeneration if there is some space
if(blood_volume < (BLOOD_VOLUME_NORMAL * blood_ratio) && !HAS_TRAIT(src, TRAIT_NOHUNGER))
var/nutrition_ratio = 0
var/thirst_ratio = 1
//thirst_ratio = 1 //Uncomment if something fancy gets added
switch(nutrition)
if(0 to NUTRITION_LEVEL_STARVING)
nutrition_ratio = 0.2
@@ -61,7 +61,7 @@
if(satiety > 80)
nutrition_ratio *= 1.25
nutrition = max(0, nutrition - nutrition_ratio * HUNGER_FACTOR)
thirst = max(0, thirst - thirst_ratio * THIRST_FACTOR)
thirst = max(0, thirst - 0.8 * THIRST_FACTOR)
blood_volume = min((BLOOD_VOLUME_NORMAL * blood_ratio), blood_volume + 0.5 * nutrition_ratio)
//Effects of bloodloss

View File

@@ -44,4 +44,4 @@
thirst -= THIRST_FACTOR/12
if(m_intent == MOVE_INTENT_RUN)
nutrition -= HUNGER_FACTOR/5
thirst -= THIRST_FACTOR/5 //running around depleats thirst more so.
thirst -= THIRST_FACTOR/5

View File

@@ -1243,7 +1243,6 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if (H.nutrition > 0 && H.stat != DEAD && !HAS_TRAIT(H, TRAIT_NOHUNGER))
// THEY HUNGER
var/hunger_rate = HUNGER_FACTOR
var/thirst_rate = THIRST_FACTOR
var/datum/component/mood/mood = H.GetComponent(/datum/component/mood)
if(mood && mood.sanity > SANITY_DISTURBED)
hunger_rate *= max(0.5, 1 - 0.002 * mood.sanity) //0.85 to 0.75
@@ -1262,7 +1261,6 @@ GLOBAL_LIST_EMPTY(roundstart_races)
hunger_rate = 3 * HUNGER_FACTOR
hunger_rate *= H.physiology.hunger_mod
H.nutrition = max(0, H.nutrition - hunger_rate)
H.thirst = max(0, H.thirst - thirst_rate)
if (H.nutrition > NUTRITION_LEVEL_FULL)
@@ -1298,6 +1296,14 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(0 to NUTRITION_LEVEL_STARVING)
H.throw_alert("nutrition", /obj/screen/alert/starving)
/datum/species/proc/handle_thirst(mob/living/carbon/human/H)
if(HAS_TRAIT(src, TRAIT_NOTHIRST))
return
//Put more things here if you plan on adding more things. I know this proc is a bit empty at the moment
H.thirst -= THIRST_FACTOR
switch(H.thirst)
if(NUTRITION_LEVEL_HUNGRY to INFINITY)
H.clear_alert("thirst")
@@ -1306,6 +1312,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(0 to NUTRITION_LEVEL_STARVING)
H.throw_alert("thirst", /obj/screen/alert/dehydrated)
/datum/species/proc/update_health_hud(mob/living/carbon/human/H)
return 0

View File

@@ -36,6 +36,7 @@
var/datum/atom_hud/alternate_appearance/AA = v
AA.onNewMob(src)
nutrition = rand(NUTRITION_LEVEL_START_MIN, NUTRITION_LEVEL_START_MAX)
thirst = rand(NUTRITION_LEVEL_START_MIN, NUTRITION_LEVEL_START_MAX)
. = ..()
update_config_movespeed()
update_movespeed(TRUE)

View File

@@ -81,6 +81,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
current_cycle++
if(holder)
holder.remove_reagent(type, metabolization_rate * M.metabolism_efficiency) //By default it slowly disappears.
M.thirst += hydration
return
//called when a mob processes chems when dead.

View File

@@ -3,9 +3,6 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////// DRINKS BELOW, Beer is up there though, along with cola. Cap'n Pete's Cuban Spiced Rum////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/reagent/water/
hydration = 10 * REAGENTS_METABOLISM
/datum/reagent/consumable/orangejuice
name = "Orange Juice"
description = "Both delicious AND rich in Vitamin C, what more do you need?"

View File

@@ -18,7 +18,6 @@
/datum/reagent/consumable/on_mob_life(mob/living/carbon/M)
current_cycle++
M.nutrition += nutriment_factor
M.thirst += hydration
holder.remove_reagent(type, metabolization_rate)
/datum/reagent/consumable/reaction_mob(mob/living/M, method=TOUCH, reac_volume)

View File

@@ -258,12 +258,7 @@
glass_name = "glass of water"
glass_desc = "The father of all refreshments."
shot_glass_icon_state = "shotglassclear"
hydration = 5 * REAGENTS_METABOLISM
//hydration
/datum/reagent/water/on_mob_life(mob/living/carbon/M)
M.thirst += hydration
..()
hydration = 10 * REAGENTS_METABOLISM
/*
* Water reaction to turf

View File

@@ -23,6 +23,7 @@
var/mob/living/carbon/human/H = owner
if(!(organ_flags & ORGAN_FAILING))
H.dna.species.handle_digestion(H)
H.dna.species.handle_thirst(H)
handle_disgust(H)
Nutri = locate(/datum/reagent/consumable/nutriment) in H.reagents.reagent_list
@@ -99,4 +100,4 @@
/obj/item/organ/stomach/ipc
name = "ipc stomach"
icon_state = "stomach-ipc"
icon_state = "stomach-ipc"