Skip to content

Commit

Permalink
Merge pull request #1167 from Absolucy/analgesia-trait
Browse files Browse the repository at this point in the history
Painkillers now actually induce analgesic effects
  • Loading branch information
dwasint authored Feb 12, 2024
2 parents e6d7b06 + eaa5a6a commit ad0c2d3
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 234 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// If applied to a mob, nearby dogs will have a small chance to nonharmfully harass said mob
#define TRAIT_HATED_BY_DOGS "hated_by_dogs"

/// Mob is unable to feel pain
#define TRAIT_ANALGESIA "analgesia"

// METABOLISMS
// Various jobs on the station have historically had better reactions
// to various drinks and foodstuffs. Security liking donuts is a classic
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_OVERWATCH_IMMUNE" = TRAIT_OVERWATCH_IMMUNE,
"TRAIT_UNDENSE" = TRAIT_UNDENSE,
"TRAIT_EXPANDED_FOV" = TRAIT_EXPANDED_FOV,
"TRAIT_ANALGESIA" = TRAIT_ANALGESIA
),
/obj/item/bodypart = list(
"TRAIT_PARALYSIS" = TRAIT_PARALYSIS,
Expand Down
4 changes: 2 additions & 2 deletions code/datums/brain_damage/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@
lose_text = span_warning("You realize you can feel pain again.")

/datum/brain_trauma/special/tenacity/on_gain()
owner.add_traits(list(TRAIT_NOSOFTCRIT, TRAIT_NOHARDCRIT), TRAUMA_TRAIT)
owner.add_traits(list(TRAIT_NOSOFTCRIT, TRAIT_NOHARDCRIT, TRAIT_ANALGESIA), TRAUMA_TRAIT)
..()

/datum/brain_trauma/special/tenacity/on_lose()
owner.remove_traits(list(TRAIT_NOSOFTCRIT, TRAIT_NOHARDCRIT), TRAUMA_TRAIT)
owner.remove_traits(list(TRAIT_NOSOFTCRIT, TRAIT_NOHARDCRIT, TRAIT_ANALGESIA), TRAUMA_TRAIT)
..()

/datum/brain_trauma/special/death_whispers
Expand Down
18 changes: 18 additions & 0 deletions code/datums/mood_events/generic_negative_events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
mood_change = -3
timeout = 3 MINUTES

/datum/mood_event/table_limbsmash/New(mob/M, ...)
if(HAS_TRAIT(M, TRAIT_ANALGESIA))
qdel(src)
return
return ..()

/datum/mood_event/table_limbsmash/add_effects(obj/item/bodypart/banged_limb)
if(banged_limb)
description = "My fucking [banged_limb.plaintext_zone], man that hurts..."
Expand Down Expand Up @@ -169,6 +175,12 @@
mood_change = -5
timeout = 60 SECONDS

/datum/mood_event/painful_medicine/New(mob/M, ...)
if(HAS_TRAIT(M, TRAIT_ANALGESIA))
qdel(src)
return
return ..()

/datum/mood_event/spooked
description = "The rattling of those bones... It still haunts me."
mood_change = -4
Expand Down Expand Up @@ -206,6 +218,12 @@
description = "Bags never sit right on my back, this hurts like hell!"
mood_change = -15

/datum/mood_event/back_pain/New(mob/M, ...)
if(HAS_TRAIT(M, TRAIT_ANALGESIA))
qdel(src)
return
return ..()

/datum/mood_event/sad_empath
description = "Someone seems upset..."
mood_change = -1
Expand Down
21 changes: 5 additions & 16 deletions code/datums/wounds/bones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -409,22 +409,11 @@
user.visible_message(span_notice("[user] finishes applying [I] to [victim]'s [limb.plaintext_zone], emitting a fizzing noise!"), span_notice("You finish applying [I] to [victim]'s [limb.plaintext_zone]!"), ignored_mobs=victim)
to_chat(victim, span_userdanger("[user] finishes applying [I] to your [limb.plaintext_zone], and you can feel the bones exploding with pain as they begin melting and reforming!"))
else
var/painkiller_bonus = 0
if(victim.get_drunk_amount() > 10)
painkiller_bonus += 10
if(victim.reagents.has_reagent(/datum/reagent/medicine/morphine))
painkiller_bonus += 20
if(victim.reagents.has_reagent(/datum/reagent/determination))
painkiller_bonus += 10
if(victim.reagents.has_reagent(/datum/reagent/consumable/ethanol/painkiller))
painkiller_bonus += 15
if(victim.reagents.has_reagent(/datum/reagent/medicine/mine_salve))
painkiller_bonus += 20

if(prob(25 + (20 * (severity - 2)) - painkiller_bonus)) // 25%/45% chance to fail self-applying with severe and critical wounds, modded by painkillers
victim.visible_message(span_danger("[victim] fails to finish applying [I] to [victim.p_their()] [limb.plaintext_zone], passing out from the pain!"), span_notice("You pass out from the pain of applying [I] to your [limb.plaintext_zone] before you can finish!"))
victim.AdjustUnconscious(5 SECONDS)
return TRUE
if(!HAS_TRAIT(victim, TRAIT_ANALGESIA))
if(prob(25 + (20 * (severity - 2)) - min(victim.get_drunk_amount(), 10))) // 25%/45% chance to fail self-applying with severe and critical wounds, modded by drunkenness
victim.visible_message(span_danger("[victim] fails to finish applying [I] to [victim.p_their()] [limb.plaintext_zone], passing out from the pain!"), span_notice("You pass out from the pain of applying [I] to your [limb.plaintext_zone] before you can finish!"))
victim.AdjustUnconscious(5 SECONDS)
return TRUE
victim.visible_message(span_notice("[victim] finishes applying [I] to [victim.p_their()] [limb.plaintext_zone], grimacing from the pain!"), span_notice("You finish applying [I] to your [limb.plaintext_zone], and your bones explode in pain!"))

limb.receive_damage(25, wound_bonus=CANT_WOUND)
Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/human/emote.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE
vary = TRUE
/datum/emote/carbon/human/scream/run_emote(mob/user, params, type_override, intentional = FALSE)
if(!intentional && HAS_TRAIT(user, TRAIT_ANALGESIA))
return
return ..()
/datum/emote/living/carbon/human/scream/get_sound(mob/living/carbon/human/user)
if(!istype(user))
return
Expand Down
18 changes: 14 additions & 4 deletions code/modules/reagents/chemistry/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
var/restricted = FALSE
/// do we have a turf exposure (used to prevent liquids doing un-needed processes)
var/turf_exposure = FALSE
/// A list of traits to apply while the reagent is being metabolized.
var/list/metabolized_traits
/// A list of traits to apply while the reagent is in a mob.
var/list/added_traits

/datum/reagent/New()
SHOULD_CALL_PARENT(TRUE)
Expand Down Expand Up @@ -202,21 +206,27 @@ Primarily used in reagents/reaction_agents

/// Called when this reagent is first added to a mob
/datum/reagent/proc/on_mob_add(mob/living/L, amount)
SHOULD_CALL_PARENT(TRUE)
overdose_threshold /= max(normalise_creation_purity(), 1) //Maybe??? Seems like it would help pure chems be even better but, if I normalised this to 1, then everything would take a 25% reduction
return
if(added_traits)
L.add_traits(added_traits, "added:[type]")

/// Called when this reagent is removed while inside a mob
/datum/reagent/proc/on_mob_delete(mob/living/L)
SHOULD_CALL_PARENT(TRUE)
REMOVE_TRAITS_IN(L, "added:[type]")
L.clear_mood_event("[type]_overdose")
return

/// Called when this reagent first starts being metabolized by a liver
/datum/reagent/proc/on_mob_metabolize(mob/living/L)
return
SHOULD_CALL_PARENT(TRUE)
if(metabolized_traits)
L.add_traits(metabolized_traits, "metabolized:[type]")

/// Called when this reagent stops being metabolized by a liver
/datum/reagent/proc/on_mob_end_metabolize(mob/living/L)
return
SHOULD_CALL_PARENT(TRUE)
REMOVE_TRAITS_IN(L, "metabolized:[type]")

/// Called when a reagent is inside of a mob when they are dead
/datum/reagent/proc/on_mob_dead(mob/living/carbon/C, seconds_per_tick)
Expand Down
31 changes: 16 additions & 15 deletions code/modules/reagents/chemistry/reagents/alcohol_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
return ..()

/datum/reagent/consumable/ethanol/beer/green/on_mob_end_metabolize(mob/living/drinker)
. = ..()
drinker.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, color)

