From bfe946bca747a066339671ec4c7c64d281bd1890 Mon Sep 17 00:00:00 2001 From: BurgerLUA Date: Sun, 7 Oct 2018 11:37:29 -0700 Subject: [PATCH] Hunger Icon Tweaks (#5384) * Added * aaaa --- code/modules/mob/living/carbon/human/life.dm | 34 ++++++++++++++---- code/modules/mob/mob_helpers.dm | 16 ++++----- html/changelogs/burgerbb - hunger tweaks.yml | 38 ++++++++++++++++++++ 3 files changed, 73 insertions(+), 15 deletions(-) create mode 100644 html/changelogs/burgerbb - hunger tweaks.yml diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index d868717a1a8..34bae1a3693 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -951,7 +951,7 @@ else if(overeatduration > 1) overeatduration -= 2 //doubled the unfat rate - + // hydration decrease if(max_hydration > 0) if (hydration > 0 && stat != 2) @@ -1196,16 +1196,36 @@ if((life_tick % 3 == 0)) if(nutrition_icon) var/nut_factor = max(0,min(nutrition / max_nutrition,1)) - var/nutrition_icons = 5 //Misnomer, basically the highest nutrition icon value. - var/new_val = "nutrition[nutrition_icons - round(nut_factor*nutrition_icons)]" + var/nut_icon = 5 //5 to 0, with 5 being lowest, 0 being highest + if(nut_factor >= CREW_NUTRITION_OVEREATEN) + nut_icon = 0 + else if (nut_factor >= CREW_NUTRITION_FULL) + nut_icon = 1 + else if (nut_factor >= CREW_NUTRITION_SLIGHTLYHUNGRY) + nut_icon = 2 + else if (nut_factor >= CREW_NUTRITION_HUNGRY) + nut_icon = 3 + else if (nut_factor >= CREW_NUTRITION_VERYHUNGRY ) + nut_icon = 4 + var/new_val = "nutrition[nut_icon]" if (nutrition_icon.icon_state != new_val) nutrition_icon.icon_state = new_val if(hydration_icon) var/hyd_factor = max(0,min(hydration / max_hydration,1)) - var/hydration_icons = 5 //Misnomer, basically the highest thirst icon value. - var/new_val = "thirst[hydration_icons - round(hyd_factor*hydration_icons)]" + var/hyd_icon = 5 + if(hyd_factor >= CREW_HYDRATION_OVERHYDRATED) + hyd_icon = 0 + else if(hyd_factor >= CREW_HYDRATION_HYDRATED) + hyd_icon = 1 + else if(hyd_factor >= CREW_HYDRATION_SLIGHTLYTHIRSTY) + hyd_icon = 2 + else if(hyd_factor >= CREW_HYDRATION_THIRSTY) + hyd_icon = 3 + else if(hyd_factor >= CREW_HYDRATION_VERYTHIRSTY) + hyd_icon = 4 + var/new_val = "thirst[hyd_icon]" if (hydration_icon.icon_state != new_val) - hydration_icon.icon_state = new_val + hydration_icon.icon_state = new_val if(pressure) var/new_pressure = "pressure[pressure_alert]" @@ -1653,7 +1673,7 @@ if (prob(1.5)) src << span("warning", "You feel hungry and exhausted, eat something to regain your energy!") return - + if (hydration <= 0) if (prob(1.5)) src << span("warning", "You feel thirsty and exhausted, drink something to regain your energy!") diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index c5dd2409f07..03026f58edd 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -1190,16 +1190,16 @@ proc/is_blind(A) var/hydration_mul = hydration/max_hydration if(hydration_mul >= CREW_HYDRATION_OVERHYDRATED) - return minscale + ( (maxscale - minscale) * 0.75) + return minscale + ( (maxscale - minscale) * 0.66) if(hydration_mul <= CREW_HYDRATION_DEHYDRATED) - return minscale + ( (maxscale - minscale) * 0.25) + return minscale if(hydration_mul <= CREW_HYDRATION_VERYTHIRSTY) - return minscale + ( (maxscale - minscale) * 0.5) + return minscale + ( (maxscale - minscale) * 0.33) if(hydration_mul <= CREW_HYDRATION_THIRSTY) - return minscale + ( (maxscale - minscale) * 0.75) + return minscale + ( (maxscale - minscale) * 0.66) return minscale + ( (maxscale - minscale) * 1) @@ -1214,16 +1214,16 @@ proc/is_blind(A) var/nutrition_mul = nutrition/max_nutrition if(nutrition_mul >= CREW_NUTRITION_OVEREATEN) - return minscale + ( (maxscale - minscale) * 0.75) + return minscale + ( (maxscale - minscale) * 0.66) if(nutrition_mul <= CREW_NUTRITION_STARVING) - return minscale + ( (maxscale - minscale) * 0.25) + return minscale if(nutrition_mul <= CREW_NUTRITION_VERYHUNGRY) - return minscale + ( (maxscale - minscale) * 0.5) + return minscale + ( (maxscale - minscale) * 0.33) if(nutrition_mul <= CREW_NUTRITION_HUNGRY) - return minscale + ( (maxscale - minscale) * 0.75) + return minscale + ( (maxscale - minscale) * 0.66) return minscale + ( (maxscale - minscale) * 1) diff --git a/html/changelogs/burgerbb - hunger tweaks.yml b/html/changelogs/burgerbb - hunger tweaks.yml new file mode 100644 index 00000000000..b408f1927f1 --- /dev/null +++ b/html/changelogs/burgerbb - hunger tweaks.yml @@ -0,0 +1,38 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +################################# + +# Your name. +author: BurgerBB + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Hunger/thirst icons now scale to their hunger/thirst levels appropriately." + - bugfix: "Fixed hunger/thirst penalty scaling."