Files
Lucy 851c5a5df9 Convert all traits given by status effects to use TRAIT_STATUS_EFFECT(id) (#89291)
## About The Pull Request

This makes (almost?) all traits given by status effects use
`TRAIT_STATUS_EFFECT(id)` as their source, rather than the previous mix
of `id`, `type`, `REF(src)`, or some bespoke thing.

## Why It's Good For The Game

Consistency is good.

## Changelog

No user-facing changes
2025-02-01 21:21:44 +01:00

24 lines
704 B
Plaintext

/datum/status_effect/silenced
id = "silent"
alert_type = null
remove_on_fullheal = TRUE
/datum/status_effect/silenced/on_creation(mob/living/new_owner, duration = 10 SECONDS)
src.duration = duration
return ..()
/datum/status_effect/silenced/on_apply()
RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(clear_silence))
ADD_TRAIT(owner, TRAIT_MUTE, TRAIT_STATUS_EFFECT(id))
return TRUE
/datum/status_effect/silenced/on_remove()
UnregisterSignal(owner, COMSIG_LIVING_DEATH)
REMOVE_TRAIT(owner, TRAIT_MUTE, TRAIT_STATUS_EFFECT(id))
/// Signal proc that clears any silence we have (self-deletes).
/datum/status_effect/silenced/proc/clear_silence(mob/living/source)
SIGNAL_HANDLER
qdel(src)