Skip to content

Commit

Permalink
Add missing stimulants to All Nighter, make this handled by the reage…
Browse files Browse the repository at this point in the history
…nts and not the quirk (tgstation#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:

<details>
  <summary>All Nighter Reagents, Complete List</summary>
  
### 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

</details>

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:
  • Loading branch information
00-Steven authored Mar 31, 2024
1 parent 6d77b9a commit e0b41e5
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 24 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,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,
Expand Down
21 changes: 2 additions & 19 deletions code/datums/quirks/negative_quirks/all_nighter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand Down Expand Up @@ -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)
. = ..()
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
. = ..()
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,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)
. = ..()
Expand All @@ -287,6 +287,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)
. = ..()
Expand Down Expand Up @@ -359,6 +360,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)
. = ..()
Expand All @@ -375,6 +377,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)
. = ..()
Expand All @@ -393,6 +396,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)
. = ..()
Expand Down Expand Up @@ -520,6 +524,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)
. = ..()
Expand Down Expand Up @@ -654,6 +659,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)
. = ..()
Expand Down Expand Up @@ -699,6 +705,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)
. = ..()
Expand All @@ -721,6 +728,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)
. = ..()
Expand Down Expand Up @@ -847,6 +855,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"
Expand Down Expand Up @@ -1199,6 +1208,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)
. = ..()
Expand Down Expand Up @@ -1238,6 +1248,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)
. = ..()
Expand Down
8 changes: 6 additions & 2 deletions code/modules/reagents/chemistry/reagents/drug_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
. = ..()
Expand Down Expand Up @@ -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)
. = ..()
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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)
. = ..()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/reagents/chemistry/reagents/medicine_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand Down Expand Up @@ -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)
. = ..()
Expand Down
2 changes: 2 additions & 0 deletions code/modules/reagents/chemistry/reagents/toxin_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit e0b41e5

Please sign in to comment.