/datum/reagent/consumable/ethanol/kahlua
Expand Down Expand Up @@ -904,6 +905,7 @@
taste_description = "alcoholic bravery"
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED
glass_price = DRINK_PRICE_EASY
metabolized_traits = list(TRAIT_FEARLESS, TRAIT_ANALGESIA)
var/tough_text

/datum/glass_style/drinking_glass/brave_bull
Expand All @@ -914,17 +916,17 @@
icon_state = "bravebullglass"

/datum/reagent/consumable/ethanol/brave_bull/on_mob_metabolize(mob/living/drinker)
. = ..()
tough_text = pick("brawny", "tenacious", "tough", "hardy", "sturdy") //Tuff stuff
to_chat(drinker, span_notice("You feel [tough_text]!"))
drinker.maxHealth += 10 //Brave Bull makes you sturdier, and thus capable of withstanding a tiny bit more punishment.
drinker.health += 10
ADD_TRAIT(drinker, TRAIT_FEARLESS, type)

/datum/reagent/consumable/ethanol/brave_bull/on_mob_end_metabolize(mob/living/drinker)
. = ..()
to_chat(drinker, span_notice("You no longer feel [tough_text]."))
drinker.maxHealth -= 10
drinker.health = min(drinker.health - 10, drinker.maxHealth) //This can indeed crit you if you're alive solely based on alchol ingestion
REMOVE_TRAIT(drinker, TRAIT_FEARLESS, type)

