Files
LucyandGitHub 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

60 lines
2.3 KiB
Plaintext

/datum/status_effect/tower_of_babel
id = "tower_of_babel"
status_type = STATUS_EFFECT_UNIQUE
alert_type = /atom/movable/screen/alert/status_effect/tower_of_babel
var/trait_source
/datum/status_effect/tower_of_babel/on_creation(mob/living/new_owner, duration = 15 SECONDS)
src.duration = duration
if(isnull(trait_source))
trait_source = TRAIT_STATUS_EFFECT(id)
return ..()
/datum/status_effect/tower_of_babel/on_apply()
var/random_language = pick(GLOB.all_languages)
owner.grant_language(random_language, source = LANGUAGE_BABEL)
// block every language except the randomized one
owner.add_blocked_language(GLOB.all_languages - random_language, source = LANGUAGE_BABEL)
// this lets us bypass tongue language restrictions except for people who have stuff like mute,
// no tongue, tongue tied, etc. curse of babel shouldn't let people who have a tongue disability speak
if(owner.mind)
ADD_TRAIT(owner.mind, TRAIT_TOWER_OF_BABEL, trait_source)
owner.add_mood_event(id, /datum/mood_event/tower_of_babel)
return ..()
/datum/status_effect/tower_of_babel/on_remove()
owner.clear_mood_event(id)
// if user is affected by tower of babel, we remove the blocked languages
owner.remove_blocked_language(GLOB.all_languages, source = LANGUAGE_BABEL)
owner.remove_all_languages(source = LANGUAGE_BABEL)
if(owner.mind)
REMOVE_TRAIT(owner.mind, TRAIT_TOWER_OF_BABEL, trait_source)
return ..()
// Used by wizard magic and tower of babel event
/datum/status_effect/tower_of_babel/magical
id = "tower_of_babel_magic" // do we need a new id?
duration = STATUS_EFFECT_PERMANENT
trait_source = TRAUMA_TRAIT
/datum/status_effect/tower_of_babel/magical/on_apply()
. = ..()
if(!.)
return
owner.emote("mumble")
owner.playsound_local(get_turf(owner), 'sound/effects/magic/magic_block_mind.ogg', 75, vary = TRUE) // sound of creepy whispers
to_chat(owner, span_reallybig(span_hypnophrase("You feel a magical force affecting your speech patterns!")))
/datum/status_effect/tower_of_babel/magical/on_remove()
. = ..()
if(!.)
return
to_chat(owner, span_reallybig(span_hypnophrase("You feel the magical force affecting your speech patterns fade away...")))
/atom/movable/screen/alert/status_effect/tower_of_babel
name = "Tower of babel"
desc = "You seem to be babbling in a strange language..."
icon_state = "mind_control"