Species-based reagent/mental feedback messages (#21057)

Adds support for reagent/mental singletons to return different feedback
messages for different species.

Koko Reed Juice no longer delivers the 'high' feedback goodmessages to
non-Unathi.

---------

Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
This commit is contained in:
Batrachophreno
2025-08-02 19:58:08 +00:00
committed by GitHub
parent d8c991674f
commit 9309721e33
2 changed files with 107 additions and 5 deletions
@@ -1177,7 +1177,7 @@
/* mental */
#define MEDICATION_MESSAGE_DELAY 10 MINUTES
#define MEDICATION_MESSAGE_DELAY 10 SECONDS
/singleton/reagent/mental
name = null //Just like alcohol
@@ -1191,9 +1191,29 @@
od_minimum_dose = 0.02
taste_description = "bugs"
ingest_mul = 1
var/alchohol_affected = 1
/// Imparts hallucination effects scaling with bac.
var/alchohol_affected = TRUE
var/messagedelay = MEDICATION_MESSAGE_DELAY
var/list/goodmessage = list() //Fluff messages
/// Generic fluff messages for anyone who takes it.
var/list/goodmessage = list()
/// Species-specific fluff messages- will override the generic version for the given species. See following comment/example for implementation details.
var/list/goodmessage_species
/**
* We leave goodmessage_species null so no unnecessary checks are performed for most reagents. However, if we want a given reagent to have unique
* messages for consumers of a given species, its value can be set as below within the singleton/reagent/mental:
*
* goodmessage_species = list(
* SPECIES_HUMAN = list("Damn you're high.","You're totally zooted!"),
* SPECIES_HUMAN_OFFWORLD = list("Damn you're WAY higher than normal humans. Like, you might even say outside the gravity well high.", "Zooted bo booted boyyy."),
* SPECIES_UNATHI = list("You feel like shit and want to die.","Why the fuck did you smoke that shitty human stuff."),
* SPECIES_SKRELL = list("Aaaaaaaaaaaa!","Aaaauuuuaaaa!","Waaaoouuuuaaaaahhh!"),
* SPECIES_SKRELL_AXIORI = list("If you weren't axiori you'd probably be having a bad time but you're pretty zooted.")
* )
*
* No, there's not support right now for things like ALL_DIONA_SPECIES. Once somebody wants to make Vaurca-only drugs, they will probably
* implement support for it out of sheer annoyance though.
*/
fallback_specific_heat = 1.5
@@ -1206,15 +1226,36 @@
if(!istype(H) || world.time < holder.reagent_data[type]["last_tick_time"] || messagedelay == -1)
return
var/message
var/bac = H.get_blood_alcohol()
if(alchohol_affected && bac > 0.03)
H.hallucination = max(H.hallucination, bac * 400)
if(H.chem_doses[type] < overdose && H.shock_stage < 5) //Don't want feel-good messages when we're suffering an OD or particularly hurt/injured
to_chat(H, SPAN_GOOD("[pick(goodmessage)]"))
message = feedback_message(H)
to_chat(H, SPAN_GOOD("[message]"))
LAZYSET(holder.reagent_data[type], "last_tick_time", world.time + (messagedelay))
/**
* Holds logic for returning feedback message strings based on race.
* 'goodmessage' is your generic catch-all list of message strings.
* 'goodmessage_species', if set, will override the 'goodmessage' list only for that species.
*/
/singleton/reagent/mental/proc/feedback_message(var/mob/living/carbon/human/mob)
var/mob_species = mob.get_species()
var/message
if(length(goodmessage))
message = pick(goodmessage)
if(length(goodmessage_species))
for(var/species in goodmessage_species)
if(mob_species == species)
message = pick(goodmessage_species[species])
return message
/singleton/reagent/mental/overdose(var/mob/living/carbon/M, var/alien, var/datum/reagents/holder)
M.add_chemical_effect(CE_EMETIC, M.chem_doses[type] / 6)
@@ -1400,7 +1441,9 @@
overdose = 5
od_minimum_dose = 3
taste_description = "sugar"
goodmessage = list("You feel pleasantly warm.","You feel like you've been basking in the sun.","You feel focused and warm...")
goodmessage_species = list(
SPECIES_UNATHI = list("You feel pleasantly warm.","You feel like you've been basking in the sun.","You feel focused and warm...")
)
/singleton/reagent/mental/kokoreed/affect_blood(var/mob/living/carbon/M, var/alien, var/removed, var/datum/reagents/holder)
. = ..()