Files
Bubberstation/code/datums/status_effects/drug_effects.dm
san7890 bf6f81a9b5 Implements AddTraits and RemoveTraits procs for adding/removing multiple traits + swag unit test (#74037)
On the tin, doing it like this means we can reduce our overall line
fingerprint whenever we have to add two or more traits from the same
source on the same target. Especially helps when we get to the 4+ range
of traits, a breath of fresh air even.

Doesn't mean we have to do for loops, as that's already handled within
the define as well. I replaced some of the checks with `length()`
checks, let me know if I should switch it over to something else (maybe
`islist()`)? We stack_trace whenever we're not passed a list reference
on purpose, and sometimes var/lists are null by default (or just empty,
making this redundant).
## Why It's Good For The Game

I commonly feel the urge to write "use `AddTraits()`" or something in
reviews, then am sad when I remember it doesn't exist. I will no longer
be sad.

Can ensure a lot more trait safety as well by using static lists- when
both ADD_TRAIT_LIST and REMOVE_TRAIT_LIST re-use the same list, you are
confident (from a static point of view) that everything that you want to
be adding/removing works.

I may have missed a few things where this could be used, but both macros
implemented in this PR still use the same framework that was being used
in the last four years- so stuff won't break if left untouched. Just a
nifty new tool for developers.

also fixed up some code in the area, numerous bugs were found and
exploded
2023-03-18 01:57:06 +00:00

102 lines
3.9 KiB
Plaintext

/datum/status_effect/woozy
id = "woozy"
tick_interval = -1
status_type = STATUS_EFFECT_UNIQUE
alert_type = /atom/movable/screen/alert/status_effect/woozy
/datum/status_effect/woozy/nextmove_modifier()
return 1.5
/atom/movable/screen/alert/status_effect/woozy
name = "Woozy"
desc = "You feel a bit slower than usual, it seems doing things with your hands takes longer than it usually does."
icon_state = "woozy"
/datum/status_effect/high_blood_pressure
id = "high_blood_pressure"
tick_interval = -1
status_type = STATUS_EFFECT_UNIQUE
alert_type = /atom/movable/screen/alert/status_effect/high_blood_pressure
/datum/status_effect/high_blood_pressure/on_apply()
if(!ishuman(owner))
return FALSE
var/mob/living/carbon/human/human_owner = owner
human_owner.physiology.bleed_mod *= 1.25
return TRUE
/datum/status_effect/high_blood_pressure/on_remove()
if(!ishuman(owner))
return
var/mob/living/carbon/human/human_owner = owner
human_owner.physiology.bleed_mod /= 1.25
/atom/movable/screen/alert/status_effect/high_blood_pressure
name = "High blood pressure"
desc = "Your blood pressure is real high right now ... You'd probably bleed like a stuck pig."
icon_state = "highbloodpressure"
/datum/status_effect/seizure
id = "seizure"
tick_interval = -1
status_type = STATUS_EFFECT_UNIQUE
alert_type = /atom/movable/screen/alert/status_effect/seizure
/datum/status_effect/seizure/on_apply()
if(!iscarbon(owner))
return FALSE
var/amplitude = rand(1 SECONDS, 3 SECONDS)
duration = amplitude
owner.set_jitter_if_lower(100 SECONDS)
owner.Paralyze(duration)
owner.visible_message(span_warning("[owner] drops to the ground as [owner.p_they()] start seizing up."), \
span_warning("[pick("You can't collect your thoughts...", "You suddenly feel extremely dizzy...", "You cant think straight...","You can't move your face properly anymore...")]"))
return TRUE
/atom/movable/screen/alert/status_effect/seizure
name = "Seizure"
desc = "FJOIWEHUWQEFGYUWDGHUIWHUIDWEHUIFDUWGYSXQHUIODSDBNJKVBNKDML <--- this is you right now"
icon_state = "paralysis"
/datum/status_effect/stoned
id = "stoned"
duration = 10 SECONDS
alert_type = /atom/movable/screen/alert/status_effect/stoned
status_type = STATUS_EFFECT_REFRESH
var/original_eye_color_left
var/original_eye_color_right
/datum/status_effect/stoned/on_apply()
if(!ishuman(owner))
CRASH("[type] status effect added to non-human owner: [owner ? owner.type : "null owner"]")
var/mob/living/carbon/human/human_owner = owner
original_eye_color_left = human_owner.eye_color_left
original_eye_color_right = human_owner.eye_color_right
human_owner.add_movespeed_modifier(/datum/movespeed_modifier/reagent/cannabis) //slows you down
human_owner.eye_color_left = BLOODCULT_EYE //makes cult eyes less obvious
human_owner.eye_color_right = BLOODCULT_EYE //makes cult eyes less obvious
human_owner.update_body() //updates eye color
human_owner.add_traits(list(TRAIT_CLUMSY, TRAIT_BLOODSHOT_EYES), type) // impairs motor coordination and dilates blood vessels in eyes
human_owner.add_mood_event("stoned", /datum/mood_event/stoned) //improves mood
human_owner.sound_environment_override = SOUND_ENVIRONMENT_DRUGGED //not realistic but very immersive
return TRUE
/datum/status_effect/stoned/on_remove()
if(!ishuman(owner))
stack_trace("[type] status effect being removed from non-human owner: [owner ? owner.type : "null owner"]")
var/mob/living/carbon/human/human_owner = owner
human_owner.remove_movespeed_modifier(/datum/movespeed_modifier/reagent/cannabis)
human_owner.eye_color_left = original_eye_color_left
human_owner.eye_color_right = original_eye_color_right
human_owner.update_body()
human_owner.remove_traits(list(TRAIT_CLUMSY, TRAIT_BLOODSHOT_EYES), type)
human_owner.clear_mood_event("stoned")
human_owner.sound_environment_override = SOUND_ENVIRONMENT_NONE
/atom/movable/screen/alert/status_effect/stoned
name = "Stoned"
desc = "Cannabis is impairing your speed, motor skills, and mental cognition."
icon_state = "stoned"