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
+2 -2
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
@@ -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
@@ -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
+1
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)