From 6736349630fe95c1ad5531521938aaf2f202ad3e Mon Sep 17 00:00:00 2001 From: Polyzonial <62524471+Polyzonial@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:19:21 +0000 Subject: [PATCH] The great thirst workening --- code/__DEFINES/thirst.dm | 1 + mojave/code/datums/components/thirst.dm | 25 ++++++++----------- .../modules/reagents/consumables/alcohols.dm | 1 - .../modules/reagents/consumables/drinks.dm | 6 ++--- mojave/code/modules/reagents/mojave_chems.dm | 10 ++++++-- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/code/__DEFINES/thirst.dm b/code/__DEFINES/thirst.dm index 9c93df1ddfa..8e4c7d934e9 100644 --- a/code/__DEFINES/thirst.dm +++ b/code/__DEFINES/thirst.dm @@ -1,2 +1,3 @@ #define COMSIG_CHECK_SELF "Check_self" #define DEHYDRATION_STAGE_CHECK "Dehydration_stage_check" +#define THIRST_METABOLISE "Thrist_metabolise" diff --git a/mojave/code/datums/components/thirst.dm b/mojave/code/datums/components/thirst.dm index b34318b9cff..49516e78751 100644 --- a/mojave/code/datums/components/thirst.dm +++ b/mojave/code/datums/components/thirst.dm @@ -30,6 +30,7 @@ GLOBAL_LIST_INIT(dehydration_stage_alerts, list( var/stage_of_dehydration //Current stage of dehydration; goes from 1-5 where 1 is the non-thirsty stage var/list/stage_to_text //A list of messages to show on examine and when entering a new stage var/list/stage_to_alert //What alert to pop up when reaching a certain stage, data stored as typepaths + var/the_liquid //3000 being 50 minutes/3000 seconds of starting water, thirst limit being the same thing /datum/component/thirst/Initialize(thirst_rate = -1, start_thirst = 3000, thirst_limit = 3000, list/dehydration_stage_examine, list/dehydration_stage_alerts) @@ -41,9 +42,10 @@ GLOBAL_LIST_INIT(dehydration_stage_alerts, list( stage_to_alert = dehydration_stage_alerts stage_of_dehydration = 1 var/mob/living/the_parent = parent - modify_thirst(modify_by = start_thirst) + modify_thirst(modify_by = 1000) RegisterSignal(the_parent, COMSIG_CHECK_SELF, .proc/on_examine) RegisterSignal(the_parent, DEHYDRATION_STAGE_CHECK, .proc/return_dehydration_stage) + RegisterSignal(the_parent, THIRST_METABOLISE, .proc/on_water) START_PROCESSING(SSdcs, src) if(stage_of_dehydration == 1) //Still the same after modifying thirst? throw the alert the_parent.throw_alert("thirst", GLOB.dehydration_stage_alerts[stage_of_dehydration]) @@ -64,21 +66,16 @@ GLOBAL_LIST_INIT(dehydration_stage_alerts, list( var/mob/living/carbon/the_target = target the_target.clear_alert("thirst") +/datum/component/thirst/proc/on_water(datum/source, adjust_amount) + SIGNAL_HANDLER + + to_chat(src, span_notice("on_water")) + the_liquid = adjust_amount + modify_thirst(modify_by = adjust_amount) + /datum/component/thirst/process() modify_thirst(modify_by = rate_of_thirst) var/mob/living/the_parent = parent - for(var/_reagent in the_parent.reagents.reagent_list) - to_chat(world, span_notice("71")) - if(istype(_reagent, /datum/reagent/consumable)) - to_chat(world, span_notice("73")) - var/datum/reagent/consumable/liquid = _reagent - if(the_parent.has_reagent(liquid.type)) - to_chat(world, span_notice("75")) - var/datum/reagent/consumable/ms13/water = the_parent.reagents.get_reagent(_reagent) //Modify metabolism rate here so don't need to edit base files - water.metabolization_rate = 0 // Stop water metabolization, we'll take it from here - var/amount = min((the_parent.reagents.get_reagent_amount(water)) * SECONDS_OF_LIFE_PER_WATER_U), (SECONDS_OF_LIFE_PER_WATER_U * 5) - modify_thirst(modify_by = amount) //NO MICRODOSING, "metabolizes" 5 units of water per 1 second for +25 thirst - the_parent.reagents.remove_reagent(water, 5) //Last stage of dehydration, you're basically going to die now if(stage_of_dehydration == length(GLOB.dehydration_stage_alerts)) @@ -89,7 +86,7 @@ GLOBAL_LIST_INIT(dehydration_stage_alerts, list( return if(istype(the_carbon)) the_parent.add_fov_trait(src, fov_angle) - if(DT_PROB(10, 30)) + if(DT_PROB(1, 15)) the_parent.emote("cough") the_parent.dropItemToGround(I) diff --git a/mojave/code/modules/reagents/consumables/alcohols.dm b/mojave/code/modules/reagents/consumables/alcohols.dm index 5941dfef246..66d7a6c56e3 100644 --- a/mojave/code/modules/reagents/consumables/alcohols.dm +++ b/mojave/code/modules/reagents/consumables/alcohols.dm @@ -5,7 +5,6 @@ nutriment_factor = 0 taste_description = "pure, burning, absolute alcohol" boozepwr = 95 - hydration_amount = 40 //if you wanna be hydrated get water glass_name = "glass of clear liquid" glass_desc = "A completely clear liquid, spare for the occasional bubble rising to the top. A sniff of this nearly burns your nose hairs clean off." diff --git a/mojave/code/modules/reagents/consumables/drinks.dm b/mojave/code/modules/reagents/consumables/drinks.dm index acb61a459d6..904981ed8a0 100644 --- a/mojave/code/modules/reagents/consumables/drinks.dm +++ b/mojave/code/modules/reagents/consumables/drinks.dm @@ -4,12 +4,12 @@ name = "water" description = "Water. The base of all life. Don't run out." color = "#f1eeeca1" - hydration_amount = 70 //the 100% PURE H2O quality = DRINK_VERYGOOD - taste_description = "water" + taste_description = "pure refreshment" glass_name = "glass of clear liquid" glass_desc = "A clear liquid with no smell. Nothing out of the ordinary." var/clean_types = CLEAN_WASH + hydration_amount = 60 /datum/reagent/consumable/ms13/water/expose_turf(turf/open/exposed_turf, reac_volume) // easiest paste of my life . = ..() @@ -41,7 +41,6 @@ description = "Water... Questionable water. Should run it through some filtering or something." color = "#d8d3cfa1" taste_description = "water with an off taste" - hydration_amount = 60 glass_name = "glass of clear liquid" glass_desc = "A clear liquid with some stray particles seen floating around peacefully inside." @@ -50,7 +49,6 @@ description = "An ubiquitous chemical substance that is composed of hydrogen and oxygen, this one is impure and toxic to drink." color = "#4439288c" taste_description = "vile water" - hydration_amount = 50 glass_name = "glass of murky liquid" glass_desc = "A murky green liquid with a pungeant vile smell. Not so sure about this one." diff --git a/mojave/code/modules/reagents/mojave_chems.dm b/mojave/code/modules/reagents/mojave_chems.dm index 3563b9cefd9..973cdee66dc 100644 --- a/mojave/code/modules/reagents/mojave_chems.dm +++ b/mojave/code/modules/reagents/mojave_chems.dm @@ -11,16 +11,22 @@ description = "Yeah probably skip out on this one chief." color = "#7c7b7a" quality = DRINK_NICE - hydration_amount = 15 //go get a real liquid glass_name = "glass of liquid" // Keep these generic for flavour! glass_desc = "A pale coloured liquid. It screams 'PAIN'." // Same with this. Keep people guessin'. Make em know the drink via flavour and look for immersion. glass_icon_state = null // None of this dumb nonsense. Glasses don't just morph based on liquid! + hydration_amount = 10 //get a real liquid + +/datum/reagent/consumable/ms13/on_mob_life(mob/living/drinker) + var/adjust_amount = hydration_amount * REM + SEND_SIGNAL(drinker, THIRST_METABOLISE, adjust_amount) + to_chat(drinker, span_notice("on_mob_life")) + return ..() /datum/reagent/consumable/ms13/cola name = "Generic MS13 Cola" description = "Tasty, but buggy" color = "#413022" quality = DRINK_NICE - hydration_amount = 55 //cola is pretty refreshing glass_name = "glass of liquid" glass_desc = "A dark coloured liquid. It screams 'BUGS'." + hydration_amount = 55 //Cola is nice