Thirst System

Thirst System
This commit is contained in:
QuoteFox
2021-02-13 14:44:55 +00:00
parent 8f3c7244fb
commit f698f16e27
19 changed files with 126 additions and 7 deletions
+3 -1
View File
@@ -35,7 +35,7 @@
if(bleed_rate < 0)
bleed_rate = 0
if(HAS_TRAIT(src, TRAIT_NOMARROW)) //Bloodsuckers don't need to be here.
return
@@ -44,6 +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
switch(nutrition)
if(0 to NUTRITION_LEVEL_STARVING)
nutrition_ratio = 0.2
@@ -60,6 +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)
blood_volume = min((BLOOD_VOLUME_NORMAL * blood_ratio), blood_volume + 0.5 * nutrition_ratio)
//Effects of bloodloss
@@ -40,6 +40,8 @@
if(HAS_TRAIT(src, TRAIT_NOHUNGER))
nutrition = NUTRITION_LEVEL_FED - 1 //just less than feeling vigorous
else if(nutrition && stat != DEAD)
nutrition -= HUNGER_FACTOR/10
nutrition -= HUNGER_FACTOR/3
thirst -= THIRST_FACTOR/5
if(m_intent == MOVE_INTENT_RUN)
nutrition -= HUNGER_FACTOR/10
nutrition -= HUNGER_FACTOR/5
thirst -= THIRST_FACTOR/10 //running around depleats thirst more so.
@@ -100,6 +100,7 @@
stat("Unique Identity:", "[dna.unique_enzymes]")
stat("Overall Status:", "[stat > 1 ? "dead" : "[health]% healthy"]")
stat("Nutrition Status:", "[nutrition]")
stat("Hydration Status:", "[thirst]")
stat("Oxygen Loss:", "[getOxyLoss()]")
stat("Toxin Levels:", "[getToxLoss()]")
stat("Burn Severity:", "[getFireLoss()]")
@@ -1243,6 +1243,7 @@ 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
@@ -1261,6 +1262,7 @@ 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)
@@ -1296,6 +1298,14 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(0 to NUTRITION_LEVEL_STARVING)
H.throw_alert("nutrition", /obj/screen/alert/starving)
switch(H.thirst)
if(NUTRITION_LEVEL_HUNGRY to INFINITY)
H.clear_alert("thirst")
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
H.throw_alert("thirst", /obj/screen/alert/thirsty)
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
@@ -57,6 +57,7 @@
var/dizziness = 0//Carbon
var/jitteriness = 0//Carbon
var/nutrition = NUTRITION_LEVEL_START_MIN // randomised in Initialize
var/thirst = NUTRITION_LEVEL_START_MIN // randomised in Initialize
var/satiety = 0//Carbon
var/overeatduration = 0 // How long this guy is overeating //Carbon
+9
View File
@@ -528,3 +528,12 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
//Can the mob see reagents inside of containers?
/mob/proc/can_see_reagents()
return stat == DEAD || has_unlimited_silicon_privilege //Dead guys and silicons can always see reagents
/mob/proc/can_read(obj/O)
if(is_blind())
to_chat(src, "<span class='warning'>As you are trying to read [O], you suddenly feel very stupid!</span>")
return
if(!is_literate())
to_chat(src, "<span class='notice'>You try to read [O], but can't comprehend any of it.</span>")
return
return TRUE