/datum/reagent/consumable/ethanol/tequila_sunrise
name = "Tequila Sunrise"
Expand All @@ -945,6 +947,7 @@
icon_state = "tequilasunriseglass"

/datum/reagent/consumable/ethanol/tequila_sunrise/on_mob_metabolize(mob/living/drinker)
. = ..()
to_chat(drinker, span_notice("You feel gentle warmth spread through your body!"))
light_holder = new(drinker)
light_holder.set_light(l_outer_range = 3, l_power = 0.7, l_color = "#FFCC00") //Tequila Sunrise makes you radiate dim light, like a sunrise!
Expand All @@ -956,6 +959,7 @@
return ..()

/datum/reagent/consumable/ethanol/tequila_sunrise/on_mob_end_metabolize(mob/living/drinker)
. = ..()
to_chat(drinker, span_notice("The warmth in your body fades."))
QDEL_NULL(light_holder)

Expand Down Expand Up @@ -1073,6 +1077,7 @@
icon_state = "manlydorfglass"

/datum/reagent/consumable/ethanol/manly_dorf/on_mob_metabolize(mob/living/drinker)
. = ..()
if(ishuman(drinker))
var/mob/living/carbon/human/potential_dwarf = drinker
if(HAS_TRAIT(potential_dwarf, TRAIT_DWARF))
Expand Down Expand Up @@ -1139,6 +1144,7 @@
icon_state = "b52glass"

/datum/reagent/consumable/ethanol/b52/on_mob_metabolize(mob/living/drinker)
. = ..()
playsound(drinker, 'sound/effects/explosion_distant.ogg', 100, FALSE)

/datum/reagent/consumable/ethanol/irishcoffee
Expand Down Expand Up @@ -1454,13 +1460,11 @@
quality = DRINK_VERYGOOD
taste_description = "concentrated matter"
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED
metabolized_traits = list(TRAIT_MADNESS_IMMUNE)
var/static/list/ray_filter = list(type = "rays", size = 40, density = 15, color = SUPERMATTER_SINGULARITY_RAYS_COLOUR, factor = 15)

/datum/reagent/consumable/ethanol/singulo/on_mob_metabolize(mob/living/drinker)
ADD_TRAIT(drinker, TRAIT_MADNESS_IMMUNE, type)

/datum/reagent/consumable/ethanol/singulo/on_mob_end_metabolize(mob/living/drinker)
REMOVE_TRAIT(drinker, TRAIT_MADNESS_IMMUNE, type)
. = ..()
drinker.remove_filter("singulo_rays")

/datum/reagent/consumable/ethanol/singulo/on_mob_life(mob/living/carbon/drinker, seconds_per_tick, times_fired)
Expand Down Expand Up @@ -2301,6 +2305,7 @@
icon_state = "bastion_bourbon"

/datum/reagent/consumable/ethanol/bastion_bourbon/on_mob_metabolize(mob/living/drinker)
. = ..()
var/heal_points = 10
if(drinker.health <= 0)
heal_points = 20 //heal more if we're in softcrit
Expand Down Expand Up @@ -2405,6 +2410,7 @@
icon_state = "crevice_spike"

/datum/reagent/consumable/ethanol/crevice_spike/on_mob_metabolize(mob/living/drinker) //damage only applies when drink first enters system and won't again until drink metabolizes out
. = ..()
drinker.adjustBruteLoss(3 * min(5,volume), required_bodytype = affected_bodytype) //minimum 3 brute damage on ingestion to limit non-drink means of injury - a full 5 unit gulp of the drink trucks you for the full 15

/datum/reagent/consumable/ethanol/sake
Expand Down Expand Up @@ -2462,6 +2468,7 @@
icon_state = "alexander"

/datum/reagent/consumable/ethanol/alexander/on_mob_metabolize(mob/living/drinker)
. = ..()
if(ishuman(drinker))
var/mob/living/carbon/human/the_human = drinker
for(var/obj/item/shield/the_shield in the_human.contents)
Expand All @@ -2476,10 +2483,10 @@
holder.remove_reagent(type)

