From 258746cd7c3c921b7efe32745918992519a7a5c7 Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Sun, 31 Mar 2024 10:25:21 -0400 Subject: [PATCH] [MIRROR] Add missing stimulants to All Nighter, make this handled by the reagents and not the quirk (#1736) * Add missing stimulants to All Nighter, make this handled by the reagents and not the quirk (#82306) ## About The Pull Request So while playing with All Nighter, I noticed lattes don't actually count for fueling my character's crippling coffee addiction. Looking into it, this is true, the list for which reagents count as stimulants for All Nighter is quite small: https://github.com/tgstation/tgstation/blob/fa0ef6b4b6f58b62bad5a105fb3b66d239859c1b/code/datums/quirks/negative_quirks/all_nighter.dm#L25-L37 And importantly, includes _none_ of the coffee or tea derivatives. But, in the process of adding everything I thought would have a high enough caffeine content, this list ended up quite big. More than doubled in size big. Which is _bad_, because when you haven't slept the quirk loops over every single reagent in that list to check if you have it, _every single process call_. https://github.com/tgstation/tgstation/blob/fa0ef6b4b6f58b62bad5a105fb3b66d239859c1b/code/datums/quirks/negative_quirks/all_nighter.dm#L84-L101 Soooo, ideally, we probably don't want that. But hey, upshot, we have this whole system for reagents to just give you a trait while metabolized and remove it when you're done. https://github.com/tgstation/tgstation/blob/fa0ef6b4b6f58b62bad5a105fb3b66d239859c1b/code/modules/reagents/chemistry/reagents.dm#L77-L78 So we make a trait called `TRAIT_STIMULATED`, check for that, and have each reagent on the list apply it while metabolized. Now, if we ever feel like it, we can also have other non-reagent stuff add that trait and have it Just Work. For ease of reading, the full list of reagents this makes All Nighter work with is as follows, where `+` denotes it's newly added:
All Nighter Reagents, Complete List ### Coffee &derivatives: - coffee - +cafe latte - +soy latte - +ice coffee - +hot ice coffee - +pumpkin latte ### Alcoholic coffee derivatives: - +kahlua - +konococo rumtini - +irish coffee - +thirteen loko ### Tea &derivatives: - tea - +iced tea - +letter t - +arnold palmer ### Energy drinks &derivatives: - monkey energy - volt energy - +space mountain wind - +demons blood ### Stimulants (drug subtype) - aranesp - bath salts - blastoff - methamphetamine - pumpup - +kronkaine ### Stimulants (medicine subtype) - stimulants - +ephedrine ### Powders (if you're insane) - +coffee powder - +tea powder
Note, kahlua is added as it's a coffee liqueur and does contain a not insignificant amount of caffeine, but due to its lower caffeine levels I decided its derivatives would be too diluted to matter for the sake of our poor hasn't-slept-all-night spaceman. ## Why It's Good For The Game In play it's annoying and unexpected that it works to drink tea but not iced tea and coffee but not latte, not the third arguably energy drink, and neither do some of the stimulants work. These inconsistencies would drive me mad if I actually played more than I coded. Either way, this lets you fuel your sleep deprivation in _style_. Code-wise, I imagine using a trait applied on start of metabolization is much saner than looping over and checking for every reagent in the list every process tick, especially with a bigger list. ## Changelog :cl: code: Whether something counts as a stimulant to All Nighter is now handled by the reagent itself when metabolized, for everyone's sanity. Side-effect, you need a liver to process stimulants for All Nighter. balance: Fuel your sleep deprivation in style! Made more reagents work with All Nighter. This includes all coffee/tea variants, a few other drinks that would have a high enough caffeine level, kronkaine, ephedrine, and in case you're insane you can straight up eat coffee or tea grounds. /:cl: * Add missing stimulants to All Nighter, make this handled by the reagents and not the quirk --------- Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> --- code/__DEFINES/traits/declarations.dm | 2 ++ code/_globalvars/traits/_traits.dm | 1 + .../quirks/negative_quirks/all_nighter.dm | 21 ++----------------- .../reagents/drinks/alcohol_reagents.dm | 5 +++++ .../reagents/drinks/drink_reagents.dm | 13 +++++++++++- .../chemistry/reagents/drug_reagents.dm | 8 +++++-- .../chemistry/reagents/medicine_reagents.dm | 4 ++-- .../chemistry/reagents/toxin_reagents.dm | 2 ++ 8 files changed, 32 insertions(+), 24 deletions(-) diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index bae9137d07c..b7aabbd1c39 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -389,6 +389,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_COAGULATING "coagulating" /// From anti-convulsant medication against seizures. #define TRAIT_ANTICONVULSANT "anticonvulsant" +/// From stimulant reagents, this affects whether the all-nighter lack of sleep penalty should be countered +#define TRAIT_STIMULATED "stimulated" /// The holder of this trait has antennae or whatever that hurt a ton when noogied #define TRAIT_ANTENNAE "antennae" /// Blowing kisses actually does damage to the victim diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index c94559a5541..b2737fca837 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -438,6 +438,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_STABLEHEART" = TRAIT_STABLEHEART, "TRAIT_STABLELIVER" = TRAIT_STABLELIVER, "TRAIT_STASIS" = TRAIT_STASIS, + "TRAIT_STIMULATED" = TRAIT_STIMULATED, "TRAIT_STRONG_GRABBER" = TRAIT_STRONG_GRABBER, "TRAIT_STUNIMMUNE" = TRAIT_STUNIMMUNE, "TRAIT_SUCCUMB_OVERRIDE" = TRAIT_SUCCUMB_OVERRIDE, diff --git a/code/datums/quirks/negative_quirks/all_nighter.dm b/code/datums/quirks/negative_quirks/all_nighter.dm index 253ce12b41f..0062537fde8 100644 --- a/code/datums/quirks/negative_quirks/all_nighter.dm +++ b/code/datums/quirks/negative_quirks/all_nighter.dm @@ -22,19 +22,6 @@ /obj/item/pillow/random, ) - ///a list of all the reagents which alleviate the negative moodlet - var/list/stimulants = list( - /datum/reagent/medicine/stimulants, - /datum/reagent/drug/methamphetamine, - /datum/reagent/drug/bath_salts, - /datum/reagent/drug/aranesp, - /datum/reagent/drug/pumpup, - /datum/reagent/drug/blastoff, - /datum/reagent/consumable/coffee, - /datum/reagent/consumable/tea, - /datum/reagent/consumable/volt_energy, - /datum/reagent/consumable/monkey_energy - ) ///essentially our "sleep bank". sleeping charges it up and its drained while awake var/five_more_minutes = 0 ///the overlay we put over the eyes @@ -84,7 +71,6 @@ /datum/quirk/all_nighter/process(seconds_per_tick) var/happy_camper = TRUE var/beauty_sleep = TRUE - var/stims_present = FALSE if(quirk_holder.IsSleeping()) five_more_minutes += SLEEP_BANK_MULTIPLIER * seconds_per_tick @@ -93,11 +79,8 @@ else beauty_sleep = FALSE //no sleep means eye bags - for(var/stimulant in stimulants) - if(quirk_holder.has_reagent(stimulant)) //checking for stims - stims_present = TRUE - break - if(!stims_present) //no stims and no sleep means an unhappy camper + // Defining which reagents count is handled by the reagents + if(!HAS_TRAIT(quirk_holder, TRAIT_STIMULATED)) happy_camper = FALSE //adjusts the mood event accordingly diff --git a/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm b/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm index 6de1a0d21ad..3cdae595c1e 100644 --- a/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm @@ -182,6 +182,7 @@ boozepwr = 45 ph = 6 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/ethanol/kahlua/on_mob_life(mob/living/carbon/drinker, seconds_per_tick, times_fired) . = ..() @@ -230,6 +231,7 @@ overdose_threshold = 60 taste_description = "jitters and death" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/ethanol/thirteenloko/on_mob_life(mob/living/carbon/drinker, seconds_per_tick, times_fired) . = ..() @@ -867,6 +869,7 @@ quality = DRINK_NICE taste_description = "giving up on the day" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/ethanol/margarita name = "Margarita" @@ -966,6 +969,7 @@ quality = DRINK_VERYGOOD taste_description = "sweet tasting iron" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/ethanol/demonsblood/on_mob_metabolize(mob/living/metabolizer) . = ..() @@ -2876,6 +2880,7 @@ quality = DRINK_VERYGOOD taste_description = "coconut coffee" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/ethanol/blue_hawaiian //pineapple juice, lemon juice, coconut rum, blue curacao name = "Blue Hawaiian" diff --git a/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm b/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm index b426bc4317b..23cec75806a 100644 --- a/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drinks/drink_reagents.dm @@ -264,7 +264,7 @@ taste_description = "bitterness" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED glass_price = DRINK_PRICE_STOCK - + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/coffee/overdose_process(mob/living/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -289,6 +289,7 @@ chemical_flags = REAGENT_CAN_BE_SYNTHESIZED glass_price = DRINK_PRICE_STOCK default_container = /obj/item/reagent_containers/cup/glass/mug/tea + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/tea/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -361,6 +362,7 @@ nutriment_factor = 0 taste_description = "bitter coldness" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/icecoffee/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -377,6 +379,7 @@ nutriment_factor = 0 taste_description = "bitter coldness and a hint of smoke" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/hot_ice_coffee/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -395,6 +398,7 @@ nutriment_factor = 0 taste_description = "sweet tea" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/icetea/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -522,6 +526,7 @@ color = "#102000" // rgb: 16, 32, 0 taste_description = "sweet citrus soda" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/spacemountainwind/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -656,6 +661,7 @@ overdose_threshold = 60 taste_description = "barbecue and nostalgia" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/monkey_energy/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -701,6 +707,7 @@ taste_description = "creamy coffee" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED glass_price = DRINK_PRICE_EASY + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/soy_latte/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -723,6 +730,7 @@ taste_description = "bitter cream" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED glass_price = DRINK_PRICE_EASY + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/cafe_latte/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -849,6 +857,7 @@ nutriment_factor = 3 taste_description = "creamy pumpkin" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/gibbfloats name = "Gibb Floats" @@ -1201,6 +1210,7 @@ color = "#583d09" // rgb: 88, 61, 9 taste_description = "one of your 26 favorite letters" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/t_letter/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -1240,6 +1250,7 @@ color = "#99E550" taste_description = "sour pear" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/consumable/volt_energy/expose_mob(mob/living/exposed_mob, methods=TOUCH, reac_volume) . = ..() diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 7204f9061ca..81d0a53d684 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -144,6 +144,7 @@ ph = 5 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED addiction_types = list(/datum/addiction/stimulants = 12) //4.8 per 2 seconds + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/drug/methamphetamine/on_new(data) . = ..() @@ -210,7 +211,7 @@ addiction_types = list(/datum/addiction/stimulants = 25) //8 per 2 seconds ph = 8.2 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED - metabolized_traits = list(TRAIT_STUNIMMUNE, TRAIT_SLEEPIMMUNE, TRAIT_ANALGESIA) + metabolized_traits = list(TRAIT_STUNIMMUNE, TRAIT_SLEEPIMMUNE, TRAIT_ANALGESIA, TRAIT_STIMULATED) var/datum/brain_trauma/special/psychotic_brawling/bath_salts/rage /datum/reagent/drug/bath_salts/on_mob_metabolize(mob/living/affected_mob) @@ -259,6 +260,7 @@ color = "#78FFF0" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED addiction_types = list(/datum/addiction/stimulants = 8) + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/drug/aranesp/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired) . = ..() @@ -327,7 +329,7 @@ overdose_threshold = 30 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED addiction_types = list(/datum/addiction/stimulants = 6) //2.6 per 2 seconds - metabolized_traits = list(TRAIT_BATON_RESISTANCE, TRAIT_ANALGESIA) + metabolized_traits = list(TRAIT_BATON_RESISTANCE, TRAIT_ANALGESIA, TRAIT_STIMULATED) /datum/reagent/drug/pumpup/on_mob_metabolize(mob/living/carbon/affected_mob) . = ..() @@ -546,6 +548,7 @@ overdose_threshold = 30 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED addiction_types = list(/datum/addiction/hallucinogens = 15) + metabolized_traits = list(TRAIT_STIMULATED) ///How many flips have we done so far? var/flip_count = 0 ///How many spin have we done so far? @@ -773,6 +776,7 @@ metabolization_rate = 0.75 * REAGENTS_METABOLISM chemical_flags = REAGENT_CAN_BE_SYNTHESIZED addiction_types = list(/datum/addiction/stimulants = 20) + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/drug/kronkaine/on_new(data) . = ..() diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 60b1f21547b..11b725e3825 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -581,7 +581,7 @@ addiction_types = list(/datum/addiction/stimulants = 4) //1.6 per 2 seconds inverse_chem = /datum/reagent/inverse/corazargh inverse_chem_val = 0.4 - metabolized_traits = list(TRAIT_BATON_RESISTANCE) + metabolized_traits = list(TRAIT_BATON_RESISTANCE, TRAIT_STIMULATED) /datum/reagent/medicine/ephedrine/on_mob_metabolize(mob/living/affected_mob) . = ..() @@ -1130,7 +1130,7 @@ ph = 8.7 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED|REAGENT_NO_RANDOM_RECIPE addiction_types = list(/datum/addiction/stimulants = 4) //0.8 per 2 seconds - metabolized_traits = list(TRAIT_BATON_RESISTANCE, TRAIT_ANALGESIA) + metabolized_traits = list(TRAIT_BATON_RESISTANCE, TRAIT_ANALGESIA, TRAIT_STIMULATED) /datum/reagent/medicine/stimulants/on_mob_metabolize(mob/living/affected_mob) . = ..() diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index d9f4073cba8..7f316a05f79 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -511,6 +511,7 @@ toxpwr = 0.5 ph = 4.2 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/toxin/teapowder name = "Ground Tea Leaves" @@ -521,6 +522,7 @@ taste_description = "green tea" ph = 4.9 chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + metabolized_traits = list(TRAIT_STIMULATED) /datum/reagent/toxin/mushroom_powder name = "Mushroom Powder"