From 821cccc7ed2d476dde261ce24e212c248e77aa05 Mon Sep 17 00:00:00 2001 From: lessthanthree <83487515+lessthnthree@users.noreply.github.com> Date: Thu, 18 Apr 2024 04:48:38 +0000 Subject: [PATCH] Smooth the alcohol impairment curve because a bottle of vodka should last more than 5 minutes (#1793) * alcohol processing changes * add temporary message about TM * stop light drinker from making you insta-sick * modularize it * fix lints * proc documentation * switch fix * remove TM Only warning --- code/__DEFINES/reagents.dm | 2 +- code/datums/mood.dm | 10 ++-- code/datums/status_effects/debuffs/drunk.dm | 26 ++++----- .../reagents/drinks/alcohol_reagents.dm | 6 +-- .../code/alcohol_processing.dm | 53 +++++++++++++++++++ .../modules/alcohol_processing/readme.md | 23 ++++++++ tgstation.dme | 1 + 7 files changed, 100 insertions(+), 21 deletions(-) create mode 100644 modular_nova/modules/alcohol_processing/code/alcohol_processing.dm create mode 100644 modular_nova/modules/alcohol_processing/readme.md diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 533bff874ff..df633f777c9 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -209,7 +209,7 @@ #define GOLDSCHLAGER_GOLD_RATIO (GOLDSCHLAGER_GOLD/(GOLDSCHLAGER_VODKA+GOLDSCHLAGER_GOLD)) /// The rate at which alcohol affects the drinker -#define ALCOHOL_RATE 0.005 +#define ALCOHOL_RATE 0.0025 // NOVA EDIT CHANGE - ALCOHOL_PROCESSING - Original: 0.005 #define BLASTOFF_DANCE_MOVE_CHANCE_PER_UNIT 3 #define BLASTOFF_DANCE_MOVES_PER_SUPER_MOVE 3 diff --git a/code/datums/mood.dm b/code/datums/mood.dm index 51b17a583ff..f00c56ec400 100644 --- a/code/datums/mood.dm +++ b/code/datums/mood.dm @@ -387,7 +387,7 @@ if(MOOD_LEVEL_HAPPY4) msg += "[span_boldnicegreen("I love life!")]\n" */ - //NOVA EDIT CHANGE BEGIN - ALEXITHYMIA + //NOVA EDIT CHANGE BEGIN - ALEXITHYMIA / ALCOHOL_PROCESSING if(!HAS_TRAIT(user, TRAIT_MOOD_NOEXAMINE)) switch(mood_level) if(MOOD_LEVEL_SAD4) @@ -410,10 +410,12 @@ msg += "[span_boldnicegreen("I love life!")]\n" else msg += "[span_notice("No clue.")]\n" - //NOVA EDIT CHANGE END + msg += "[span_notice("Moodlets:")]\n"//All moodlets - //if(mood_events.len) //ORIGINAL - if(mood_events.len && !HAS_TRAIT(user, TRAIT_MOOD_NOEXAMINE)) //NOVA EDIT CHANGE - ALEXITHYMIA + msg += get_alcohol_processing(user) + msg += get_drunk_mood(user) + if(mood_events.len && !HAS_TRAIT(user, TRAIT_MOOD_NOEXAMINE)) //ORIGINAL: if(mood_events.len) + //NOVA EDIT CHANGE END for(var/category in mood_events) var/datum/mood_event/event = mood_events[category] switch(event.mood_change) diff --git a/code/datums/status_effects/debuffs/drunk.dm b/code/datums/status_effects/debuffs/drunk.dm index 40bffc21b80..928841f1049 100644 --- a/code/datums/status_effects/debuffs/drunk.dm +++ b/code/datums/status_effects/debuffs/drunk.dm @@ -1,12 +1,12 @@ -// NOVA EDIT CHANGE BEGIN (#21546 DRUNK EFFECTS) +// NOVA EDIT CHANGE BEGIN - ALCOHOL_PROCESSING // Defines for the ballmer peak. #define BALLMER_PEAK_LOW_END 25.8 // Original 12.9 #define BALLMER_PEAK_HIGH_END 27.6 // Original 13.8 #define BALLMER_PEAK_WINDOWS_ME 37 // Original 26 /// The threshld which determine if someone is tipsy vs drunk -#define TIPSY_THRESHOLD 21 // Original 6 -// NOVA EDIT CHANGE END (#21546 DRUNK EFFECTS) +#define TIPSY_THRESHOLD 23.4 // Original 6 +// NOVA EDIT CHANGE END - ALCOHOL_PROCESSING /** * The drunk status effect. @@ -23,7 +23,7 @@ /datum/status_effect/inebriated/on_creation(mob/living/new_owner, drunk_value = 0) . = ..() set_drunk_value(drunk_value) - + /datum/status_effect/inebriated/get_examine_text() // Dead people don't look drunk if(owner.stat == DEAD || HAS_TRAIT(owner, TRAIT_FAKEDEATH)) @@ -71,7 +71,7 @@ // Every tick, the drunk value decrases by // 4% the current drunk_value + 0.01 // (until it reaches 0 and terminates) - set_drunk_value(drunk_value - (0.0075 + drunk_value * 0.0075)) // NOVA EDIT CHANGE - Alcohol Tolerance - Original: set_drunk_value(drunk_value - (0.01 + drunk_value * 0.04) + set_drunk_value(drunk_value - (drunk_value * 0.0015)) // NOVA EDIT CHANGE - ALCOHOL_PROCESSING - Original: set_drunk_value(drunk_value - (0.01 + drunk_value * 0.04) if(QDELETED(src)) return @@ -146,7 +146,7 @@ if(drunk_value > BALLMER_PEAK_WINDOWS_ME) // by this point you're into windows ME territory owner.say(pick_list_replacements(VISTA_FILE, "ballmer_windows_me_msg"), forced = "ballmer") - // NOVA EDIT CHANGE BEGIN (#21546 DRUNK EFFECTS) + // NOVA EDIT CHANGE BEGIN - ALCOHOL_PROCESSING /* ORIGINAL // Drunk slurring scales in intensity based on how drunk we are -at 16 you will likely not even notice it, // but when we start to scale up you definitely will @@ -181,44 +181,44 @@ owner.adjust_jitter(-6 SECONDS) // Over 41, we have a 10% chance to gain confusion and occasionally slur words, scaling with drunk_value - if(drunk_value >= 41) + if(drunk_value >= 43.4) if(prob(clamp(drunk_value - 8, 0, 100))) owner.adjust_timed_status_effect(4 SECONDS, /datum/status_effect/speech/slurring/drunk, max_duration = 20 SECONDS) if(prob(10)) owner.adjust_confusion(4 SECONDS) // Over 61, we start to get blurred vision - if(drunk_value >= 61) + if(drunk_value >= 63.4) owner.set_dizzy_if_lower(45 SECONDS) if(prob(15)) owner.adjust_eye_blur_up_to(4 SECONDS, 20 SECONDS) // Over 71, we will constantly have blurry eyes, we might vomit - if(drunk_value >= 71) + if(drunk_value >= 73.4) owner.set_eye_blur_if_lower(20 SECONDS) if(prob(3)) owner.adjust_confusion(15 SECONDS) if(iscarbon(owner)) var/mob/living/carbon/carbon_owner = owner carbon_owner.vomit() // Vomiting clears toxloss - consider this a blessing - // NOVA EDIT CHANGE END (#21546 DRUNK EFFECTS) // Over 81, we will gain constant toxloss - if(drunk_value >= 81) + if(drunk_value >= 83.4) owner.adjustToxLoss(1) if(owner.stat == CONSCIOUS && prob(5)) to_chat(owner, span_warning("Maybe you should lie down for a bit...")) // Over 91, we gain even more toxloss, brain damage, and have a chance of dropping into a long sleep - if(drunk_value >= 91) + if(drunk_value >= 93.4) owner.adjustToxLoss(1) owner.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.4) if(owner.stat == CONSCIOUS) attempt_to_blackout() // And finally, over 100 - let's be honest, you shouldn't be alive by now. - if(drunk_value >= 101) + if(drunk_value >= 103.4) owner.adjustToxLoss(2) + // NOVA EDIT CHANGE END - ALCOHOL_PROCESSING /datum/status_effect/inebriated/drunk/proc/attempt_to_blackout() /* NOVA EDIT REMOVAL - Blackout drunk begone diff --git a/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm index fb9c580ef20..5c056a3905d 100644 --- a/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm @@ -57,7 +57,7 @@ if(HAS_TRAIT(drinker, TRAIT_ALCOHOL_TOLERANCE)) // we're an accomplished drinker booze_power *= 0.7 if(HAS_TRAIT(drinker, TRAIT_LIGHT_DRINKER)) - booze_power *= 2 + booze_power *= 1.33 // NOVA EDIT CHANGE - ALCOHOL_PROCESSING - Original: booze_power *= 2 // water will dilute alcohol effects var/total_water_volume = 0 @@ -73,12 +73,12 @@ booze_power *= (total_alcohol_volume / combined_dilute_volume) // Volume, power, and server alcohol rate effect how quickly one gets drunk - drinker.adjust_drunk_effect(sqrt(volume) * booze_power * ALCOHOL_RATE * REM * seconds_per_tick * 0.25) // NOVA EDIT CHANGE - Alcohol Tolerance - Original: (sqrt(volume) * booze_power * ALCOHOL_RATE * REM * seconds_per_tick) + drinker.adjust_drunk_effect(booze_power * ALCOHOL_RATE * REM * seconds_per_tick) // NOVA EDIT CHANGE - ALCOHOL_PROCESSING - Original: (sqrt(volume) * booze_power * ALCOHOL_RATE * REM * seconds_per_tick) if(boozepwr > 0) var/obj/item/organ/internal/liver/liver = drinker.get_organ_slot(ORGAN_SLOT_LIVER) var/heavy_drinker_multiplier = (HAS_TRAIT(drinker, TRAIT_HEAVY_DRINKER) ? 0.5 : 1) if (istype(liver)) - if(liver.apply_organ_damage(((max(sqrt(volume) * (boozepwr ** ALCOHOL_EXPONENT) * liver.alcohol_tolerance * heavy_drinker_multiplier * seconds_per_tick, 0))/300))) // NOVA EDIT CHANGE - Alcohol Tolerance - Original: if((((max(sqrt(volume) * (boozepwr ** ALCOHOL_EXPONENT) * liver.alcohol_tolerance * heavy_drinker_multiplier * seconds_per_tick, 0))/150))) + if(liver.apply_organ_damage(((max(sqrt(volume) * (boozepwr ** ALCOHOL_EXPONENT) * liver.alcohol_tolerance * heavy_drinker_multiplier * seconds_per_tick, 0))/300))) // NOVA EDIT CHANGE - ALCOHOL_PROCESSING - Original: if((((max(sqrt(volume) * (boozepwr ** ALCOHOL_EXPONENT) * liver.alcohol_tolerance * heavy_drinker_multiplier * seconds_per_tick, 0))/150))) return UPDATE_MOB_HEALTH /datum/reagent/consumable/ethanol/expose_obj(obj/exposed_obj, reac_volume) diff --git a/modular_nova/modules/alcohol_processing/code/alcohol_processing.dm b/modular_nova/modules/alcohol_processing/code/alcohol_processing.dm new file mode 100644 index 00000000000..ca748ce19d6 --- /dev/null +++ b/modular_nova/modules/alcohol_processing/code/alcohol_processing.dm @@ -0,0 +1,53 @@ +#define BAC_STAGE_1_ACTIVE 0.01 +#define BAC_STAGE_2_WARN 0.05 +#define BAC_STAGE_2_ACTIVE 0.07 +#define BAC_STAGE_3_WARN 0.11 +#define BAC_STAGE_3_ACTIVE 0.13 +#define BAC_STAGE_4_WARN 0.17 +#define BAC_STAGE_4_ACTIVE 0.19 +#define BAC_STAGE_5_WARN 0.23 + +/datum/reagent/consumable/ethanol + metabolization_rate = 0.3 * REAGENTS_METABOLISM + +/atom/movable/screen/alert/status_effect/drunk + desc = "All that alcohol you've been drinking is impairing your speech, \ + motor skills, and mental cognition. Make sure to act like it. \ + Check your current drunkenness level using your mood status." + +/// Adds a moodlet entry based on if the mob currently has alcohol processing in their system. +/datum/mood/proc/get_alcohol_processing(mob/user) + if(user.reagents.reagent_list.len) + for(var/datum/reagent/consumable/ethanol/booze in user.reagents.reagent_list) + return span_notice("I'm still processing that alcohol I drank...\n") + +/// Adds a moodlet entry based on the current blood alcohol content of the mob. +/datum/mood/proc/get_drunk_mood(mob/user) + var/mob/living/target = user + var/blood_alcohol_content = target.get_blood_alcohol_content() + switch(blood_alcohol_content) + if(BAC_STAGE_1_ACTIVE to BAC_STAGE_2_WARN) + return span_notice("Had a drink, time to relax!\n") + if(BAC_STAGE_2_WARN to BAC_STAGE_2_ACTIVE) + return span_nicegreen("Now I'm starting to feel that drink.\n") + if(BAC_STAGE_2_ACTIVE to BAC_STAGE_3_WARN) + return span_nicegreen("A bit tipsy, this feels good!\n") + if(BAC_STAGE_3_WARN to BAC_STAGE_3_ACTIVE) + return span_nicegreen("Those drinks are really starting to hit!\n") + if(BAC_STAGE_3_ACTIVE to BAC_STAGE_4_WARN) + return span_nicegreen("I can't remember how many I've had, but I feel great!\n") + if(BAC_STAGE_4_WARN to BAC_STAGE_4_ACTIVE) + return span_warning("I think I've had too much to drink... I should probably stop... drink some water...\n") + if(BAC_STAGE_4_ACTIVE to BAC_STAGE_5_WARN) + return span_bolddanger("I'm not feeling so hot...\n") + if(BAC_STAGE_5_WARN to INFINITY) + return span_bolddanger("Is there a doctor around? I really don't feel good...\n") + +#undef BAC_STAGE_1_ACTIVE +#undef BAC_STAGE_2_WARN +#undef BAC_STAGE_2_ACTIVE +#undef BAC_STAGE_3_WARN +#undef BAC_STAGE_3_ACTIVE +#undef BAC_STAGE_4_WARN +#undef BAC_STAGE_4_ACTIVE +#undef BAC_STAGE_5_WARN diff --git a/modular_nova/modules/alcohol_processing/readme.md b/modular_nova/modules/alcohol_processing/readme.md new file mode 100644 index 00000000000..a6cf0335196 --- /dev/null +++ b/modular_nova/modules/alcohol_processing/readme.md @@ -0,0 +1,23 @@ +## Title: Alcohol Processing + +MODULE ID: ALCOHOL_PROCESSING + +### Description: + +Adjusts the rate of alcohol processing, its effects, and thresholds. Drinks last longer with a smoother up and down for more predictable roleplay drinking. + +### TG Proc Changes: +- EDIT: code/datums/mood.dm > /datum/mood/proc/print_mood(mob/user) +- EDIT: code/datums/status_effects/debuffs/drunk.dm > /datum/status_effect/inebriated/drunk/on_tick_effects(), /datum/status_effect/inebriated/tick() +- EDIT: code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm > /datum/reagent/consumable/ethanol/on_mob_life() + +### Master file additions + +- N/A + +### Included files that are not contained in this module: + +- N/A + +### Credits: +LT3 diff --git a/tgstation.dme b/tgstation.dme index 4c011a1c3d9..6d200909bfe 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6747,6 +6747,7 @@ #include "modular_nova\modules\aesthetics\windows\code\windows.dm" #include "modular_nova\modules\airlock_override\code\airlock_override.dm" #include "modular_nova\modules\akula\code\wetsuit.dm" +#include "modular_nova\modules\alcohol_processing\code\alcohol_processing.dm" #include "modular_nova\modules\alerts\code\alert_sound_to_playing.dm" #include "modular_nova\modules\alerts\code\config.dm" #include "modular_nova\modules\alerts\code\default_announcer.dm"