Smooth the alcohol impairment curve because a bottle of vodka should last more than 5 minutes (#27183)

* enhanced roleplay drinking

* now modular!

* switch fix
This commit is contained in:
lessthanthree
2024-04-16 02:51:55 +02:00
committed by GitHub
parent d949c3f3c5
commit 2b94bd460c
7 changed files with 99 additions and 20 deletions
+1 -1
View File
@@ -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 // SKYRAT EDIT CHANGE - ALCOHOL_PROCESSING - ORIGINAL: 0.005
#define BLASTOFF_DANCE_MOVE_CHANCE_PER_UNIT 3
#define BLASTOFF_DANCE_MOVES_PER_SUPER_MOVE 3
+6 -4
View File
@@ -387,7 +387,7 @@
if(MOOD_LEVEL_HAPPY4)
msg += "[span_boldnicegreen("I love life!")]\n"
*/
//SKYRAT EDIT CHANGE BEGIN - ALEXITHYMIA
//SKYRAT 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"
//SKYRAT 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)) //SKYRAT 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)
//SKYRAT EDIT CHANGE END
for(var/category in mood_events)
var/datum/mood_event/event = mood_events[category]
switch(event.mood_change)
+12 -12
View File
@@ -1,12 +1,12 @@
// SKYRAT EDIT CHANGE BEGIN (#21546 DRUNK EFFECTS)
// SKYRAT 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
// SKYRAT EDIT CHANGE END (#21546 DRUNK EFFECTS)
#define TIPSY_THRESHOLD 23.4 // Original 6
// SKYRAT EDIT CHANGE END - ALCOHOL_PROCESSING
/**
* The drunk status effect.
@@ -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)) // SKYRAT 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)) // SKYRAT 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")
// SKYRAT EDIT CHANGE BEGIN (#21546 DRUNK EFFECTS)
// SKYRAT 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,43 +181,43 @@
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
// SKYRAT EDIT CHANGE END (#21546 DRUNK EFFECTS)
// SKYRAT EDIT CHANGE END - ALCOHOL_PROCESSING
// 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)
/datum/status_effect/inebriated/drunk/proc/attempt_to_blackout()
@@ -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 // SKYRAT 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) // SKYRAT 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) // SKYRAT 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))) // SKYRAT 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))) // SKYRAT 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)
@@ -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
@@ -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
+1
View File
@@ -6667,6 +6667,7 @@
#include "modular_skyrat\modules\aesthetics\windows\code\windows.dm"
#include "modular_skyrat\modules\airlock_override\code\airlock_override.dm"
#include "modular_skyrat\modules\akula\code\wetsuit.dm"
#include "modular_skyrat\modules\alcohol_processing\code\alcohol_processing.dm"
#include "modular_skyrat\modules\alerts\code\alert_sound_to_playing.dm"
#include "modular_skyrat\modules\alerts\code\config.dm"
#include "modular_skyrat\modules\alerts\code\default_announcer.dm"