Files
Bubberstation/code/datums/elements/basic_allergenic_attack.dm
MrMelbert 922203edb9 Adds Allergic reactions to a few things (Bee stings, Beer) (#87392)
## About The Pull Request

The following effects will trigger allergic reactions for the "Food
Allergy" quirk
- For Alcohol allergies:
   - Drinking any ethanol (beer, wine, etc) 
- For Bug allergies:
   - Drinking ants
   - Getting stung by a bee
   - Getting bit by a (giant) ant
   - Getting bit by a (giant) spider 
- For Sugar allergies:
   - Drinking Sugar

Other notes
- Any mob undergoing surgery will benefit from ethanol speeding it up,
rather than just carbons

## Why It's Good For The Game

I saw a random discord comment that said "Bee stings should trigger bug
allergies" and I thought it was funny, so I added it, then I thought I
could add similar triggers to a few other things.

Important to note for the reagent based effects, they only trigger on
ingestion. And on top of that, it's a % chance to trigger, scaling with
the amount you drink at once. So you can sneak a sip of alcohol if you
want to roll the dice (I figure if I made syringes kill you, I'd have to
up the point reward, which I don't want to bother with)

## Changelog

🆑 Melbert
add: Drinking any ethanol (beer, wine, etc) will trigger alcohol
allergies
add: Drinking ants will trigger Bug allergies
add: Getting stung by a bee, or bitten by a (giant) ant or (giant)
spider, will trigger bug allergies
add: Drinking plain sugar or caramel will trigger sugar allergies
qol: Ethanol can speed up the surgeries of any mob type applied to,
rather than solely humans.
/🆑
2024-10-25 15:52:08 +02:00

35 lines
1.2 KiB
Plaintext

/// Attach to basic mobs, when they attack, they may trigger a food-based allergic reaction in the target.
/datum/element/basic_allergenic_attack
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// What allergen is being used. Corresponds to a FOODTYPE
var/allergen = NONE
/// Chance of the reaction happening
var/allergen_chance = 100
/// How much histamine to add to the target on reaction
var/histamine_add = 0
/datum/element/basic_allergenic_attack/Attach(datum/target, allergen = NONE, allergen_chance = 100, histamine_add = 0)
. = ..()
if(!isbasicmob(target))
return ELEMENT_INCOMPATIBLE
src.allergen = allergen
src.allergen_chance = allergen_chance
src.histamine_add = histamine_add
RegisterSignal(target, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(trigger_allergy))
/datum/element/basic_allergenic_attack/Detach(datum/source, ...)
. = ..()
UnregisterSignal(source, COMSIG_HOSTILE_POST_ATTACKINGTARGET)
/datum/element/basic_allergenic_attack/proc/trigger_allergy(mob/living/source, mob/living/target, result)
SIGNAL_HANDLER
if(result <= 0 || !istype(target))
return
if(!target.can_inject(source))
return
target.check_allergic_reaction(allergen, allergen_chance, histamine_add)