Files
Bubberstation/code/datums/elements/empprotection.dm
MrMelbert e350c50a5c Emp prot tags are more specific, also no longer leak stealthy emp protection (#93211)
## About The Pull Request

Fixes #93199

EMP protection now specifies what it protects

Adds an EMP flag for things which should definitely not indicate they
are EMP proof

## Changelog

🆑 Melbert
fix: EMP proof objects now specify what they protect rather than only
implying it's 100% emp proof
fix: Some objects meant to stealthily be emp proof no longer broadcast
they are emp proof on examine
/🆑
2025-10-02 05:05:57 +02:00

44 lines
1.8 KiB
Plaintext

/datum/element/empprotection
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs
argument_hash_start_idx = 2
var/flags = NONE
/datum/element/empprotection/Attach(datum/target, _flags)
. = ..()
if(. == ELEMENT_INCOMPATIBLE || !isatom(target))
return ELEMENT_INCOMPATIBLE
flags = _flags
RegisterSignal(target, COMSIG_ATOM_PRE_EMP_ACT, PROC_REF(getEmpFlags))
RegisterSignal(target, COMSIG_ATOM_EXAMINE_TAGS, PROC_REF(get_examine_tags))
/datum/element/empprotection/Detach(atom/target)
UnregisterSignal(target, list(COMSIG_ATOM_PRE_EMP_ACT, COMSIG_ATOM_EXAMINE_TAGS))
return ..()
/datum/element/empprotection/proc/getEmpFlags(datum/source, severity)
SIGNAL_HANDLER
return (flags & EMP_PROTECT_ALL)
/datum/element/empprotection/proc/get_examine_tags(atom/source, mob/user, list/examine_list)
SIGNAL_HANDLER
if(flags & EMP_NO_EXAMINE)
return
if(flags & EMP_PROTECT_ALL == EMP_PROTECT_ALL)
examine_list["EMP proof"] = "[source.p_They()] [source.p_are()] unaffected by electromagnetic pulses, and shields [source.p_their()] contents and wiring from them."
return
if(flags & EMP_PROTECT_SELF)
examine_list["EMP resilient"] = "[source.p_They()] [source.p_are()] unaffected by electromagnetic pulses."
if(flags & (EMP_PROTECT_CONTENTS|EMP_PROTECT_WIRES) == (EMP_PROTECT_CONTENTS|EMP_PROTECT_WIRES))
examine_list["EMP blocking"] = "[source.p_They()] protects [source.p_their()] wiring and contents from electromagnetic pulses."
else if(flags & EMP_PROTECT_CONTENTS)
examine_list["EMP blocking"] = "[source.p_They()] protects [source.p_their()] contents from electromagnetic pulses."
else if(flags & EMP_PROTECT_WIRES)
examine_list["EMP blocking"] = "[source.p_They()] protects [source.p_their()] wiring from electromagnetic pulses."