Skip to content

Commit

Permalink
The great thirst workening
Browse files Browse the repository at this point in the history
  • Loading branch information
Polyzonial committed Nov 15, 2023
1 parent 42ca5cd commit 6736349
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/thirst.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#define COMSIG_CHECK_SELF "Check_self"
#define DEHYDRATION_STAGE_CHECK "Dehydration_stage_check"
#define THIRST_METABOLISE "Thrist_metabolise"
25 changes: 11 additions & 14 deletions mojave/code/datums/components/thirst.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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])
Expand All @@ -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))
Expand All @@ -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)

Expand Down
1 change: 0 additions & 1 deletion mojave/code/modules/reagents/consumables/alcohols.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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."

Expand Down
6 changes: 2 additions & 4 deletions mojave/code/modules/reagents/consumables/drinks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
. = ..()
Expand Down Expand Up @@ -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."

Expand All @@ -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."

Expand Down
10 changes: 8 additions & 2 deletions mojave/code/modules/reagents/mojave_chems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6736349

Please sign in to comment.