/datum/reagent/consumable/ethanol/alexander/on_mob_end_metabolize(mob/living/drinker)
. = ..()
if(mighty_shield)
mighty_shield.block_chance -= 10
to_chat(drinker,span_notice("You notice [mighty_shield] looks worn again. Weird."))
..()

/datum/reagent/consumable/ethanol/amaretto_alexander
name = "Amaretto Alexander"
Expand Down Expand Up @@ -3003,6 +3010,7 @@
quality = DRINK_GOOD
taste_description = "artifical fruityness"
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED
metabolized_traits = list(TRAIT_SHOCKIMMUNE)

/datum/glass_style/drinking_glass/rubberneck
required_drink_type = /datum/reagent/consumable/ethanol/rubberneck
Expand All @@ -3011,14 +3019,6 @@
icon = 'icons/obj/drinks/mixed_drinks.dmi'
icon_state = "rubberneck"

/datum/reagent/consumable/ethanol/rubberneck/on_mob_metabolize(mob/living/drinker)
. = ..()
ADD_TRAIT(drinker, TRAIT_SHOCKIMMUNE, type)

/datum/reagent/consumable/ethanol/rubberneck/on_mob_end_metabolize(mob/living/drinker)
REMOVE_TRAIT(drinker, TRAIT_SHOCKIMMUNE, type)
return ..()

/datum/reagent/consumable/ethanol/duplex
name = "Duplex"
description = "An inseparable combination of two fruity drinks."
Expand Down Expand Up @@ -3133,6 +3133,7 @@
quality = DRINK_NICE
taste_description = "sugary tartness"
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED
metabolized_traits = list(TRAIT_ANALGESIA)

/datum/glass_style/drinking_glass/painkiller
required_drink_type = /datum/reagent/consumable/ethanol/painkiller
Expand Down
11 changes: 2 additions & 9 deletions code/modules/reagents/chemistry/reagents/atmos_gas_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
color = "90560B"
taste_description = "minty"
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED|REAGENT_NO_RANDOM_RECIPE
metabolized_traits = list(TRAIT_RESISTHEAT)

/datum/reagent/halon/on_mob_metabolize(mob/living/breather)
. = ..()
breather.add_movespeed_modifier(/datum/movespeed_modifier/reagent/halon)
ADD_TRAIT(breather, TRAIT_RESISTHEAT, type)

/datum/reagent/halon/on_mob_end_metabolize(mob/living/breather)
breather.remove_movespeed_modifier(/datum/movespeed_modifier/reagent/halon)
Expand Down Expand Up @@ -81,14 +81,7 @@
ph = 1.8
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED|REAGENT_NO_RANDOM_RECIPE
addiction_types = list(/datum/addiction/stimulants = 14)

/datum/reagent/nitrium_high_metabolization/on_mob_metabolize(mob/living/breather)
. = ..()
ADD_TRAIT(breather, TRAIT_SLEEPIMMUNE, type)

/datum/reagent/nitrium_high_metabolization/on_mob_end_metabolize(mob/living/breather)
REMOVE_TRAIT(breather, TRAIT_SLEEPIMMUNE, type)
return ..()
metabolized_traits = list(TRAIT_SLEEPIMMUNE)

/datum/reagent/nitrium_high_metabolization/on_mob_life(mob/living/carbon/breather, seconds_per_tick, times_fired)
breather.stamina.adjust(2 * REM * seconds_per_tick, FALSE)
Expand Down
9 changes: 1 addition & 8 deletions code/modules/reagents/chemistry/reagents/drink_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -685,21 +685,14 @@
quality = DRINK_VERYGOOD
taste_description = "carbonated oil"
chemical_flags = REAGENT_CAN_BE_SYNTHESIZED
metabolized_traits = list(TRAIT_SHOCKIMMUNE)

/datum/glass_style/drinking_glass/grey_bull
required_drink_type = /datum/reagent/consumable/grey_bull
name = "glass of Grey Bull"
desc = "Surprisingly it isn't grey."
icon_state = "grey_bull_glass"

/datum/reagent/consumable/grey_bull/on_mob_metabolize(mob/living/affected_mob)
..()
ADD_TRAIT(affected_mob, TRAIT_SHOCKIMMUNE, type)

/datum/reagent/consumable/grey_bull/on_mob_end_metabolize(mob/living/affected_mob)
REMOVE_TRAIT(affected_mob, TRAIT_SHOCKIMMUNE, type)
..()

/datum/reagent/consumable/grey_bull/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired)
affected_mob.set_jitter_if_lower(40 SECONDS * REM * seconds_per_tick)
affected_mob.adjust_dizzy(2 SECONDS * REM * seconds_per_tick)
Expand Down
Loading

0 comments on commit ad0c2d3

Please sign in to comment.