mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
[MIRROR] Converting the EMP protection component into an element. (#1494)
* Converting the EMP protection component into an element. (#54617) * Converting the EMP protection component into an element. Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
/datum/component/empprotection
|
||||
var/flags = NONE
|
||||
|
||||
/datum/component/empprotection/Initialize(_flags)
|
||||
if(!istype(parent, /atom))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
flags = _flags
|
||||
RegisterSignal(parent, list(COMSIG_ATOM_EMP_ACT), .proc/getEmpFlags)
|
||||
|
||||
/datum/component/empprotection/proc/getEmpFlags(datum/source, severity)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
return flags
|
||||
@@ -0,0 +1,20 @@
|
||||
/datum/element/empprotection
|
||||
element_flags = ELEMENT_DETACH | ELEMENT_BESPOKE
|
||||
id_arg_index = 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_EMP_ACT, .proc/getEmpFlags)
|
||||
|
||||
/datum/element/empprotection/Detach(atom/target)
|
||||
UnregisterSignal(target, COMSIG_ATOM_EMP_ACT)
|
||||
return ..()
|
||||
|
||||
/datum/element/empprotection/proc/getEmpFlags(datum/source, severity)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
return flags
|
||||
Reference in New Issue
Block a user