[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:
SkyratBot
2020-10-27 17:38:50 +00:00
committed by GitHub
co-authored by Ghom
parent 7c1d3ea2a3
commit 23ca0b88db
14 changed files with 33 additions and 27 deletions
-13
View File
@@ -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
+20
View File
@@ -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
-1
View File
@@ -38,7 +38,6 @@
// Upgrades bitflag
var/upgrades = 0
var/datum/component/empprotection/emp_component
var/internal_light = TRUE //Whether it can light up when an AI views it
+2 -2
View File
@@ -77,7 +77,7 @@
/obj/machinery/camera/proc/upgradeEmpProof(malf_upgrade, ignore_malf_upgrades)
if(isEmpProof(ignore_malf_upgrades)) //pass a malf upgrade to ignore_malf_upgrades so we can replace the malf module with the normal one
return //that way if someone tries to upgrade an already malf-upgraded camera, it'll just upgrade it to a normal version.
emp_component = AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES | EMP_PROTECT_CONTENTS)
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES | EMP_PROTECT_CONTENTS)
if(malf_upgrade)
assembly.malf_emp_firmware_active = TRUE //don't add parts to drop, update icon, ect. reconstructing it will also retain the upgrade.
assembly.malf_emp_firmware_present = TRUE //so the upgrade is retained after incompatible parts are removed.
@@ -92,7 +92,7 @@
/obj/machinery/camera/proc/removeEmpProof(ignore_malf_upgrades)
if(ignore_malf_upgrades) //don't downgrade it if malf software is forced onto it.
return
QDEL_NULL(emp_component)
RemoveElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES | EMP_PROTECT_CONTENTS)
upgrades &= ~CAMERA_UPGRADE_EMP_PROOF
@@ -708,7 +708,7 @@ DEFINE_BITFIELD(turret_flags, list(
/obj/machinery/porta_turret/syndicate/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
/obj/machinery/porta_turret/syndicate/setup()
return
@@ -814,7 +814,7 @@ DEFINE_BITFIELD(turret_flags, list(
/obj/machinery/porta_turret/centcom_shuttle/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
/obj/machinery/porta_turret/centcom_shuttle/assess_perp(mob/living/carbon/human/perp)
return 0
@@ -104,7 +104,7 @@
/obj/item/radio/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
AddElement(/datum/element/empprotection, EMP_PROTECT_WIRES)
/obj/item/radio/interact(mob/user)
if(unscrewed && !isAI(user))
@@ -18,7 +18,7 @@
/obj/item/grenade/chem_grenade/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
AddElement(/datum/element/empprotection, EMP_PROTECT_WIRES)
/obj/item/grenade/chem_grenade/Initialize()
. = ..()
+1 -1
View File
@@ -26,7 +26,7 @@
/obj/item/grenade/c4/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
AddElement(/datum/element/empprotection, EMP_PROTECT_WIRES)
/obj/item/grenade/c4/Destroy()
qdel(wires)
@@ -193,7 +193,7 @@ Contains:
// ERT suit's gets EMP Protection
/obj/item/clothing/suit/space/hardsuit/ert/Initialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_CONTENTS)
AddElement(/datum/element/empprotection, EMP_PROTECT_CONTENTS)
//ERT Security
/obj/item/clothing/head/helmet/space/hardsuit/ert/sec
@@ -115,7 +115,7 @@
spark_system.attach(src)
wires = new /datum/wires/robot(src)
AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
AddElement(/datum/element/empprotection, EMP_PROTECT_WIRES)
RegisterSignal(src, COMSIG_PROCESS_BORGCHARGER_OCCUPANT, .proc/charge)
robot_modules_background = new()
+1 -1
View File
@@ -338,7 +338,7 @@
/obj/item/stock_parts/cell/emproof/empty/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF)
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF)
/obj/item/stock_parts/cell/emproof/corrupt()
return
+1 -1
View File
@@ -69,7 +69,7 @@
/obj/machinery/power/emitter/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
/obj/machinery/power/emitter/set_anchored(anchorvalue)
. = ..()
@@ -65,7 +65,7 @@ field_generator power level display
/obj/machinery/field/generator/ComponentInitialize()
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
/obj/machinery/field/generator/process()
if(active == FG_ONLINE)
+1 -1
View File
@@ -438,7 +438,6 @@
#include "code\datums\components\earprotection.dm"
#include "code\datums\components\edit_complainer.dm"
#include "code\datums\components\embedded.dm"
#include "code\datums\components\empprotection.dm"
#include "code\datums\components\explodable.dm"
#include "code\datums\components\footstep.dm"
#include "code\datums\components\forensics.dm"
@@ -592,6 +591,7 @@
#include "code\datums\elements\digitalcamo.dm"
#include "code\datums\elements\earhealing.dm"
#include "code\datums\elements\embed.dm"
#include "code\datums\elements\empprotection.dm"
#include "code\datums\elements\firestacker.dm"
#include "code\datums\elements\forced_gravity.dm"
#include "code\datums\elements\light_blocking.dm"