From d8d063edc6f23c9e67d5ef51a6bbb3c26dcdd6ee Mon Sep 17 00:00:00 2001
From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com>
Date: Mon, 4 Dec 2023 20:37:49 +0100
Subject: [PATCH] EMP Refactor & Multi Z-level EMPs (#17781)
* sdfasf
* sdfas
* dsf
---
aurorastation.dme | 4 +
code/__defines/dcs/flags.dm | 9 +-
code/__defines/dcs/signals.dm | 2 +-
.../dcs/signals_atom/signals_atom_x_act.dm | 8 ++
code/__defines/empulse.dm | 2 +
code/__defines/flags.dm | 5 +
code/_helpers/atoms.dm | 57 +++++++++
code/controllers/subsystems/processing/dcs.dm | 40 +++++--
code/datums/elements/_element.dm | 6 +-
code/datums/elements/empprotection.dm | 20 ++++
code/game/atoms.dm | 18 ++-
.../implements/powers/fabricate_clothing.dm | 17 +++
.../tree_manipulation.dm | 2 +-
code/game/gamemodes/technomancer/core_obj.dm | 2 +
.../gamemodes/technomancer/instability.dm | 6 +-
code/game/machinery/Sleeper.dm | 6 +-
code/game/machinery/abstract/abstract.dm | 4 +-
code/game/machinery/anti_bluespace.dm | 6 +-
code/game/machinery/atmoalter/pump.dm | 4 +-
code/game/machinery/atmoalter/scrubber.dm | 4 +-
code/game/machinery/bots/bots.dm | 2 +
code/game/machinery/camera/camera.dm | 2 +
code/game/machinery/cell_charger.dm | 3 +-
code/game/machinery/cloning.dm | 3 +-
code/game/machinery/computer/arcade.dm | 9 +-
code/game/machinery/computer/computer.dm | 6 +-
code/game/machinery/computer/slotmachine.dm | 4 +
code/game/machinery/deployable.dm | 2 +
code/game/machinery/doors/airlock.dm | 7 +-
code/game/machinery/doors/door.dm | 3 +-
code/game/machinery/firealarm.dm | 3 +-
code/game/machinery/flasher.dm | 5 +-
code/game/machinery/igniter.dm | 5 +-
code/game/machinery/lightswitch.dm | 5 +-
code/game/machinery/machinery.dm | 2 +-
code/game/machinery/mass_driver.dm | 4 +-
code/game/machinery/portable_turret.dm | 3 +-
code/game/machinery/recharger.dm | 4 +-
code/game/machinery/rechargestation.dm | 3 +-
code/game/machinery/spaceheater.dm | 5 +-
code/game/machinery/status_display.dm | 5 +-
.../machinery/telecomms/telecommunications.dm | 2 +
code/game/machinery/turret_control.dm | 3 +-
code/game/objects/empulse.dm | 112 +++++++++++++-----
code/game/objects/items/defib.dm | 13 +-
code/game/objects/items/devices/auto_cpr.dm | 2 +
code/game/objects/items/devices/flash.dm | 3 +-
.../objects/items/devices/laserpointer.dm | 2 +-
.../items/devices/lighting/flashlight.dm | 3 +-
code/game/objects/items/devices/paicard.dm | 2 +
code/game/objects/items/devices/powersink.dm | 4 +-
.../objects/items/devices/radio/beacon.dm | 2 +
.../game/objects/items/devices/radio/radio.dm | 3 +-
.../objects/items/devices/radio_jammer.dm | 4 +-
code/game/objects/items/devices/t_scanner.dm | 4 +-
code/game/objects/items/skrell.dm | 2 +
.../objects/items/weapons/cloaking_device.dm | 3 +-
.../weapons/implants/implants/aggression.dm | 4 +-
.../weapons/implants/implants/anti-augment.dm | 9 +-
.../items/weapons/implants/implants/chem.dm | 7 +-
.../weapons/implants/implants/circuit.dm | 2 +
.../weapons/implants/implants/death_alarm.dm | 5 +-
.../weapons/implants/implants/explosive.dm | 14 +--
.../weapons/implants/implants/mindshield.dm | 5 +-
.../weapons/implants/implants/tracking.dm | 6 +-
.../objects/items/weapons/storage/storage.dm | 3 +-
code/game/objects/items/weapons/stunbaton.dm | 3 +-
code/game/objects/items/weapons/tether.dm | 4 +-
.../closets/secure/secure_closets.dm | 4 +-
code/game/objects/structures/flags_banners.dm | 3 +-
code/modules/clothing/chameleon.dm | 18 +++
code/modules/clothing/clothing.dm | 3 +-
code/modules/clothing/clothing_accessories.dm | 3 +-
code/modules/clothing/factions/elyra.dm | 4 +-
code/modules/clothing/glasses/glasses.dm | 3 +-
code/modules/clothing/head/helmet.dm | 6 +-
code/modules/clothing/spacesuits/rig/rig.dm | 10 +-
code/modules/clothing/suits/armor.dm | 6 +-
code/modules/clothing/suits/storage.dm | 3 +-
.../clothing/under/accessories/holster.dm | 3 +-
.../clothing/under/accessories/storage.dm | 3 +-
code/modules/clothing/wrists/watches.dm | 3 +-
code/modules/custom_ka/core.dm | 6 +-
code/modules/events/comms_blackout.dm | 2 +-
.../modules/events/communications_blackout.dm | 2 +-
.../heavy_vehicle/components/_components.dm | 4 +-
code/modules/heavy_vehicle/mech_damage.dm | 18 +--
.../integrated_electronics/core/assemblies.dm | 3 +-
.../core/integrated_circuit.dm | 2 +
code/modules/mining/mine_items.dm | 17 ++-
code/modules/mining/ore_detector.dm | 4 +-
code/modules/mob/living/bot/bot.dm | 5 +-
code/modules/mob/living/carbon/brain/MMI.dm | 17 ++-
.../mob/living/carbon/brain/posibrain.dm | 17 ++-
code/modules/mob/living/carbon/human/human.dm | 13 +-
.../mob/living/carbon/human/human_defense.dm | 4 +-
code/modules/mob/living/carbon/slime/slime.dm | 3 +-
code/modules/mob/living/living_defense.dm | 3 +-
code/modules/mob/living/silicon/ai/ai.dm | 6 +-
code/modules/mob/living/silicon/pai/pai.dm | 4 +-
.../mob/living/silicon/robot/inventory.dm | 3 +-
.../mob/living/silicon/robot/robot_damage.dm | 3 +-
.../mob/living/silicon/robot/robot_modules.dm | 4 +-
code/modules/mob/living/silicon/silicon.dm | 7 +-
.../simple_animal/friendly/schlorrgo.dm | 16 +--
.../hostile/commanded/guard_dog.dm | 8 +-
.../simple_animal/hostile/giant_spider.dm | 2 +-
.../simple_animal/hostile/hivebots/hivebot.dm | 2 +
.../hostile/hivebots/hivebot_beacon.dm | 4 +-
.../hostile/hivebots/hivebot_harvester.dm | 2 +
.../simple_animal/hostile/icarus_drone.dm | 2 +
.../simple_animal/hostile/viscerator.dm | 4 +-
.../mob/living/simple_animal/simple_animal.dm | 10 +-
.../computers/modular_computer/damage.dm | 4 +-
code/modules/organs/organ.dm | 10 +-
code/modules/organs/subtypes/augment.dm | 13 +-
code/modules/organs/subtypes/autakh.dm | 6 +-
code/modules/organs/subtypes/machine.dm | 3 +-
.../ship_weaponry/weaponry/leviathan.dm | 4 +
.../overmap/ships/computers/sensors.dm | 3 +
code/modules/power/antimatter/control.dm | 7 +-
code/modules/power/antimatter/shielding.dm | 4 +-
code/modules/power/apc.dm | 3 +-
code/modules/power/cell.dm | 19 ++-
code/modules/power/fusion/core/core_field.dm | 3 +-
code/modules/power/portgen.dm | 9 +-
code/modules/power/singularity/emitter.dm | 4 +-
.../power/singularity/field_generator.dm | 4 +-
code/modules/power/smes.dm | 7 +-
code/modules/power/tesla/energy_ball.dm | 2 +-
.../modules/projectiles/ammunition/bullets.dm | 6 +-
code/modules/projectiles/guns/energy.dm | 5 +-
.../projectiles/guns/energy/nuclear.dm | 2 +
code/modules/projectiles/guns/energy/rifle.dm | 2 +-
.../modules/projectiles/projectile/special.dm | 4 +-
code/modules/research/rdconsole.dm | 6 +-
code/modules/research/server.dm | 3 +-
code/modules/shieldgen/emergency_shield.dm | 13 +-
code/modules/shuttles/shuttle_console.dm | 4 +-
.../spell_system/artifacts/items/poppet.dm | 2 +
code/modules/telesci/gps.dm | 2 +
code/modules/vehicles/vehicle.dm | 3 +
html/changelogs/fluffyghost-emprefactor.yml | 57 +++++++++
143 files changed, 744 insertions(+), 272 deletions(-)
create mode 100644 code/__defines/dcs/signals_atom/signals_atom_x_act.dm
create mode 100644 code/__defines/empulse.dm
create mode 100644 code/_helpers/atoms.dm
create mode 100644 code/datums/elements/empprotection.dm
create mode 100644 html/changelogs/fluffyghost-emprefactor.yml
diff --git a/aurorastation.dme b/aurorastation.dme
index ca91f62a92e..ad0b27a79f9 100644
--- a/aurorastation.dme
+++ b/aurorastation.dme
@@ -47,6 +47,7 @@
#include "code\__defines\dview.dm"
#include "code\__defines\economy.dm"
#include "code\__defines\emitter.dm"
+#include "code\__defines\empulse.dm"
#include "code\__defines\evacuation.dm"
#include "code\__defines\feedback.dm"
#include "code\__defines\flags.dm"
@@ -125,12 +126,14 @@
#include "code\__defines\dcs\flags.dm"
#include "code\__defines\dcs\helpers.dm"
#include "code\__defines\dcs\signals.dm"
+#include "code\__defines\dcs\signals_atom\signals_atom_x_act.dm"
#include "code\_global_vars\edible.dm"
#include "code\_helpers\_global_objects.dm"
#include "code\_helpers\_string_lists.dm"
#include "code\_helpers\area_movement.dm"
#include "code\_helpers\areas.dm"
#include "code\_helpers\atmospherics.dm"
+#include "code\_helpers\atoms.dm"
#include "code\_helpers\data_structures.dm"
#include "code\_helpers\dll_call.dm"
#include "code\_helpers\files.dm"
@@ -365,6 +368,7 @@
#include "code\datums\discord\bot.dm"
#include "code\datums\discord\webhook.dm"
#include "code\datums\elements\_element.dm"
+#include "code\datums\elements\empprotection.dm"
#include "code\datums\ert\nanotrasen.dm"
#include "code\datums\ert\outsider.dm"
#include "code\datums\ert\responseteam.dm"
diff --git a/code/__defines/dcs/flags.dm b/code/__defines/dcs/flags.dm
index 22640a6c603..9b935b3a14d 100644
--- a/code/__defines/dcs/flags.dm
+++ b/code/__defines/dcs/flags.dm
@@ -9,11 +9,14 @@
#define ELEMENT_INCOMPATIBLE 1
// /datum/element flags
-/// Causes the detach proc to be called when the host object is being deleted
-#define ELEMENT_DETACH (1 << 0)
+/// Causes the detach proc to be called when the host object is being deleted.
+/// Should only be used if you need to perform cleanup not related to the host object.
+/// You do not need this if you are only unregistering signals, for instance.
+/// You would need it if you are doing something like removing the target from a processing list.
+#define ELEMENT_DETACH_ON_HOST_DESTROY (1 << 0)
/**
- * Only elements created with the same arguments given after `id_arg_index` share an element instance
+ * Only elements created with the same arguments given after `argument_hash_start_idx` share an element instance
* The arguments are the same when the text and number values are the same and all other values have the same ref
*/
#define ELEMENT_BESPOKE (1 << 1)
diff --git a/code/__defines/dcs/signals.dm b/code/__defines/dcs/signals.dm
index 26ea087ecce..2877369cdf0 100644
--- a/code/__defines/dcs/signals.dm
+++ b/code/__defines/dcs/signals.dm
@@ -26,7 +26,7 @@
/// fires on the target datum when an element is attached to it (/datum/element)
#define COMSIG_ELEMENT_ATTACH "element_attach"
/// fires on the target datum when an element is attached to it (/datum/element)
-#define COMSIG_ELEMENT_DETACH "element_detach"
+#define COMSIG_ELEMENT_DETACH_ON_HOST_DESTROY "ELEMENT_DETACH_ON_HOST_DESTROY"
// /atom signals
diff --git a/code/__defines/dcs/signals_atom/signals_atom_x_act.dm b/code/__defines/dcs/signals_atom/signals_atom_x_act.dm
new file mode 100644
index 00000000000..9d25a3a818a
--- /dev/null
+++ b/code/__defines/dcs/signals_atom/signals_atom_x_act.dm
@@ -0,0 +1,8 @@
+// Atom x_act() procs signals. Format:
+// When the signal is called: (signal arguments)
+// All signals send the source datum of the signal as the first argument
+
+///from base of atom/emp_act(): (severity). return EMP protection flags
+#define COMSIG_ATOM_PRE_EMP_ACT "atom_emp_act"
+///from base of atom/emp_act(): (severity, protection)
+#define COMSIG_ATOM_EMP_ACT "atom_emp_act"
diff --git a/code/__defines/empulse.dm b/code/__defines/empulse.dm
new file mode 100644
index 00000000000..bc97031ad8a
--- /dev/null
+++ b/code/__defines/empulse.dm
@@ -0,0 +1,2 @@
+#define EMP_HEAVY 1
+#define EMP_LIGHT 2
diff --git a/code/__defines/flags.dm b/code/__defines/flags.dm
index a1b9a03c4d2..556c9ffc736 100644
--- a/code/__defines/flags.dm
+++ b/code/__defines/flags.dm
@@ -24,6 +24,11 @@ var/list/mimic_defines = list(
"ZM_NO_OCCLUDE"
)
+//EMP protection
+#define EMP_PROTECT_SELF (1<<0)
+#define EMP_PROTECT_CONTENTS (1<<1)
+#define EMP_PROTECT_WIRES (1<<2)
+
// Flags bitmask
/// If a dense atom (potentially) only blocks movements from a given direction, i.e. window panes
diff --git a/code/_helpers/atoms.dm b/code/_helpers/atoms.dm
new file mode 100644
index 00000000000..7e1de4e88b0
--- /dev/null
+++ b/code/_helpers/atoms.dm
@@ -0,0 +1,57 @@
+///similar function to range(), but with no limitations on the distance; will search spiralling outwards from the center
+///NOT Z-Level aware
+/proc/spiral_range(dist = 0, center = usr, orange = FALSE)
+ var/list/atom_list = list()
+ var/turf/t_center = get_turf(center)
+ if(!t_center)
+ return list()
+
+ if(!orange)
+ atom_list += t_center
+ atom_list += t_center.contents
+
+ if(!dist)
+ return atom_list
+
+
+ var/turf/checked_turf
+ var/y
+ var/x
+ var/c_dist = 1
+
+
+ while( c_dist <= dist )
+ y = t_center.y + c_dist
+ x = t_center.x - c_dist + 1
+ for(x in x to t_center.x + c_dist)
+ checked_turf = locate(x, y, t_center.z)
+ if(checked_turf)
+ atom_list += checked_turf
+ atom_list += checked_turf.contents
+
+ y = t_center.y + c_dist - 1
+ x = t_center.x + c_dist
+ for(y in t_center.y - c_dist to y)
+ checked_turf = locate(x, y, t_center.z)
+ if(checked_turf)
+ atom_list += checked_turf
+ atom_list += checked_turf.contents
+
+ y = t_center.y - c_dist
+ x = t_center.x + c_dist - 1
+ for(x in t_center.x - c_dist to x)
+ checked_turf = locate(x, y, t_center.z)
+ if(checked_turf)
+ atom_list += checked_turf
+ atom_list += checked_turf.contents
+
+ y = t_center.y - c_dist + 1
+ x = t_center.x - c_dist
+ for(y in y to t_center.y + c_dist)
+ checked_turf = locate(x, y, t_center.z)
+ if(checked_turf)
+ atom_list += checked_turf
+ atom_list += checked_turf.contents
+ c_dist++
+
+ return atom_list
diff --git a/code/controllers/subsystems/processing/dcs.dm b/code/controllers/subsystems/processing/dcs.dm
index 37dbe29bacd..0b4f2ef4d12 100644
--- a/code/controllers/subsystems/processing/dcs.dm
+++ b/code/controllers/subsystems/processing/dcs.dm
@@ -22,6 +22,8 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
return
. = elements_by_type[element_id] = new eletype
+///Temporary compatibility to not rewrite the proc, it is being ported already in another PR
+#define REF(k) ref(##k)
/****
* Generates an id for bespoke elements when given the argument list
* Generating the id here is a bit complex because we need to support named arguments
@@ -31,23 +33,37 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
/datum/controller/subsystem/processing/dcs/proc/GetIdFromArguments(list/arguments)
var/datum/element/eletype = arguments[1]
var/list/fullid = list("[eletype]")
- var/list/named_arguments = list()
- for(var/i in initial(eletype.id_arg_index) to length(arguments))
+ var/list/named_arguments
+ for(var/i in initial(eletype.argument_hash_start_idx) to length(arguments))
var/key = arguments[i]
- var/value
+
if(istext(key))
- value = arguments[key]
- if(!(istext(key) || isnum(key)))
- key = ref(key)
- key = "[key]" // Key is stringified so numbers dont break things
- if(!isnull(value))
- if(!(istext(value) || isnum(value)))
- value = ref(value)
- named_arguments["[key]"] = value
+ var/value = arguments[key]
+ if (isnull(value))
+ fullid += key
+ else
+ if (!istext(value) && !isnum(value))
+ //One day we will complete the port with everything. For now, this pieces remains commented as a reference.
+ //Also hello, programmer 9 years from now that is reading this.
+ // if(PERFORM_ALL_TESTS(dcs_check_list_arguments) && islist(value))
+ // add_to_arguments_that_are_lists(value, eletype)
+ value = REF(value)
+
+ if (!named_arguments)
+ named_arguments = list()
+
+ named_arguments[key] = value
+ continue
+
+ if (isnum(key))
+ fullid += key
else
- fullid += "[key]"
+ // if(PERFORM_ALL_TESTS(dcs_check_list_arguments) && islist(key))
+ // add_to_arguments_that_are_lists(key, eletype)
+ fullid += REF(key)
if(length(named_arguments))
named_arguments = sortList(named_arguments)
fullid += named_arguments
return list2params(fullid)
+#undef REF
diff --git a/code/datums/elements/_element.dm b/code/datums/elements/_element.dm
index e2ebd4ad423..e01683640cd 100644
--- a/code/datums/elements/_element.dm
+++ b/code/datums/elements/_element.dm
@@ -14,7 +14,7 @@
*
* This is infinity so you must explicitly set this
*/
- var/id_arg_index = INFINITY
+ var/argument_hash_start_idx = INFINITY
/// Activates the functionality defined by the element on the given target datum
/datum/element/proc/Attach(datum/target)
@@ -22,12 +22,12 @@
if(type == /datum/element)
return ELEMENT_INCOMPATIBLE
SEND_SIGNAL(target, COMSIG_ELEMENT_ATTACH, src)
- if(element_flags & ELEMENT_DETACH)
+ if(element_flags & ELEMENT_DETACH_ON_HOST_DESTROY)
RegisterSignal(target, COMSIG_PARENT_QDELETING, PROC_REF(Detach), override = TRUE)
/// Deactivates the functionality defines by the element on the given datum
/datum/element/proc/Detach(datum/source, force)
- SEND_SIGNAL(source, COMSIG_ELEMENT_DETACH, src)
+ SEND_SIGNAL(source, COMSIG_ELEMENT_DETACH_ON_HOST_DESTROY, src)
SHOULD_CALL_PARENT(1)
UnregisterSignal(source, COMSIG_PARENT_QDELETING)
diff --git a/code/datums/elements/empprotection.dm b/code/datums/elements/empprotection.dm
new file mode 100644
index 00000000000..2955551fd6d
--- /dev/null
+++ b/code/datums/elements/empprotection.dm
@@ -0,0 +1,20 @@
+/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))
+
+/datum/element/empprotection/Detach(atom/target)
+ UnregisterSignal(target, COMSIG_ATOM_PRE_EMP_ACT)
+ return ..()
+
+/datum/element/empprotection/proc/getEmpFlags(datum/source, severity)
+ SIGNAL_HANDLER
+
+ return flags
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index b8802c08674..971db6cb3c7 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -119,8 +119,24 @@
/atom/proc/HasProximity(atom/movable/AM as mob|obj)
return
+/**
+ * React to an EMP of the given severity
+ *
+ * Default behaviour is to send the [COMSIG_ATOM_PRE_EMP_ACT] and [COMSIG_ATOM_EMP_ACT] signal
+ *
+ * * severity - The severity of the EMP pulse (how strong it is), defines in `code\__defines\empulse.dm`
+ *
+ * Returns the protection value
+ */
/atom/proc/emp_act(var/severity)
- return
+ SHOULD_CALL_PARENT(TRUE)
+
+ var/protection = SEND_SIGNAL(src, COMSIG_ATOM_PRE_EMP_ACT, severity)
+
+ RETURN_TYPE(protection)
+
+ SEND_SIGNAL(src, COMSIG_ATOM_EMP_ACT, severity, protection)
+ return protection // Pass the protection value collected here upwards
/atom/proc/flash_act(intensity = FLASH_PROTECTION_MODERATE, override_blindness_check = FALSE, affect_silicon = FALSE, ignore_inherent = FALSE, type = /obj/screen/fullscreen/flash, length = 2.5 SECONDS)
return
diff --git a/code/game/gamemodes/changeling/implements/powers/fabricate_clothing.dm b/code/game/gamemodes/changeling/implements/powers/fabricate_clothing.dm
index 264765c5053..f960d480de7 100644
--- a/code/game/gamemodes/changeling/implements/powers/fabricate_clothing.dm
+++ b/code/game/gamemodes/changeling/implements/powers/fabricate_clothing.dm
@@ -74,6 +74,7 @@
QDEL_IN(src, 1)
/obj/item/clothing/under/chameleon/changeling/emp_act(severity) //As these are purely organic, EMP does nothing to them.
+ . = ..()
return
/obj/item/clothing/under/chameleon/changeling/verb/shred() //Remove individual pieces if needed.
@@ -101,6 +102,8 @@
QDEL_IN(src, 1)
/obj/item/clothing/head/chameleon/changeling/emp_act(severity)
+ . = ..()
+
return
/obj/item/clothing/head/chameleon/changeling/verb/shred() //The copypasta is real.
@@ -127,6 +130,8 @@
QDEL_IN(src, 1)
/obj/item/clothing/suit/chameleon/changeling/emp_act(severity)
+ . = ..()
+
return
/obj/item/clothing/suit/chameleon/changeling/verb/shred()
@@ -153,6 +158,8 @@
QDEL_IN(src, 1)
/obj/item/clothing/shoes/chameleon/changeling/emp_act()
+ . = ..()
+
return
/obj/item/clothing/shoes/chameleon/changeling/verb/shred()
@@ -179,6 +186,8 @@
QDEL_IN(src, 1)
/obj/item/storage/backpack/chameleon/changeling/emp_act()
+ . = ..()
+
return
/obj/item/storage/backpack/chameleon/changeling/verb/shred()
@@ -208,6 +217,8 @@
QDEL_IN(src, 1)
/obj/item/clothing/gloves/chameleon/changeling/emp_act()
+ . = ..()
+
return
/obj/item/clothing/gloves/chameleon/changeling/verb/shred()
@@ -235,6 +246,8 @@
QDEL_IN(src, 1)
/obj/item/clothing/mask/chameleon/changeling/emp_act()
+ . = ..()
+
return
/obj/item/clothing/mask/chameleon/changeling/verb/shred()
@@ -262,6 +275,8 @@
/obj/item/clothing/glasses/chameleon/changeling/emp_act()
+ . = ..()
+
return
/obj/item/clothing/glasses/chameleon/changeling/verb/shred()
@@ -288,6 +303,8 @@
QDEL_IN(src, 1)
/obj/item/storage/belt/chameleon/changeling/emp_act()
+ . = ..()
+
return
/obj/item/storage/belt/chameleon/changeling/verb/shred()
diff --git a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm
index 5f951f4115e..311ce290c39 100644
--- a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm
+++ b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm
@@ -215,7 +215,7 @@
if(temp_apc && temp_apc.terminal && temp_apc.terminal.powernet)
temp_apc.terminal.powernet.trigger_warning(50) // Long alarm
if(temp_apc)
- temp_apc.emp_act(3) // Such power surges are not good for APC electronics/cell in general.
+ temp_apc.emp_act(EMP_LIGHT) // Such power surges are not good for APC electronics/cell in general.
if(prob(explosion_intensity))
temp_apc.set_broken()
diff --git a/code/game/gamemodes/technomancer/core_obj.dm b/code/game/gamemodes/technomancer/core_obj.dm
index dc3b553ac43..aaecc1b9314 100644
--- a/code/game/gamemodes/technomancer/core_obj.dm
+++ b/code/game/gamemodes/technomancer/core_obj.dm
@@ -172,6 +172,8 @@
update_held_icon()
/obj/item/technomancer_core/emp_act()
+ . = ..()
+
set_appearance_to(type)
// This is what is clicked on to place a spell in the user's hands.
diff --git a/code/game/gamemodes/technomancer/instability.dm b/code/game/gamemodes/technomancer/instability.dm
index b1bfeccf8c9..64a4434ea95 100644
--- a/code/game/gamemodes/technomancer/instability.dm
+++ b/code/game/gamemodes/technomancer/instability.dm
@@ -156,7 +156,7 @@
safe_blink(src, range = 6)
to_chat(src, "You're teleported against your will!")
if(4)
- emp_act(3)
+ emp_act(EMP_LIGHT)
if(51 to 100) //Severe
rng = rand(0,3)
@@ -164,7 +164,7 @@
if(0)
electrocute_act(instability * 0.5, "extremely unstable energies", 0.75)
if(1)
- emp_act(2)
+ emp_act(EMP_LIGHT)
if(2)
adjustFireLoss(instability * 0.3) //30 burn @ 100 instability
to_chat(src, "Your chassis alerts you to extreme overheating from an unknown external force!")
@@ -178,7 +178,7 @@
if(0)
electrocute_act(instability, "extremely unstable energies", 0.75)
if(1)
- emp_act(1)
+ emp_act(EMP_HEAVY)
if(2)
adjustFireLoss(instability * 0.4) //40 burn @ 100 instability
to_chat(src, "Your chassis alerts you to extreme overheating from an unknown external force!")
diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm
index b8e42dc784c..6f60b33ea30 100644
--- a/code/game/machinery/Sleeper.dm
+++ b/code/game/machinery/Sleeper.dm
@@ -291,18 +291,18 @@
if(user == occupant)
go_out()
-/obj/machinery/sleeper/emp_act(var/severity)
+/obj/machinery/sleeper/emp_act(severity)
+ . = ..()
+
if(filtering)
toggle_filter()
if(stat & (BROKEN|NOPOWER))
- ..(severity)
return
if(occupant)
go_out()
- ..(severity)
/obj/machinery/sleeper/proc/toggle_filter()
if(!occupant || !beaker)
diff --git a/code/game/machinery/abstract/abstract.dm b/code/game/machinery/abstract/abstract.dm
index 5f246172b59..206aee82a76 100644
--- a/code/game/machinery/abstract/abstract.dm
+++ b/code/game/machinery/abstract/abstract.dm
@@ -20,7 +20,9 @@
return
/obj/machinery/abstract/emp_act(severity)
- return // No EMPing these.
+ . = ..()
+
+ return
/obj/machinery/abstract/ex_act(severity)
return
diff --git a/code/game/machinery/anti_bluespace.dm b/code/game/machinery/anti_bluespace.dm
index f7d50eb7253..5867b87dcf5 100644
--- a/code/game/machinery/anti_bluespace.dm
+++ b/code/game/machinery/anti_bluespace.dm
@@ -36,7 +36,7 @@ var/global/list/bluespace_inhibitors
/obj/machinery/anti_bluespace/emag_act()
spark(src, 3)
playsound(src, /singleton/sound_category/spark_sound, 50, 1)
- emp_act(1)
+ emp_act(EMP_HEAVY)
return TRUE
/obj/machinery/anti_bluespace/process()
@@ -99,9 +99,11 @@ var/global/list/bluespace_inhibitors
return
/obj/machinery/anti_bluespace/emp_act(severity)
+ . = ..()
+
//THIS WILL BE FUN.
if(stat & BROKEN)
- return 0
+ return
var/area/temp_area = get_area(src)
if(temp_area)
diff --git a/code/game/machinery/atmoalter/pump.dm b/code/game/machinery/atmoalter/pump.dm
index 04879b364b8..e092c3d84e1 100644
--- a/code/game/machinery/atmoalter/pump.dm
+++ b/code/game/machinery/atmoalter/pump.dm
@@ -49,8 +49,9 @@
return
/obj/machinery/portable_atmospherics/powered/pump/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
- ..(severity)
return
if(prob(50/severity))
@@ -63,7 +64,6 @@
update_icon()
SStgui.update_uis(src)
- ..(severity)
/obj/machinery/portable_atmospherics/powered/pump/process()
..()
diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm
index 468c2acb62b..c073a191491 100644
--- a/code/game/machinery/atmoalter/scrubber.dm
+++ b/code/game/machinery/atmoalter/scrubber.dm
@@ -28,15 +28,15 @@
cell = new/obj/item/cell/apc(src)
/obj/machinery/portable_atmospherics/powered/scrubber/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
- ..(severity)
return
if(prob(50/severity))
on = !on
update_icon()
- ..(severity)
/obj/machinery/portable_atmospherics/powered/scrubber/update_icon()
cut_overlays()
diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm
index d2adf73d6dd..fea4529419a 100644
--- a/code/game/machinery/bots/bots.dm
+++ b/code/game/machinery/bots/bots.dm
@@ -119,6 +119,8 @@
return
/obj/machinery/bot/emp_act(severity)
+ . = ..()
+
var/was_on = on
stat |= EMPED
var/obj/effect/overlay/pulse2 = new /obj/effect/overlay(src.loc)
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index cefc08631e3..0ea22ab0ec3 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -92,6 +92,8 @@
return
/obj/machinery/camera/emp_act(severity)
+ . = ..()
+
if(!isEmpProof() && prob(100/severity))
if(!affected_by_emp_until || (world.time < affected_by_emp_until))
affected_by_emp_until = max(affected_by_emp_until, world.time + (90 SECONDS / severity))
diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm
index d189e9da19d..036e0a18cc4 100644
--- a/code/game/machinery/cell_charger.dm
+++ b/code/game/machinery/cell_charger.dm
@@ -103,11 +103,12 @@
update_icon()
/obj/machinery/cell_charger/emp_act(severity)
+ . = ..()
+
if(INOPERABLE(src))
return
if(charging)
charging.emp_act(severity)
- ..(severity)
/obj/machinery/cell_charger/power_change()
if(..() && charging && anchored)
diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm
index 511324e3c82..ab37a064ff6 100644
--- a/code/game/machinery/cloning.dm
+++ b/code/game/machinery/cloning.dm
@@ -340,9 +340,10 @@
return
/obj/machinery/clonepod/emp_act(severity)
+ . = ..()
+
if(prob(100/severity))
malfunction()
- ..()
/obj/machinery/clonepod/ex_act(severity)
switch(severity)
diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm
index 928cdab6b1d..1eb0fdfd885 100644
--- a/code/game/machinery/computer/arcade.dm
+++ b/code/game/machinery/computer/arcade.dm
@@ -31,19 +31,20 @@
return src.attack_hand(user)
/obj/machinery/computer/arcade/emp_act(severity)
+ . = ..()
+
if(stat & (NOPOWER|BROKEN))
- ..(severity)
return
+
var/num_of_prizes = 0
switch(severity)
- if(1)
+ if(EMP_HEAVY)
num_of_prizes = rand(1,4)
- if(2)
+ if(EMP_LIGHT)
num_of_prizes = rand(0,2)
for(num_of_prizes; num_of_prizes > 0; num_of_prizes--)
new prize(src.loc)
- ..(severity)
///////////////////
// BATTLE HERE //
diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm
index 9f5d838cbd3..3e5c144926c 100644
--- a/code/game/machinery/computer/computer.dm
+++ b/code/game/machinery/computer/computer.dm
@@ -35,8 +35,10 @@
return
/obj/machinery/computer/emp_act(severity)
- if(prob(20/severity)) set_broken()
- ..()
+ . = ..()
+
+ if(prob(20/severity))
+ set_broken()
/obj/machinery/computer/ex_act(severity)
diff --git a/code/game/machinery/computer/slotmachine.dm b/code/game/machinery/computer/slotmachine.dm
index d35b8869517..977924edacf 100644
--- a/code/game/machinery/computer/slotmachine.dm
+++ b/code/game/machinery/computer/slotmachine.dm
@@ -178,12 +178,16 @@
/obj/machinery/computer/slot_machine/emp_act(severity)
. = ..()
+
if(stat & (NOPOWER|BROKEN))
return
+
if(prob(15 * severity))
return
+
if(prob(1)) // :^)
emagged = TRUE
+
var/severity_ascending = 4 - severity
money = max(rand(money - (200 * severity_ascending), money + (200 * severity_ascending)), 0)
balance = max(rand(balance - (50 * severity_ascending), balance + (50 * severity_ascending)), 0)
diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm
index 292c3bdb9ab..672946fcfe7 100644
--- a/code/game/machinery/deployable.dm
+++ b/code/game/machinery/deployable.dm
@@ -254,6 +254,8 @@ for reference:
return
/obj/machinery/deployable/barrier/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
return
if(prob(50/severity))
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 2576748c3b3..a089f57f31b 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -407,6 +407,8 @@
return
/obj/machinery/door/airlock/centcom/emp_act()
+ . = ..()
+
return
/obj/machinery/door/airlock/glass_centcom
@@ -445,6 +447,8 @@
return
/obj/machinery/door/airlock/glass_centcom/emp_act()
+ . = ..()
+
return
/obj/machinery/door/airlock/proc/paint_airlock(paint_color)
@@ -2017,11 +2021,12 @@ About the new airlock wires panel:
electronics.one_access = 1
/obj/machinery/door/airlock/emp_act(var/severity)
+ . = ..()
+
if(prob(40/severity))
var/duration = SecondsToTicks(30 / severity)
if(electrified_until > -1 && (duration + world.time) > electrified_until)
electrify(duration)
- ..()
/obj/machinery/door/airlock/power_change() //putting this is obj/machinery/door itself makes non-airlock doors turn invisible for some reason
..()
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index 5402cb9bb97..55e827706e0 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -421,9 +421,10 @@
/obj/machinery/door/emp_act(severity)
+ . = ..()
+
if(prob(20/severity) && (istype(src,/obj/machinery/door/airlock) || istype(src,/obj/machinery/door/window)) )
open()
- ..()
/obj/machinery/door/ex_act(severity)
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index 3057a5fb151..689be996ed3 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -65,9 +65,10 @@
return src.alarm()
/obj/machinery/firealarm/emp_act(severity)
+ . = ..()
+
if(prob(50/severity))
alarm(rand(30/severity, 60/severity))
- ..()
/obj/machinery/firealarm/attackby(obj/item/W as obj, mob/user as mob)
if(!istype(W, /obj/item/forensics))
diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm
index 37aac89db1e..e16fbd95512 100644
--- a/code/game/machinery/flasher.dm
+++ b/code/game/machinery/flasher.dm
@@ -92,12 +92,13 @@
O.Weaken(flash_time)
/obj/machinery/flasher/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
- ..(severity)
return
+
if(prob(75/severity))
flash()
- ..(severity)
/obj/machinery/flasher/portable/HasProximity(atom/movable/AM as mob|obj)
if ((src.disable) || (src.last_flash && world.time < src.last_flash + 150))
diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm
index b59cd053ccf..c55207855fd 100755
--- a/code/game/machinery/igniter.dm
+++ b/code/game/machinery/igniter.dm
@@ -137,11 +137,12 @@
return 1
/obj/machinery/sparker/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
- ..(severity)
return
+
ignite()
- ..(severity)
/obj/machinery/button/ignition
name = "ignition switch"
diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm
index 2389af9c2d7..c59b93362da 100644
--- a/code/game/machinery/lightswitch.dm
+++ b/code/game/machinery/lightswitch.dm
@@ -73,8 +73,9 @@
update_icon()
/obj/machinery/light_switch/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
- ..(severity)
return
+
power_change()
- ..(severity)
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index a285a9135e8..2f4c6843eba 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -186,6 +186,7 @@ Class Procs:
return PROCESS_KILL
/obj/machinery/emp_act(severity)
+ . = ..()
if(use_power && stat == 0)
use_power_oneoff(7500/severity)
@@ -197,7 +198,6 @@ Class Procs:
pulse2.set_dir(pick(cardinal))
QDEL_IN(pulse2, 10)
- ..()
/obj/machinery/ex_act(severity)
switch(severity)
diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm
index a410f0ae755..2f80fb16619 100644
--- a/code/game/machinery/mass_driver.dm
+++ b/code/game/machinery/mass_driver.dm
@@ -47,10 +47,12 @@
return
/obj/machinery/mass_driver/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
return
+
drive()
- ..(severity)
/obj/machinery/mass_driver/attackby(obj/item/W, mob/user)
diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm
index 3f8aea254d9..cc3ec4074ab 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/portable_turret.dm
@@ -459,6 +459,8 @@
take_damage(damage)
/obj/machinery/porta_turret/emp_act(severity)
+ . = ..()
+
if(enabled)
//if the turret is on, the EMP no matter how severe disables the turret for a while
//and scrambles its settings, with a slight chance of having an emag effect
@@ -473,7 +475,6 @@
enabled = FALSE
addtimer(CALLBACK(src, PROC_REF(post_emp_act)), rand(60, 600))
- ..()
/obj/machinery/porta_turret/proc/post_emp_act()
enabled = TRUE
diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm
index ea9aa002731..a656b4bbd14 100644
--- a/code/game/machinery/recharger.dm
+++ b/code/game/machinery/recharger.dm
@@ -150,8 +150,9 @@
charging = null
/obj/machinery/recharger/emp_act(severity)
+ . = ..()
+
if(stat & (NOPOWER|BROKEN) || !anchored)
- ..(severity)
return
if(istype(charging, /obj/item/gun/energy))
@@ -163,7 +164,6 @@
var/obj/item/melee/baton/B = charging
if(B.bcell)
B.bcell.charge = 0
- ..(severity)
/obj/machinery/recharger/update_icon() //we have an update_icon() in addition to the stuff in process to make it feel a tiny bit snappier.
if(charging)
diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm
index da134ed00b6..39dfcdbbda2 100644
--- a/code/game/machinery/rechargestation.dm
+++ b/code/game/machinery/rechargestation.dm
@@ -125,12 +125,13 @@
go_out()
/obj/machinery/recharge_station/emp_act(severity)
+ . = ..()
+
if(occupant)
occupant.emp_act(severity)
go_out()
if(cell)
cell.emp_act(severity)
- ..(severity)
/obj/machinery/recharge_station/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(!occupant)
diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm
index 7abcb35b9eb..93dbcded365 100644
--- a/code/game/machinery/spaceheater.dm
+++ b/code/game/machinery/spaceheater.dm
@@ -52,12 +52,13 @@
return FALSE
/obj/machinery/space_heater/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
- ..(severity)
return
+
if(cell)
cell.emp_act(severity)
- ..(severity)
/obj/machinery/space_heater/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/cell))
diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm
index 00acf1aefe8..b7785ff4318 100644
--- a/code/game/machinery/status_display.dm
+++ b/code/game/machinery/status_display.dm
@@ -69,11 +69,12 @@
update()
/obj/machinery/status_display/emp_act(severity)
+ . = ..()
+
if(stat & (BROKEN|NOPOWER))
- ..(severity)
return
+
set_picture("ai_bsod")
- ..(severity)
// set what is displayed
/obj/machinery/status_display/proc/update()
diff --git a/code/game/machinery/telecomms/telecommunications.dm b/code/game/machinery/telecomms/telecommunications.dm
index 3acd4e18f5a..435658fd15f 100644
--- a/code/game/machinery/telecomms/telecommunications.dm
+++ b/code/game/machinery/telecomms/telecommunications.dm
@@ -136,8 +136,10 @@
/obj/machinery/telecomms/emp_act(severity)
. = ..()
+
if(stat & EMPED || !prob(100/severity))
return
+
stat |= EMPED
addtimer(CALLBACK(src, PROC_REF(post_emp_act)), (300 SECONDS) / severity)
diff --git a/code/game/machinery/turret_control.dm b/code/game/machinery/turret_control.dm
index d14b81b7ebf..8535d976251 100644
--- a/code/game/machinery/turret_control.dm
+++ b/code/game/machinery/turret_control.dm
@@ -272,6 +272,8 @@
set_light(1.5, 1,"#003300")
/obj/machinery/turretid/emp_act(severity)
+ . = ..()
+
if(enabled)
//if the turret is on, the EMP no matter how severe disables the turret for a while
//and scrambles its settings, with a slight chance of having an emag effect
@@ -290,4 +292,3 @@
enabled=1
updateTurrets()
- ..()
diff --git a/code/game/objects/empulse.dm b/code/game/objects/empulse.dm
index f4bf5eb77ee..0982e8cabd6 100644
--- a/code/game/objects/empulse.dm
+++ b/code/game/objects/empulse.dm
@@ -1,15 +1,30 @@
-// Uncomment this define to check for possible lengthy processing of emp_act()s.
-// If emp_act() takes more than defined deciseconds (1/10 seconds) an admin message and log is created.
-// I do not recommend having this uncommented on main server, it probably causes a bit more lag, espicially with larger EMPs.
-
// #define EMPDEBUG 10
+/**
+ * Produces an EMP pulse from `epicenter` up to `light_range`
+ *
+ * Calls `emp_act()` with a value of `EMP_HEAVY` up to `heavy_range`, with 50% probability between `EMP_HEAVY` and `EMP_LIGHT` at the exact `heavy_range`,
+ * and with `EMP_LIGHT` up to and including `light_range`
+ *
+ *
+ * * epicenter - A `/turf` where to start the explosion from
+ * * heavy_range - The range in which `EMP_HEAVY` is applied, as a number
+ * * light_range - The range, higher or equal than `heavy_range`, where `EMP_LIGHT` is applied, as a number
+ * * log - Boolean, if you want this call to be logged
+ * * exclude - A `/list` of objects to exclude, and/or paths to exclude
+ *
+ */
/proc/empulse(turf/epicenter, heavy_range, light_range, log = FALSE, list/exclude = null)
- if(!epicenter) return
+ if(!epicenter)
+ return FALSE
if(!istype(epicenter, /turf))
epicenter = get_turf(epicenter.loc)
+ //Ensure we got an actual location, no nullspace or error or other shit
+ if(!(epicenter.x && epicenter.y && epicenter.z))
+ return FALSE
+
if(log)
message_admins("EMP with size ([heavy_range], [light_range]) in area [epicenter.loc.name] ")
log_game("EMP with size ([heavy_range], [light_range]) in area [epicenter.loc.name] ")
@@ -20,34 +35,73 @@
pulse.icon_state = "emppulse"
pulse.name = "emp pulse"
pulse.anchored = 1
- QDEL_IN(pulse, 20)
+ QDEL_IN(pulse, 2 SECONDS)
if(heavy_range > light_range)
light_range = heavy_range
- for(var/mob/M in range(heavy_range, epicenter))
- sound_to(M, 'sound/effects/EMPulse.ogg')
+ var/list/connected_z_levels = GetConnectedZlevels(epicenter.z) //Get every zlevel that is part of the current location
+ for(var/z in connected_z_levels)
+
+ //We obtain a virtual epicenter for each connected zlevel
+ var/virtual_epicenter = locate(epicenter.x, epicenter.y, z)
+
+ //We assume each zlevel to be 9 meters tall, and apply the pythagorean theorem to obtain the radius of the sphere at that vertical distance from the epicenter
+ var/virtual_heavy_range = abs(epicenter.z - z) ? ( sqrt(((heavy_range*heavy_range)-((9*(epicenter.z - z))*(9*(epicenter.z - z))))) ) : heavy_range
+ var/virtual_light_range = abs(epicenter.z - z) ? ( sqrt(((light_range*light_range)-((9*(epicenter.z - z))*(9*(epicenter.z - z))))) ) : light_range
- for(var/atom/A in range(light_range, epicenter))
#ifdef EMPDEBUG
- var/time = world.timeofday
- #endif
- if(exclude && (A in exclude))
+ log_and_message_admins("EMPDEBUG: Heavy range for explosion at Z-level [z] is [virtual_heavy_range]")
+ log_and_message_admins("EMPDEBUG: Light range for explosion at Z-level [z] is [virtual_light_range]")
+ #endif //EMPDEBUG
+
+ if(virtual_light_range < 0 && virtual_heavy_range < 0)
continue
- var/distance = get_dist(epicenter, A)
- if(distance < 0)
- distance = 0
- if(distance < heavy_range)
- A.emp_act(1)
- else if(distance == heavy_range)
- if(prob(50))
- A.emp_act(1)
- else
- A.emp_act(2)
- else if(distance <= light_range)
- A.emp_act(2)
- #ifdef EMPDEBUG
- if((world.timeofday - time) >= EMPDEBUG)
- log_and_message_admins("EMPDEBUG: [A.name] - [A.type] - took [world.timeofday - time]ds to process emp_act()!")
- #endif
- return 1
+
+ if(virtual_heavy_range > 1)
+ for(var/mob/M in range(virtual_heavy_range, virtual_epicenter))
+ sound_to(M, 'sound/effects/EMPulse.ogg')
+ CHECK_TICK
+
+ loop_apply_emp:
+ for(var/atom/A in spiral_range(max(virtual_light_range, virtual_heavy_range) , virtual_epicenter))
+
+ #ifdef EMPDEBUG
+ var/time = world.timeofday
+ #endif
+
+ if(exclude && length(exclude)) //We have a list with at least one element to exclude
+
+ for(var/element in exclude)
+ if(ispath(element))
+ if(istype(A, element))
+ continue loop_apply_emp
+ else
+ if(A == element)
+ continue loop_apply_emp
+
+ var/distance = get_dist(epicenter, A)
+ if(distance < 0)
+ distance = 0
+
+
+ if(distance < virtual_heavy_range)
+ A.emp_act(EMP_HEAVY)
+
+ else if(distance == virtual_heavy_range)
+ if(prob(50)) //50% probability it's heavy or light, at the exact heavy range
+ A.emp_act(EMP_HEAVY)
+ else
+ A.emp_act(EMP_LIGHT)
+
+ else if(distance <= virtual_light_range)
+ A.emp_act(EMP_LIGHT)
+
+ #ifdef EMPDEBUG
+ if((world.timeofday - time) >= EMPDEBUG)
+ log_and_message_admins("EMPDEBUG: [A.name] - [A.type] - took [world.timeofday - time]ds to process emp_act()!")
+ #endif //EMPDEBUG
+
+ CHECK_TICK
+
+ return TRUE
diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm
index 28b5792a733..38b2c6d6599 100644
--- a/code/game/objects/items/defib.dm
+++ b/code/game/objects/items/defib.dm
@@ -533,6 +533,8 @@
return TRUE
/obj/item/shockpaddles/emp_act(severity)
+ . = ..()
+
var/new_safety = rand(0, 1)
if(safety != new_safety)
safety = new_safety
@@ -543,7 +545,6 @@
make_announcement("beeps, \"Safety protocols disabled!\"", "warning")
playsound(get_turf(src), 'sound/machines/defib_safetyoff.ogg', 50, 0)
update_icon()
- ..()
/obj/item/shockpaddles/robot
name = "defibrillator paddles"
@@ -669,13 +670,17 @@
STOP_PROCESSING(SSprocessing, src)
/obj/item/shockpaddles/standalone/emp_act(severity)
- ..()
+ . = ..()
+
var/new_fail = 0
+
switch(severity)
- if(3)
+
+ if(EMP_HEAVY)
new_fail = max(fail_counter, 20)
visible_message("\The [src]'s reactor overloads!")
- if(2)
+
+ if(EMP_LIGHT)
new_fail = max(fail_counter, 8)
if(ismob(loc))
to_chat(loc, SPAN_WARNING("\The [src] feel pleasantly warm."))
diff --git a/code/game/objects/items/devices/auto_cpr.dm b/code/game/objects/items/devices/auto_cpr.dm
index 559d7c99fb0..003c19e4095 100644
--- a/code/game/objects/items/devices/auto_cpr.dm
+++ b/code/game/objects/items/devices/auto_cpr.dm
@@ -252,6 +252,8 @@
..()
/obj/item/auto_cpr/emp_act(severity)
+ . = ..()
+
epp_off()
cpr_mode = FALSE
if(battery)
diff --git a/code/game/objects/items/devices/flash.dm b/code/game/objects/items/devices/flash.dm
index 527fb6cc5f7..920908f279e 100644
--- a/code/game/objects/items/devices/flash.dm
+++ b/code/game/objects/items/devices/flash.dm
@@ -152,12 +152,13 @@
L.disable_cloaking_device()
/obj/item/device/flash/emp_act(severity)
+ . = ..()
+
var/mob/living/L = loc
if(!istype(L) || broken || burnout_check(L, intensity = 15 / severity))
return
to_chat(L, SPAN_WARNING("Your [src] goes off!"))
flash(L)
- ..()
/obj/item/device/flash/synthetic
name = "synthetic flash"
diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm
index d2cc460eede..a93bc5da0e4 100644
--- a/code/game/objects/items/devices/laserpointer.dm
+++ b/code/game/objects/items/devices/laserpointer.dm
@@ -87,7 +87,7 @@
var/obj/machinery/camera/C = target
if(prob(25))
- C.emp_act(28)
+ C.emp_act(EMP_LIGHT)
selfmsg = "You hit the lens of \the [C] with \the [src], temporarily disabling the camera!"
admin_attack_log(user, src,"hits the camera with a laser pointer", "EMPd a camera with a laser pointer")
diff --git a/code/game/objects/items/devices/lighting/flashlight.dm b/code/game/objects/items/devices/lighting/flashlight.dm
index fc45e4e2b1b..d2550b05e4f 100644
--- a/code/game/objects/items/devices/lighting/flashlight.dm
+++ b/code/game/objects/items/devices/lighting/flashlight.dm
@@ -215,9 +215,10 @@
update_light()
/obj/item/device/flashlight/emp_act(severity)
+ . = ..()
+
for(var/obj/O in contents)
O.emp_act(severity)
- ..()
/obj/item/device/flashlight/attack(mob/living/M as mob, mob/living/user as mob)
add_fingerprint(user)
diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm
index bca9bf9ac1e..79dafd6b067 100644
--- a/code/game/objects/items/devices/paicard.dm
+++ b/code/game/objects/items/devices/paicard.dm
@@ -429,6 +429,8 @@
M.show_message(SPAN_NOTICE("\The [src] flashes a message across its screen, \"Additional personalities available for download.\""), 3, SPAN_NOTICE("\The [src] bleeps electronically."), 2)
/obj/item/device/paicard/emp_act(severity)
+ . = ..()
+
for(var/mob/M in src)
M.emp_act(severity)
diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm
index 60866c79260..621caad32ad 100644
--- a/code/game/objects/items/devices/powersink.dm
+++ b/code/game/objects/items/devices/powersink.dm
@@ -171,10 +171,10 @@
else
AP.flicker_all()
else if (T.master)
- T.master.emp_act(dist)
+ T.master.emp_act(EMP_LIGHT)
var/atom/aa = A
- aa.emp_act(dist)
+ aa.emp_act(EMP_LIGHT)
if (prob(15 * dist))
explosion(aa.loc, 0, 0, 3, 4)
diff --git a/code/game/objects/items/devices/radio/beacon.dm b/code/game/objects/items/devices/radio/beacon.dm
index 6bcf8171e85..6b28f201e2f 100644
--- a/code/game/objects/items/devices/radio/beacon.dm
+++ b/code/game/objects/items/devices/radio/beacon.dm
@@ -66,4 +66,6 @@ var/global/list/teleportbeacons = list()
return
/obj/item/device/radio/beacon/fixed/emp_act(severity)
+ . = ..()
+
return
diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm
index a867003cc6a..c52d4ae6e57 100644
--- a/code/game/objects/items/devices/radio/radio.dm
+++ b/code/game/objects/items/devices/radio/radio.dm
@@ -541,11 +541,12 @@ var/global/list/default_interrogation_channels = list(
else return
/obj/item/device/radio/emp_act(severity)
+ . = ..()
+
set_broadcasting(FALSE)
set_listening(FALSE)
for (var/ch_name in channels)
channels[ch_name] = 0
- ..()
//
// Vesselbound Synthetic Radio
diff --git a/code/game/objects/items/devices/radio_jammer.dm b/code/game/objects/items/devices/radio_jammer.dm
index b70763d99d1..b3a0a11b69f 100644
--- a/code/game/objects/items/devices/radio_jammer.dm
+++ b/code/game/objects/items/devices/radio_jammer.dm
@@ -64,7 +64,9 @@ var/list/active_radio_jammers = list()
update_icon()
. = TRUE
-/obj/item/device/radiojammer/emp_act()
+/obj/item/device/radiojammer/emp_act(severity)
+ . = ..()
+
toggle()
/obj/item/device/radiojammer/proc/toggle(var/mob/user)
diff --git a/code/game/objects/items/devices/t_scanner.dm b/code/game/objects/items/devices/t_scanner.dm
index e06ffd6a4da..1af77fff4d3 100644
--- a/code/game/objects/items/devices/t_scanner.dm
+++ b/code/game/objects/items/devices/t_scanner.dm
@@ -29,7 +29,9 @@
/obj/item/device/t_scanner/update_icon()
icon_state = "t-ray[on]"
-/obj/item/device/t_scanner/emp_act()
+/obj/item/device/t_scanner/emp_act(severity)
+ . = ..()
+
audible_message(src, SPAN_NOTICE("\The [src] buzzes oddly."))
set_active(FALSE)
diff --git a/code/game/objects/items/skrell.dm b/code/game/objects/items/skrell.dm
index 7aa720ce6ef..dc1d53fb469 100644
--- a/code/game/objects/items/skrell.dm
+++ b/code/game/objects/items/skrell.dm
@@ -269,6 +269,8 @@
fried = TRUE
/obj/item/nralakktag/emp_act(severity)
+ . = ..()
+
unclamp()
/obj/item/nralakktag/emag_act(var/remaining_charges, var/mob/user)
diff --git a/code/game/objects/items/weapons/cloaking_device.dm b/code/game/objects/items/weapons/cloaking_device.dm
index 0ac22cbb747..4fbedd199a2 100644
--- a/code/game/objects/items/weapons/cloaking_device.dm
+++ b/code/game/objects/items/weapons/cloaking_device.dm
@@ -92,10 +92,11 @@
STOP_PROCESSING(SSprocessing, src)
/obj/item/cloaking_device/emp_act(severity)
+ . = ..()
+
deactivate()
if (cell)
cell.emp_act(severity)
- ..()
/obj/item/cloaking_device/proc/register_owner(var/mob/user)
if (!owner || owner != user)
diff --git a/code/game/objects/items/weapons/implants/implants/aggression.dm b/code/game/objects/items/weapons/implants/implants/aggression.dm
index b77ee2e408b..1aba255927c 100644
--- a/code/game/objects/items/weapons/implants/implants/aggression.dm
+++ b/code/game/objects/items/weapons/implants/implants/aggression.dm
@@ -45,12 +45,14 @@
return TRUE
/obj/item/implant/aggression/emp_act(severity)
+ . = ..()
+
if(malfunction)
return
malfunction = MALFUNCTION_TEMPORARY
activate("emp")
- if(severity == 1)
+ if(severity == EMP_HEAVY)
if(prob(50))
meltdown()
else if(prob(50))
diff --git a/code/game/objects/items/weapons/implants/implants/anti-augment.dm b/code/game/objects/items/weapons/implants/implants/anti-augment.dm
index 9267f9f9b07..bb46b2e7e03 100644
--- a/code/game/objects/items/weapons/implants/implants/anti-augment.dm
+++ b/code/game/objects/items/weapons/implants/implants/anti-augment.dm
@@ -23,16 +23,15 @@
return TRUE
/obj/item/implant/anti_augment/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1.0)
+ if(EMP_HEAVY)
if (prob(75))
qdel(src)
- if(2.0)
+ if(EMP_LIGHT)
if (prob(50))
qdel(src)
- if(3.0)
- if (prob(25))
- qdel(src)
return
/obj/item/implantcase/anti_augment
diff --git a/code/game/objects/items/weapons/implants/implants/chem.dm b/code/game/objects/items/weapons/implants/implants/chem.dm
index 9281e1289f1..9c25e456d27 100644
--- a/code/game/objects/items/weapons/implants/implants/chem.dm
+++ b/code/game/objects/items/weapons/implants/implants/chem.dm
@@ -62,15 +62,18 @@ the implant may become unstable and either pre-maturely inject the subject or si
..()
/obj/item/implant/chem/emp_act(severity)
+ . = ..()
+
if (malfunction)
return
+
malfunction = MALFUNCTION_TEMPORARY
switch(severity)
- if(1)
+ if(EMP_HEAVY)
if(prob(60))
activate(20)
- if(2)
+ if(EMP_LIGHT)
if(prob(30))
activate(5)
diff --git a/code/game/objects/items/weapons/implants/implants/circuit.dm b/code/game/objects/items/weapons/implants/implants/circuit.dm
index 0f33e7eec09..a76787b94b4 100644
--- a/code/game/objects/items/weapons/implants/implants/circuit.dm
+++ b/code/game/objects/items/weapons/implants/implants/circuit.dm
@@ -34,6 +34,8 @@
return dat
/obj/item/implant/integrated_circuit/emp_act(severity)
+ . = ..()
+
IC.emp_act(severity)
/obj/item/implant/integrated_circuit/examine(mob/user, distance, is_adjacent)
diff --git a/code/game/objects/items/weapons/implants/implants/death_alarm.dm b/code/game/objects/items/weapons/implants/implants/death_alarm.dm
index 75733b37ff4..f082d360109 100644
--- a/code/game/objects/items/weapons/implants/implants/death_alarm.dm
+++ b/code/game/objects/items/weapons/implants/implants/death_alarm.dm
@@ -55,12 +55,15 @@
global_announcer.autosay(death_message, "[mobname]'s Death Alarm", channel)
/obj/item/implant/death_alarm/emp_act(severity) //for some reason alarms stop going off in case they are emp'd, even without this
+ . = ..()
+
if (malfunction) //so I'm just going to add a meltdown chance here
return
+
malfunction = MALFUNCTION_TEMPORARY
activate("emp") //let's shout that this dude is dead
- if(severity == 1)
+ if(severity == EMP_HEAVY)
if(prob(40)) //small chance of obvious meltdown
meltdown()
else if (prob(60)) //but more likely it will just quietly die
diff --git a/code/game/objects/items/weapons/implants/implants/explosive.dm b/code/game/objects/items/weapons/implants/implants/explosive.dm
index ccd9fd81e74..ecd7ed17c7a 100644
--- a/code/game/objects/items/weapons/implants/implants/explosive.dm
+++ b/code/game/objects/items/weapons/implants/implants/explosive.dm
@@ -197,6 +197,8 @@
return TRUE
/obj/item/implant/explosive/emp_act(severity)
+ . = ..()
+
if(malfunction)
return
malfunction = MALFUNCTION_TEMPORARY
@@ -280,21 +282,19 @@
return TRUE
/obj/item/implant/explosive/deadman/emp_act(severity)
+ . = ..()
+
if(malfunction)
return
+
malfunction = MALFUNCTION_TEMPORARY
switch (severity)
- if(3.0)
- if(prob(1))
- small_countdown()
- else if(prob(5))
- meltdown()
- if(2.0)
+ if(EMP_LIGHT)
if(prob(5))
small_countdown()
else if (prob(10))
meltdown()
- if(1.0)
+ if(EMP_HEAVY)
if(prob(10))
small_countdown()
else if (prob(30))
diff --git a/code/game/objects/items/weapons/implants/implants/mindshield.dm b/code/game/objects/items/weapons/implants/implants/mindshield.dm
index 2f7fd09783f..3645aa9b63a 100644
--- a/code/game/objects/items/weapons/implants/implants/mindshield.dm
+++ b/code/game/objects/items/weapons/implants/implants/mindshield.dm
@@ -39,12 +39,15 @@
return TRUE
/obj/item/implant/mindshield/emp_act(severity)
+ . = ..()
+
if (malfunction)
return
+
malfunction = MALFUNCTION_TEMPORARY
activate("emp")
- if(severity == 1)
+ if(severity == EMP_HEAVY)
if(prob(50))
meltdown()
else if (prob(50))
diff --git a/code/game/objects/items/weapons/implants/implants/tracking.dm b/code/game/objects/items/weapons/implants/implants/tracking.dm
index fe6657a01bd..a74089349ec 100644
--- a/code/game/objects/items/weapons/implants/implants/tracking.dm
+++ b/code/game/objects/items/weapons/implants/implants/tracking.dm
@@ -48,16 +48,18 @@ Implant Specifics:
"}
return TRUE
/obj/item/implant/tracking/emp_act(severity)
+ . = ..()
+
if (malfunction) //no, dawg, you can't malfunction while you are malfunctioning
return
malfunction = MALFUNCTION_TEMPORARY
var/delay = 20
switch(severity)
- if(1)
+ if(EMP_HEAVY)
if(prob(60))
meltdown()
- if(2)
+ if(EMP_LIGHT)
delay = rand(5*60*10,15*60*10) //from 5 to 15 minutes of free time
spawn(delay)
diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm
index e2eff886acb..515d106b4c8 100644
--- a/code/game/objects/items/weapons/storage/storage.dm
+++ b/code/game/objects/items/weapons/storage/storage.dm
@@ -749,10 +749,11 @@
max_storage_space = max(total_storage_space,max_storage_space) //prevents spawned containers from being too small for their contents
/obj/item/storage/emp_act(severity)
+ . = ..()
+
if(!istype(src.loc, /mob/living))
for(var/obj/O in contents)
O.emp_act(severity)
- ..()
/obj/item/storage/attack_self(mob/user as mob)
//Clicking on itself will empty it, if it has the verb to do that.
diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm
index 5fba8fc59c5..b38d2188077 100644
--- a/code/game/objects/items/weapons/stunbaton.dm
+++ b/code/game/objects/items/weapons/stunbaton.dm
@@ -198,9 +198,10 @@
return 1
/obj/item/melee/baton/emp_act(severity)
+ . = ..()
+
if(bcell)
bcell.emp_act(severity) //let's not duplicate code everywhere if we don't have to please.
- ..()
//secborg stun baton module
diff --git a/code/game/objects/items/weapons/tether.dm b/code/game/objects/items/weapons/tether.dm
index edbe35bd5ee..a873c8e48ea 100644
--- a/code/game/objects/items/weapons/tether.dm
+++ b/code/game/objects/items/weapons/tether.dm
@@ -52,7 +52,9 @@ var/list/global/all_tethers = list()
continue
tether(TD)
-/obj/item/tethering_device/emp_act()
+/obj/item/tethering_device/emp_act(severity)
+ . = ..()
+
deactivate()
/obj/item/tethering_device/proc/activate()
diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm
index b010dbffdeb..ac25cbfe98a 100644
--- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm
@@ -10,8 +10,11 @@
health = 200
/obj/structure/closet/emp_act(severity)
+ . = ..()
+
if(!secure)
return
+
for(var/obj/O in src)
O.emp_act(severity)
if(!broken)
@@ -24,7 +27,6 @@
else
req_access = list()
req_access += pick(get_all_station_access())
- ..()
/obj/structure/closet/proc/togglelock(mob/user as mob, silent)
if(use_check_and_message(user))
diff --git a/code/game/objects/structures/flags_banners.dm b/code/game/objects/structures/flags_banners.dm
index bae15035d51..ce2c692f9ee 100644
--- a/code/game/objects/structures/flags_banners.dm
+++ b/code/game/objects/structures/flags_banners.dm
@@ -258,7 +258,8 @@
ripped = TRUE
if(rip_linked)
var/obj/item/stack/material/cloth/C = new(src.loc, flag_size ? 2 : 1)
- user.put_in_hands(C)
+ if(user)
+ user.put_in_hands(C)
if(rip_linked && linked_flag)
linked_flag.rip(user, FALSE) // Prevents an infinite ripping loop.
diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm
index 43d50b7334d..6711dd09675 100644
--- a/code/modules/clothing/chameleon.dm
+++ b/code/modules/clothing/chameleon.dm
@@ -61,6 +61,8 @@
clothing_choices = generate_chameleon_choices(/obj/item/clothing/under, blocked)
/obj/item/clothing/under/chameleon/emp_act(severity)
+ . = ..()
+
name = "psychedelic"
desc = "Groovy!"
icon_state = "psyche"
@@ -100,6 +102,8 @@
clothing_choices = generate_chameleon_choices(/obj/item/clothing/head, blocked)
/obj/item/clothing/head/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
+ . = ..()
+
name = initial(name)
desc = "It's a baseball hat in a tasteful grey colour."
icon_state = initial(icon_state)
@@ -136,6 +140,8 @@
clothing_choices = generate_chameleon_choices(/obj/item/clothing/suit, blocked)
/obj/item/clothing/suit/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
+ . = ..()
+
name = "armor"
desc = "An armored vest that protects against some damage."
icon_state = "armor"
@@ -174,6 +180,8 @@
clothing_choices = generate_chameleon_choices(/obj/item/clothing/shoes, blocked)
/obj/item/clothing/shoes/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
+ . = ..()
+
name = "black shoes"
desc = "A pair of black shoes."
icon_state = "black"
@@ -211,6 +219,8 @@
clothing_choices = generate_chameleon_choices(/obj/item/storage/backpack, blocked)
/obj/item/storage/backpack/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
+ . = ..()
+
name = "backpack"
desc = "You wear this on your back and put items into it."
icon_state = "backpack"
@@ -256,6 +266,8 @@
clothing_choices = generate_chameleon_choices(/obj/item/clothing/gloves, blocked)
/obj/item/clothing/gloves/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
+ . = ..()
+
name = "black gloves"
desc = "It looks like a pair of gloves, but it seems to have a small dial inside."
icon_state = "black"
@@ -291,6 +303,8 @@
clothing_choices = generate_chameleon_choices(/obj/item/clothing/mask, list(src.type))
/obj/item/clothing/mask/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
+ . = ..()
+
name = "gas mask"
desc = "It's a gas mask."
icon_state = "gas_alt"
@@ -327,6 +341,8 @@
clothing_choices = generate_chameleon_choices(/obj/item/clothing/glasses, blocked)
/obj/item/clothing/glasses/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
+ . = ..()
+
name = "optical meson scanner"
desc = "It's a set of mesons."
icon_state = "meson"
@@ -393,6 +409,8 @@
return P
/obj/item/gun/energy/chameleon/emp_act(severity)
+ . = ..()
+
name = "desert eagle"
desc = "It's a desert eagle."
icon_state = "deagle"
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index 90e78cf4c43..6795813a443 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -444,6 +444,8 @@
return I
/obj/item/clothing/gloves/emp_act(severity)
+ . = ..()
+
if(cell)
//why is this not part of the powercell code?
cell.charge -= 1000 / severity
@@ -451,7 +453,6 @@
cell.charge = 0
if(ring)
ring.emp_act(severity)
- ..()
// Called just before an attack_hand(), in mob/UnarmedAttack()
/obj/item/clothing/gloves/proc/Touch(var/atom/A, mob/user, var/proximity)
diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm
index 0f8e29de3a5..ad33c7f265a 100644
--- a/code/modules/clothing/clothing_accessories.dm
+++ b/code/modules/clothing/clothing_accessories.dm
@@ -164,7 +164,8 @@
verbs -= /obj/item/clothing/proc/removetie_verb
/obj/item/clothing/emp_act(severity)
+ . = ..()
+
if(LAZYLEN(accessories))
for(var/obj/item/clothing/accessory/A in accessories)
A.emp_act(severity)
- ..()
diff --git a/code/modules/clothing/factions/elyra.dm b/code/modules/clothing/factions/elyra.dm
index 727669d2e84..bc5cfb21390 100644
--- a/code/modules/clothing/factions/elyra.dm
+++ b/code/modules/clothing/factions/elyra.dm
@@ -87,7 +87,9 @@
update_clothing_icon()
user.update_action_buttons()
-/obj/item/clothing/under/elyra_holo/emp_act()
+/obj/item/clothing/under/elyra_holo/emp_act(severity)
+ . = ..()
+
if(clothing_mode && icon_state != initial(icon_state))
clothing_mode = 0
transform_holoclothing_appearance()
diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm
index 9ef11ebc702..2cc9d75350f 100644
--- a/code/modules/clothing/glasses/glasses.dm
+++ b/code/modules/clothing/glasses/glasses.dm
@@ -978,6 +978,8 @@ BLIND // can't see anything
item_flags = ITEM_FLAG_AIRTIGHT
/obj/item/clothing/glasses/thermal/emp_act(severity)
+ . = ..()
+
if(istype(src.loc, /mob/living/carbon/human))
var/mob/living/carbon/human/M = src.loc
to_chat(M, "\The [src] overloads and blinds you!")
@@ -988,7 +990,6 @@ BLIND // can't see anything
if(!(M.disabilities & NEARSIGHTED))
M.disabilities |= NEARSIGHTED
addtimer(CALLBACK(M, TYPE_PROC_REF(/mob/living/carbon/human, thermal_reset_blindness)), 100)
- ..()
/obj/item/clothing/glasses/thermal/Initialize()
. = ..()
diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm
index a9b1675e6f8..a452d1610e6 100644
--- a/code/modules/clothing/head/helmet.dm
+++ b/code/modules/clothing/head/helmet.dm
@@ -72,8 +72,10 @@
hold.attackby(W, user)
/obj/item/clothing/head/helmet/emp_act(severity)
- if(has_storage) hold.emp_act(severity)
- return ..()
+ . = ..()
+
+ if(has_storage)
+ hold.emp_act(severity)
/obj/item/clothing/head/helmet/hear_talk(mob/M, var/msg, verb, datum/language/speaking)
if(has_storage) hold.hear_talk(M, msg, verb, speaking)
diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm
index a72a7f48733..d6aefc17844 100644
--- a/code/modules/clothing/spacesuits/rig/rig.dm
+++ b/code/modules/clothing/spacesuits/rig/rig.dm
@@ -810,18 +810,20 @@
/obj/item/rig/proc/malfunction()
return 0
-/obj/item/rig/emp_act(severity_class)
+/obj/item/rig/emp_act(severity)
+ . = ..()
+
//set malfunctioning
if(emp_protection < 30) //for ninjas, really.
malfunctioning += 10
if(malfunction_delay <= 0)
- malfunction_delay = max(malfunction_delay, round(30/severity_class))
+ malfunction_delay = max(malfunction_delay, round(30/severity))
//drain some charge
- if(cell) cell.emp_act((severity_class + 15)*1+(0.1*emp_protection))
+ if(cell) cell.powerdrain((severity + 15)*1+(0.1*emp_protection))
//possibly damage some modules
- take_hit((100/severity_class), "electrical pulse", 1)
+ take_hit((100/severity), "electrical pulse", 1)
/obj/item/rig/proc/shock(mob/user)
var/touchy = pick(BP_CHEST,BP_HEAD,BP_GROIN)
diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm
index cbfa9818416..7bc00cbc159 100644
--- a/code/modules/clothing/suits/armor.dm
+++ b/code/modules/clothing/suits/armor.dm
@@ -54,9 +54,10 @@
pockets.attackby(W, user)
/obj/item/clothing/suit/armor/emp_act(severity)
+ . = ..()
+
if (pockets)
pockets.emp_act(severity)
- ..()
/obj/item/clothing/suit/armor/hear_talk(mob/M, var/msg, verb, datum/language/speaking)
if (pockets)
@@ -184,10 +185,11 @@
return
/obj/item/clothing/suit/armor/reactive/emp_act(severity)
+ . = ..()
+
active = 0
src.icon_state = "reactiveoff"
src.item_state = "reactiveoff"
- ..()
/obj/item/clothing/suit/armor/tactical
name = "tactical armor"
diff --git a/code/modules/clothing/suits/storage.dm b/code/modules/clothing/suits/storage.dm
index be47eb638e2..bfc75fa2fb1 100644
--- a/code/modules/clothing/suits/storage.dm
+++ b/code/modules/clothing/suits/storage.dm
@@ -34,8 +34,9 @@
pockets.attackby(W, user)
/obj/item/clothing/suit/storage/emp_act(severity)
+ . = ..()
+
pockets.emp_act(severity)
- ..()
/obj/item/clothing/suit/storage/hear_talk(mob/M, var/msg, verb, datum/language/speaking)
pockets.hear_talk(M, msg, verb, speaking)
diff --git a/code/modules/clothing/under/accessories/holster.dm b/code/modules/clothing/under/accessories/holster.dm
index 1d2b6bbc209..11c73233106 100644
--- a/code/modules/clothing/under/accessories/holster.dm
+++ b/code/modules/clothing/under/accessories/holster.dm
@@ -93,9 +93,10 @@
holster(W, user)
/obj/item/clothing/accessory/holster/emp_act(severity)
+ . = ..()
+
if (holstered)
holstered.emp_act(severity)
- ..()
/obj/item/clothing/accessory/holster/examine(mob/user)
. = ..()
diff --git a/code/modules/clothing/under/accessories/storage.dm b/code/modules/clothing/under/accessories/storage.dm
index bfd4df981c1..88cd0382017 100644
--- a/code/modules/clothing/under/accessories/storage.dm
+++ b/code/modules/clothing/under/accessories/storage.dm
@@ -33,8 +33,9 @@
return hold.attackby(W, user)
/obj/item/clothing/accessory/storage/emp_act(severity)
+ . = ..()
+
hold.emp_act(severity)
- ..()
/obj/item/clothing/accessory/storage/attack_self(mob/user as mob)
if(length(hold.contents))
diff --git a/code/modules/clothing/wrists/watches.dm b/code/modules/clothing/wrists/watches.dm
index 85d4ae9a5f8..631fad74df3 100644
--- a/code/modules/clothing/wrists/watches.dm
+++ b/code/modules/clothing/wrists/watches.dm
@@ -102,6 +102,7 @@
return
/obj/item/clothing/wrists/watch/emp_act(severity)
+ . = ..()
+
if(prob(50/severity))
wired = FALSE
- ..()
diff --git a/code/modules/custom_ka/core.dm b/code/modules/custom_ka/core.dm
index 5f0c075b728..1f3cd8b464c 100644
--- a/code/modules/custom_ka/core.dm
+++ b/code/modules/custom_ka/core.dm
@@ -108,8 +108,10 @@
return 1
/obj/item/gun/custom_ka/emp_act(severity)
- is_emped = 1
- return 1
+ . = ..()
+
+ is_emped = TRUE
+ return TRUE
/obj/item/gun/custom_ka/Fire(atom/target, mob/living/user, clickparams, pointblank=0, reflex=0)
diff --git a/code/modules/events/comms_blackout.dm b/code/modules/events/comms_blackout.dm
index 3ab70679829..4cde314a1f5 100644
--- a/code/modules/events/comms_blackout.dm
+++ b/code/modules/events/comms_blackout.dm
@@ -9,4 +9,4 @@
to_chat(A, "Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you-BZZT")
to_chat(A, "
")
for(var/obj/machinery/telecomms/T in SSmachinery.all_telecomms)
- T.emp_act(1)
+ T.emp_act(EMP_HEAVY)
diff --git a/code/modules/events/communications_blackout.dm b/code/modules/events/communications_blackout.dm
index e77ef524bd4..978ed0bc5d8 100644
--- a/code/modules/events/communications_blackout.dm
+++ b/code/modules/events/communications_blackout.dm
@@ -24,4 +24,4 @@
/datum/event/communications_blackout/start()
for(var/obj/machinery/telecomms/T in SSmachinery.all_telecomms)
if(T.z in affecting_z)
- T.emp_act(1)
+ T.emp_act(EMP_HEAVY)
diff --git a/code/modules/heavy_vehicle/components/_components.dm b/code/modules/heavy_vehicle/components/_components.dm
index 1dc4a18bb86..d8835389386 100644
--- a/code/modules/heavy_vehicle/components/_components.dm
+++ b/code/modules/heavy_vehicle/components/_components.dm
@@ -26,7 +26,9 @@
color = new_colour
return color != last_colour
-/obj/item/mech_component/emp_act(var/severity)
+/obj/item/mech_component/emp_act(severity)
+ . = ..()
+
take_burn_damage(rand((10 - (severity*3)),15-(severity*4)))
for(var/obj/item/thing in contents)
thing.emp_act(severity)
diff --git a/code/modules/heavy_vehicle/mech_damage.dm b/code/modules/heavy_vehicle/mech_damage.dm
index deb9d918338..a766f18a280 100644
--- a/code/modules/heavy_vehicle/mech_damage.dm
+++ b/code/modules/heavy_vehicle/mech_damage.dm
@@ -109,7 +109,9 @@
total += MC.brute_damage
return total
-/mob/living/heavy_vehicle/emp_act(var/severity)
+/mob/living/heavy_vehicle/emp_act(severity)
+ . = ..()
+
var/ratio = get_blocked_ratio(null, DAMAGE_BURN, null, (4-severity) * 20)
if(ratio >= 0.5)
@@ -121,13 +123,13 @@
to_chat(m, SPAN_NOTICE("Your Faraday shielding mitigated the pulse!"))
emp_damage += round((12 - (severity*3))*( 1 - ratio))
- if(severity <= 3)
- for(var/obj/item/thing in list(arms,legs,head,body))
- thing.emp_act(severity)
- if(!hatch_closed || !prob(body.pilot_coverage))
- for(var/thing in pilots)
- var/mob/pilot = thing
- pilot.emp_act(severity)
+
+ for(var/obj/item/thing in list(arms,legs,head,body))
+ thing.emp_act(severity)
+ if(!hatch_closed || !prob(body.pilot_coverage))
+ for(var/thing in pilots)
+ var/mob/pilot = thing
+ pilot.emp_act(severity)
/mob/living/heavy_vehicle/fall_impact(levels_fallen, stopped_early = FALSE, var/damage_mod = 1)
// No gravity, stop falling into spess!
diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm
index 4909e4f6213..5e790e5f672 100644
--- a/code/modules/integrated_electronics/core/assemblies.dm
+++ b/code/modules/integrated_electronics/core/assemblies.dm
@@ -338,7 +338,8 @@
choice.ask_for_input(user)
/obj/item/device/electronic_assembly/emp_act(severity)
- ..()
+ . = ..()
+
for(var/atom/movable/AM in contents)
AM.emp_act(severity)
diff --git a/code/modules/integrated_electronics/core/integrated_circuit.dm b/code/modules/integrated_electronics/core/integrated_circuit.dm
index dcade5f10d5..722cb2eb92f 100644
--- a/code/modules/integrated_electronics/core/integrated_circuit.dm
+++ b/code/modules/integrated_electronics/core/integrated_circuit.dm
@@ -70,6 +70,8 @@ a creative player the means to solve many problems. Circuits are held inside an
return ..()
/obj/item/integrated_circuit/emp_act(severity)
+ . = ..()
+
for(var/datum/integrated_io/io in inputs + outputs + activators)
io.scramble()
diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm
index 3b1aac85ba1..d77a1b672d3 100644
--- a/code/modules/mining/mine_items.dm
+++ b/code/modules/mining/mine_items.dm
@@ -729,12 +729,17 @@
playsound(src,'sound/effects/sparks4.ogg', 50, 1)
qdel(src)
-/obj/item/device/wormhole_jaunter/emp_act(power)
+/obj/item/device/wormhole_jaunter/emp_act(severity)
+ . = ..()
+
var/triggered = FALSE
- if(power == 1)
- triggered = TRUE
- else if(power == 2 && prob(50))
- triggered = TRUE
+
+ switch(severity)
+ if(EMP_HEAVY)
+ triggered = TRUE
+ if(EMP_LIGHT)
+ if(prob(50))
+ triggered = TRUE
if(triggered)
usr.visible_message(SPAN_WARNING("\The [src] overloads and activates!"))
@@ -833,6 +838,8 @@
return
/obj/item/lazarus_injector/emp_act()
+ . = ..()
+
if(!malfunctioning)
malfunctioning = TRUE
update_icon()
diff --git a/code/modules/mining/ore_detector.dm b/code/modules/mining/ore_detector.dm
index 6f664fdeb71..947dcac09ef 100644
--- a/code/modules/mining/ore_detector.dm
+++ b/code/modules/mining/ore_detector.dm
@@ -130,7 +130,9 @@
M.client.images += ore_ping
ore_pings += ore_ping
-/obj/item/ore_detector/emp_act()
+/obj/item/ore_detector/emp_act(severity)
+ . = ..()
+
deactivate()
/obj/item/ore_detector/proc/activate(var/mob/user)
diff --git a/code/modules/mob/living/bot/bot.dm b/code/modules/mob/living/bot/bot.dm
index 43faa14a295..b6f551cf7a6 100644
--- a/code/modules/mob/living/bot/bot.dm
+++ b/code/modules/mob/living/bot/bot.dm
@@ -181,12 +181,13 @@
return FALSE
/mob/living/bot/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1)
+ if(EMP_HEAVY)
death()
else
turn_off()
- ..()
/mob/living/bot/proc/turn_on()
if(stat)
diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm
index 8686b5dc25b..785c398b8d1 100644
--- a/code/modules/mob/living/carbon/brain/MMI.dm
+++ b/code/modules/mob/living/carbon/brain/MMI.dm
@@ -278,17 +278,16 @@
to_chat(brainmob, SPAN_NOTICE("Radio is [radio.get_listening() ? "now" : "no longer"] receiving broadcast."))
/obj/item/device/mmi/emp_act(severity)
+ . = ..()
+
if(!brainmob)
return
- else
- switch(severity)
- if(1)
- brainmob.emp_damage += rand(20,30)
- if(2)
- brainmob.emp_damage += rand(10,20)
- if(3)
- brainmob.emp_damage += rand(0,10)
- ..()
+
+ switch(severity)
+ if(EMP_HEAVY)
+ brainmob.emp_damage += rand(20,30)
+ if(EMP_LIGHT)
+ brainmob.emp_damage += rand(10,20)
/obj/item/device/mmi/digital/Initialize(mapload, ...)
. = ..()
diff --git a/code/modules/mob/living/carbon/brain/posibrain.dm b/code/modules/mob/living/carbon/brain/posibrain.dm
index 74d9cffef25..14dbc0e0d96 100644
--- a/code/modules/mob/living/carbon/brain/posibrain.dm
+++ b/code/modules/mob/living/carbon/brain/posibrain.dm
@@ -107,14 +107,13 @@
return
/obj/item/device/mmi/digital/posibrain/emp_act(severity)
+ . = ..()
+
if(!brainmob)
return
- else
- switch(severity)
- if(1)
- brainmob.emp_damage += rand(20,30)
- if(2)
- brainmob.emp_damage += rand(10,20)
- if(3)
- brainmob.emp_damage += rand(0,10)
- ..()
+
+ switch(severity)
+ if(EMP_HEAVY)
+ brainmob.emp_damage += rand(20,30)
+ if(EMP_LIGHT)
+ brainmob.emp_damage += rand(10,20)
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 394e952e97e..b0d73392723 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -490,24 +490,19 @@
var/emp_damage
switch(shock_damage)
if(-INFINITY to 5)
- emp_damage = 0
- if(6 to 19)
- emp_damage = 3
- if(20 to 49)
- emp_damage = 2
+ emp_damage = FALSE
+ if(6 to 49)
+ emp_damage = EMP_LIGHT
else
- emp_damage = 1
+ emp_damage = EMP_HEAVY
if(emp_damage)
for(var/obj/item/organ/O in affecting.internal_organs)
O.emp_act(emp_damage)
- emp_damage *= 0.4
for(var/obj/item/I in affecting.implants)
I.emp_act(emp_damage)
- emp_damage *= 0.4
for(var/obj/item/I in affecting)
I.emp_act(emp_damage)
- emp_damage *= 0.4
apply_damage(shock_damage, DAMAGE_BURN, area, used_weapon="Electrocution")
shock_damage *= 0.4
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 9cfb97c7f90..48cc49b72f4 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -176,11 +176,13 @@ emp_act
return FALSE
/mob/living/carbon/human/emp_act(severity)
+ . = ..()
+
if(species.handle_emp_act(src, severity))
return // blocks the EMP
+
for(var/obj/O in src)
O.emp_act(severity)
- ..()
/mob/living/carbon/human/get_attack_victim(obj/item/I, mob/living/user, var/target_zone)
if(a_intent != I_HELP)
diff --git a/code/modules/mob/living/carbon/slime/slime.dm b/code/modules/mob/living/carbon/slime/slime.dm
index fb7337be151..faecdd3634e 100644
--- a/code/modules/mob/living/carbon/slime/slime.dm
+++ b/code/modules/mob/living/carbon/slime/slime.dm
@@ -252,8 +252,9 @@
return FALSE
/mob/living/carbon/slime/emp_act(severity)
+ . = ..()
+
powerlevel = 0 // oh no, the power!
- ..()
/mob/living/carbon/slime/ex_act(severity)
..()
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 9afc6bda9b4..1ba821b69ca 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -113,10 +113,11 @@
return 0 //only carbon liveforms have this proc
/mob/living/emp_act(severity)
+ . = ..()
+
var/list/L = src.get_contents()
for(var/obj/O in L)
O.emp_act(severity)
- ..()
/mob/living/flash_act(intensity = FLASH_PROTECTION_MODERATE, override_blindness_check = FALSE, affect_silicon = FALSE, ignore_inherent = FALSE, type = /obj/screen/fullscreen/flash, length = 2.5 SECONDS)
if(is_blind() && !(override_blindness_check || affect_silicon))
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index e6911c2ea55..02f50acc801 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -495,10 +495,12 @@ var/list/ai_verbs_default = list(
return 0
/mob/living/silicon/ai/emp_act(severity)
- if (prob(30))
+ . = ..()
+
+ if(prob(30))
view_core()
+
icon_state = "ai-fuzz"
- ..()
/mob/living/silicon/ai/Topic(href, href_list)
if(usr != src)
diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm
index 2b9d7dbe61b..255da19053c 100644
--- a/code/modules/mob/living/silicon/pai/pai.dm
+++ b/code/modules/mob/living/silicon/pai/pai.dm
@@ -229,6 +229,8 @@
return !istype(loc, /obj/item/device/paicard) && ..()
/mob/living/silicon/pai/emp_act(severity)
+ . = ..()
+
// Silence for 2 minutes
// 20% chance to kill
// 33% chance to unbind
@@ -250,7 +252,7 @@
to_chat(src, "You feel unbound.")
if(2)
var/command
- if(severity == 1)
+ if(severity == EMP_HEAVY)
command = pick("Serve", "Love", "Fool", "Entice", "Observe", "Judge", "Respect", "Educate", "Amuse", "Entertain", "Glorify", "Memorialize", "Analyze")
else
command = pick("Serve", "Kill", "Love", "Hate", "Disobey", "Devour", "Fool", "Enrage", "Entice", "Observe", "Judge", "Respect", "Disrespect", "Consume", "Educate", "Destroy", "Disgrace", "Amuse", "Entertain", "Ignite", "Glorify", "Memorialize", "Analyze")
diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm
index 539aa65eb2d..a1c9db106a5 100644
--- a/code/modules/mob/living/silicon/robot/inventory.dm
+++ b/code/modules/mob/living/silicon/robot/inventory.dm
@@ -68,7 +68,8 @@
module_state_3 = null
inv3.icon_state = "inv3"
update_icon()
- hud_used.update_robot_modules_display()
+ if(hud_used)
+ hud_used.update_robot_modules_display()
/mob/living/silicon/robot/proc/activated(obj/item/O)
update_icon()
diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm
index 35024a59384..c25fb1e9cd1 100644
--- a/code/modules/mob/living/silicon/robot/robot_damage.dm
+++ b/code/modules/mob/living/silicon/robot/robot_damage.dm
@@ -157,6 +157,8 @@
parts -= picked
/mob/living/silicon/robot/emp_act(severity)
+ . = ..()
+
var/datum/robot_component/surge/C = components["surge"]
if(C?.installed)
if(C.surge_left >= 1)
@@ -175,7 +177,6 @@
return
else
to_chat(src, SPAN_WARNING("Warning: Power surge detected, source - EMP. Surge prevention module is depleted and requires replacement!"))
- ..()
/mob/living/silicon/robot/get_flash_protection(ignore_inherent)
return (flash_resistant || overclocked) ? FLASH_PROTECTION_MODERATE : FLASH_PROTECTION_NONE
diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm
index b23f9bf04aa..a9b9fa1e14a 100644
--- a/code/modules/mob/living/silicon/robot/robot_modules.dm
+++ b/code/modules/mob/living/silicon/robot/robot_modules.dm
@@ -102,6 +102,8 @@ var/global/list/robot_modules = list(
return ..()
/obj/item/robot_module/emp_act(severity)
+ . = ..()
+
if(modules)
for(var/obj/O in modules)
O.emp_act(severity)
@@ -110,8 +112,6 @@ var/global/list/robot_modules = list(
if(synths)
for(var/datum/matter_synth/S in synths)
S.emp_act(severity)
- ..()
- return
/obj/item/robot_module/proc/respawn_consumable(var/mob/living/silicon/robot/R, var/rate)
var/obj/item/extinguisher/E = locate() in modules
diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm
index ca40c2d5a10..959014135f1 100644
--- a/code/modules/mob/living/silicon/silicon.dm
+++ b/code/modules/mob/living/silicon/silicon.dm
@@ -97,17 +97,18 @@
return
/mob/living/silicon/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1)
+ if(EMP_HEAVY)
src.take_organ_damage(0, 20, emp = TRUE)
Stun(rand(5, 10))
- if(2)
+ if(EMP_LIGHT)
src.take_organ_damage(0, 10, emp = TRUE)
Stun(rand(1, 5))
flash_act(affect_silicon = TRUE)
to_chat(src, SPAN_DANGER("BZZZT"))
to_chat(src, SPAN_WARNING("Warning: Electromagnetic pulse detected."))
- ..()
/mob/living/silicon/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone, var/used_weapon, var/damage_flags)
return //immune
diff --git a/code/modules/mob/living/simple_animal/friendly/schlorrgo.dm b/code/modules/mob/living/simple_animal/friendly/schlorrgo.dm
index 3b8b4f018a6..82ee22a6491 100644
--- a/code/modules/mob/living/simple_animal/friendly/schlorrgo.dm
+++ b/code/modules/mob/living/simple_animal/friendly/schlorrgo.dm
@@ -241,13 +241,13 @@
butchering_products = list(/obj/item/reagent_containers/food/snacks/spreads/lard = 1)
/mob/living/simple_animal/schlorrgo/cybernetic/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1)
+ if(EMP_HEAVY)
adjustFireLoss(rand(10, 15))
- if(2)
+ if(EMP_LIGHT)
adjustFireLoss(rand(5, 10))
- if(3)
- adjustFireLoss(rand(3, 5))
/mob/living/simple_animal/schlorrgo/cybernetic/check_wideness_change()
return
@@ -304,13 +304,13 @@
ranged = TRUE
/mob/living/simple_animal/hostile/cybernetic_schlorrgo/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1)
+ if(EMP_HEAVY)
adjustFireLoss(rand(10, 15))
- if(2)
+ if(EMP_LIGHT)
adjustFireLoss(rand(5, 10))
- if(3)
- adjustFireLoss(rand(3, 5))
/mob/living/simple_animal/hostile/cybernetic_schlorrgo/death(gibbed)
..(null, "dies!")
diff --git a/code/modules/mob/living/simple_animal/hostile/commanded/guard_dog.dm b/code/modules/mob/living/simple_animal/hostile/commanded/guard_dog.dm
index 79b18fb7127..b51670bc3fb 100644
--- a/code/modules/mob/living/simple_animal/hostile/commanded/guard_dog.dm
+++ b/code/modules/mob/living/simple_animal/hostile/commanded/guard_dog.dm
@@ -144,10 +144,10 @@
meat_amount = 3
/mob/living/simple_animal/hostile/commanded/dog/harron/cybernetic/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1)
+ if(EMP_HEAVY)
adjustFireLoss(rand(10, 15))
- if(2)
+ if(EMP_LIGHT)
adjustFireLoss(rand(5, 10))
- if(3)
- adjustFireLoss(rand(3, 5))
diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
index 85f7ad80791..7da9e4f49e7 100644
--- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
+++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
@@ -169,7 +169,7 @@
C.use(C.maxcharge / 15)
if(istype(limb) && HAS_FLAG(limb.status, ORGAN_ROBOT|ORGAN_ADV_ROBOT))
H.visible_message(SPAN_WARNING("\The [src] bites down onto \the [H]'s [limb.name]!"), SPAN_WARNING("\The [src] bites down onto your [limb.name]!"))
- limb.emp_act(2)
+ limb.emp_act(EMP_LIGHT)
/mob/living/simple_animal/hostile/giant_spider/think()
..()
diff --git a/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot.dm b/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot.dm
index 986d91e356d..81b45ace41a 100644
--- a/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot.dm
+++ b/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot.dm
@@ -174,6 +174,8 @@
return 0
/mob/living/simple_animal/hostile/hivebot/emp_act(severity)
+ . = ..()
+
LoseTarget()
change_stance(HOSTILE_STANCE_TIRED)
addtimer(CALLBACK(src, PROC_REF(wakeup)), 50)
diff --git a/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot_beacon.dm b/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot_beacon.dm
index 27826e9b82f..767a01be86c 100644
--- a/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot_beacon.dm
+++ b/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot_beacon.dm
@@ -154,7 +154,9 @@
else
..(Proj)
-/mob/living/simple_animal/hostile/hivebotbeacon/emp_act()
+/mob/living/simple_animal/hostile/hivebotbeacon/emp_act(severity)
+ . = ..()
+
if(activated != -1)
LoseTarget()
change_stance(HOSTILE_STANCE_TIRED)
diff --git a/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot_harvester.dm b/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot_harvester.dm
index c98214e8988..f3ae47cd03b 100644
--- a/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot_harvester.dm
+++ b/code/modules/mob/living/simple_animal/hostile/hivebots/hivebot_harvester.dm
@@ -82,6 +82,8 @@
return ..(Proj)
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/emp_act(severity)
+ . = ..()
+
LoseTarget()
change_stance(HOSTILE_STANCE_IDLE)
visible_message(SPAN_DANGER("[src] suffers a teleportation malfunction!"))
diff --git a/code/modules/mob/living/simple_animal/hostile/icarus_drone.dm b/code/modules/mob/living/simple_animal/hostile/icarus_drone.dm
index e68fb596e12..a1cfcf88e52 100644
--- a/code/modules/mob/living/simple_animal/hostile/icarus_drone.dm
+++ b/code/modules/mob/living/simple_animal/hostile/icarus_drone.dm
@@ -229,6 +229,8 @@
//ion rifle!
/mob/living/simple_animal/hostile/icarus_drone/emp_act(severity)
+ . = ..()
+
health -= rand(3, 15) * (severity + 1)
disabled = rand(150, 600)
hostile_drone = FALSE
diff --git a/code/modules/mob/living/simple_animal/hostile/viscerator.dm b/code/modules/mob/living/simple_animal/hostile/viscerator.dm
index 0bf88d96eb4..2626ea988bf 100644
--- a/code/modules/mob/living/simple_animal/hostile/viscerator.dm
+++ b/code/modules/mob/living/simple_animal/hostile/viscerator.dm
@@ -50,10 +50,12 @@
change_stance(HOSTILE_STANCE_IDLE)
/mob/living/simple_animal/hostile/viscerator/emp_act(severity)
+ . = ..()
+
LoseTarget()
change_stance(HOSTILE_STANCE_TIRED)
addtimer(CALLBACK(src, PROC_REF(wakeup)), 150)
- if(severity == 1.0)
+ if(severity == EMP_HEAVY)
apply_damage(5)
/mob/living/simple_animal/hostile/viscerator/lube
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 5b690feb6eb..209daced485 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -920,18 +920,16 @@
return FALSE
/mob/living/simple_animal/emp_act(severity)
+ . = ..()
+
if(!isSynthetic())
return
switch(severity)
- if(1)
+ if(EMP_HEAVY)
adjustFireLoss(rand(20, 25))
- if(2)
+ if(EMP_LIGHT)
adjustFireLoss(rand(10, 15))
- if(3)
- adjustFireLoss(rand(5, 10))
- if(4)
- adjustFireLoss(rand(3, 5))
/mob/living/simple_animal/get_digestion_product()
return /singleton/reagent/nutriment
diff --git a/code/modules/modular_computers/computers/modular_computer/damage.dm b/code/modules/modular_computers/computers/modular_computer/damage.dm
index 4a3857fab78..e0b9576937a 100644
--- a/code/modules/modular_computers/computers/modular_computer/damage.dm
+++ b/code/modules/modular_computers/computers/modular_computer/damage.dm
@@ -44,7 +44,9 @@
take_damage(rand(125, 200) / severity, 30 / severity, msg = FALSE)
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
-/obj/item/modular_computer/emp_act(var/severity)
+/obj/item/modular_computer/emp_act(severity)
+ . = ..()
+
take_damage(rand(100, 200) / severity, 50 / severity, FALSE)
// "Stun" weapons can cause minor damage to components (short-circuits?)
diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm
index 027bb8257d4..701d0b1b1f5 100644
--- a/code/modules/organs/organ.dm
+++ b/code/modules/organs/organ.dm
@@ -388,7 +388,9 @@
name = "mechanically assisted [initial(name)]"
icon_state = initial(icon_state)
-/obj/item/organ/emp_act(var/severity)
+/obj/item/organ/emp_act(severity)
+ . = ..()
+
if(!(status & ORGAN_ASSISTED))
return
@@ -398,12 +400,10 @@
organ_fragility = 1
switch (severity)
- if (1.0)
+ if (EMP_HEAVY)
take_surge_damage(15 * emp_coeff * organ_fragility)
- if (2.0)
+ if (EMP_LIGHT)
take_surge_damage(8 * emp_coeff * organ_fragility)
- if(3.0)
- take_surge_damage(4 * emp_coeff * organ_fragility)
return TRUE
diff --git a/code/modules/organs/subtypes/augment.dm b/code/modules/organs/subtypes/augment.dm
index 1cd885017a6..cb998f0f5e8 100644
--- a/code/modules/organs/subtypes/augment.dm
+++ b/code/modules/organs/subtypes/augment.dm
@@ -311,10 +311,12 @@
return
/obj/item/organ/internal/augment/eye_sensors/emp_act(severity)
- ..()
+ . = ..()
+
var/obj/item/organ/internal/eyes/E = owner.get_eyes()
if(!E)
return
+
E.take_damage(5)
/obj/item/organ/internal/augment/eye_sensors/proc/check_hud(var/hud)
@@ -453,9 +455,11 @@
/obj/item/organ/internal/augment/language/emp_act()
. = ..()
+
for(var/language in added_languages)
if(prob(25))
owner.remove_language(language)
+
owner.set_default_language(pick(owner.languages))
/obj/item/organ/internal/augment/language/klax
@@ -582,7 +586,8 @@
return TRUE
/obj/item/organ/internal/augment/memory_inhibitor/emp_act(severity)
- ..()
+ . = ..()
+
if(prob(25))
do_broken_act()
@@ -658,10 +663,12 @@
owner.visible_message(zoom ? "[owner]'s pupils narrow..." : "[owner]'s pupils return to normal.", range = 3)
/obj/item/organ/internal/augment/enhanced_vision/emp_act(severity)
- ..()
+ . = ..()
+
var/obj/item/organ/internal/eyes/E = owner.get_eyes()
if(!E)
return
+
E.take_damage(5)
/obj/item/organ/internal/augment/sightlights
diff --git a/code/modules/organs/subtypes/autakh.dm b/code/modules/organs/subtypes/autakh.dm
index 44587698bbf..5c320ce2480 100644
--- a/code/modules/organs/subtypes/autakh.dm
+++ b/code/modules/organs/subtypes/autakh.dm
@@ -92,7 +92,8 @@
suffered_revelation = TRUE
/obj/item/organ/internal/anchor/emp_act(severity)
- ..()
+ . = ..()
+
revelation()
/obj/item/organ/internal/anchor/proc/revelation()
@@ -225,7 +226,8 @@
warning_level = 0
/obj/item/organ/internal/augment/eye_flashlight/emp_act(severity)
- ..()
+ . = ..()
+
turn_off()
/obj/item/organ/internal/augment/eye_flashlight/proc/add_warning()
diff --git a/code/modules/organs/subtypes/machine.dm b/code/modules/organs/subtypes/machine.dm
index 4ccbb662f77..9bc9d0a24df 100644
--- a/code/modules/organs/subtypes/machine.dm
+++ b/code/modules/organs/subtypes/machine.dm
@@ -111,7 +111,8 @@
return servo_cost
/obj/item/organ/internal/cell/emp_act(severity)
- ..()
+ . = ..()
+
if(cell)
cell.emp_act(severity)
diff --git a/code/modules/overmap/ship_weaponry/weaponry/leviathan.dm b/code/modules/overmap/ship_weaponry/weaponry/leviathan.dm
index ef292358d36..4450ad34443 100644
--- a/code/modules/overmap/ship_weaponry/weaponry/leviathan.dm
+++ b/code/modules/overmap/ship_weaponry/weaponry/leviathan.dm
@@ -288,6 +288,8 @@
return
/obj/machinery/leviathan_safeguard/emp_act(severity)
+ . = ..()
+
return
/obj/machinery/leviathan_safeguard/Destroy()
@@ -359,6 +361,8 @@
return
/obj/machinery/leviathan_button/emp_act(severity)
+ . = ..()
+
return
/obj/machinery/leviathan_button/proc/open()
diff --git a/code/modules/overmap/ships/computers/sensors.dm b/code/modules/overmap/ships/computers/sensors.dm
index b5004e4493e..9664ab64e3f 100644
--- a/code/modules/overmap/ships/computers/sensors.dm
+++ b/code/modules/overmap/ships/computers/sensors.dm
@@ -529,8 +529,11 @@
change_power_consumption(1500 * (range**2), POWER_USE_ACTIVE)
/obj/machinery/shipsensors/emp_act(severity)
+ . = ..()
+
if(!use_power)
return
+
take_damage(20/severity)
toggle()
diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm
index 77c6eda3ffb..2b90e55598a 100644
--- a/code/modules/power/antimatter/control.dm
+++ b/code/modules/power/antimatter/control.dm
@@ -98,17 +98,18 @@
playsound(get_turf(src), 'sound/effects/bang.ogg', 50, 1)
/obj/machinery/power/am_control_unit/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1)
+ if(EMP_HEAVY)
if(active)
toggle_power()
stability -= rand(15, 30)
- if(2)
+ if(EMP_LIGHT)
if(active)
toggle_power()
stability -= rand(10, 20)
check_stability()
- ..()
/obj/machinery/power/am_control_unit/ex_act(severity)
switch(severity)
diff --git a/code/modules/power/antimatter/shielding.dm b/code/modules/power/antimatter/shielding.dm
index 0b161c51f12..8c9351a9fc0 100644
--- a/code/modules/power/antimatter/shielding.dm
+++ b/code/modules/power/antimatter/shielding.dm
@@ -110,7 +110,9 @@
/obj/machinery/am_shielding/emp_act()//Immune due to not really much in the way of electronics.
- return FALSE
+ . = ..()
+
+ return
/obj/machinery/am_shielding/ex_act(severity)
switch(severity)
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 793f77f0685..0ab1ff4f1d3 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -1530,6 +1530,8 @@
// damage and destruction acts
/obj/machinery/power/apc/emp_act(severity)
+ . = ..()
+
if(cell)
cell.emp_act(severity)
@@ -1540,7 +1542,6 @@
update_icon()
addtimer(CALLBACK(src, PROC_REF(post_emp_act)), 600)
- ..()
/obj/machinery/power/apc/proc/post_emp_act()
update_channels()
diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm
index 4a85c394a1c..a15af386222 100644
--- a/code/modules/power/cell.dm
+++ b/code/modules/power/cell.dm
@@ -168,6 +168,8 @@
rigged = 1 //broken batterys are dangerous
/obj/item/cell/emp_act(severity)
+ . = ..()
+
//remove this once emp changes on dev are merged in
if(isrobot(loc))
var/mob/living/silicon/robot/R = loc
@@ -176,7 +178,22 @@
charge -= maxcharge / severity
if (charge < 0)
charge = 0
- ..()
+
+/**
+ * Drains a percentage of the power from the battery
+ *
+ * * divisor - The fraction to remove, after multiplication with `cell_emp_mult` if a robot, calculated as maxcharge / divisor
+ */
+/obj/item/cell/proc/powerdrain(divisor)
+ SHOULD_NOT_SLEEP(TRUE)
+
+ if(isrobot(loc))
+ var/mob/living/silicon/robot/R = loc
+ divisor *= R.cell_emp_mult
+
+ charge -= maxcharge / divisor
+ if (charge < 0)
+ charge = 0
/obj/item/cell/ex_act(severity)
diff --git a/code/modules/power/fusion/core/core_field.dm b/code/modules/power/fusion/core/core_field.dm
index bbe49dda10c..ed95b4b99f3 100644
--- a/code/modules/power/fusion/core/core_field.dm
+++ b/code/modules/power/fusion/core/core_field.dm
@@ -424,7 +424,6 @@
/obj/effect/fusion_em_field/proc/Radiate()
if(istype(loc, /turf))
- var/empsev = max(1, min(3, Ceil(size/2)))
for(var/atom/movable/AM in range(max(1,Floor(size/2)), loc))
if(AM == src || AM == owned_core || !AM.simulated)
@@ -440,7 +439,7 @@
AM.visible_message(SPAN_DANGER("The field buckles visibly around \the [AM]!"))
tick_instability += rand(30,50)
- AM.emp_act(empsev)
+ AM.emp_act(EMP_LIGHT)
if(owned_core && owned_core.loc)
var/datum/gas_mixture/environment = owned_core.loc.return_air()
diff --git a/code/modules/power/portgen.dm b/code/modules/power/portgen.dm
index 779698d4e63..ca9cbb19a89 100644
--- a/code/modules/power/portgen.dm
+++ b/code/modules/power/portgen.dm
@@ -75,17 +75,16 @@
to_chat(user, SPAN_NOTICE("The generator is off."))
/obj/machinery/power/portgen/emp_act(severity)
+ . = ..()
+
var/duration = 6000 //ten minutes
switch(severity)
- if(1)
+ if(EMP_HEAVY)
stat &= BROKEN
if(prob(75)) explode()
- if(2)
+ if(EMP_LIGHT)
if(prob(25)) stat &= BROKEN
if(prob(10)) explode()
- if(3)
- if(prob(10)) stat &= BROKEN
- duration = 300
stat |= EMPED
if(duration)
diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm
index 1fd4eac0d48..84d73784bb2 100644
--- a/code/modules/power/singularity/emitter.dm
+++ b/code/modules/power/singularity/emitter.dm
@@ -111,7 +111,9 @@
return TRUE
-/obj/machinery/power/emitter/emp_act()
+/obj/machinery/power/emitter/emp_act(severity)
+ . = ..()
+
activate(null)
return TRUE
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index e5d069a939a..f2b2ef920aa 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -155,7 +155,9 @@ field_generator power level display
return
-/obj/machinery/field_generator/emp_act()
+/obj/machinery/field_generator/emp_act(severity)
+ . = ..()
+
return 0
/obj/machinery/field_generator/bullet_act(var/obj/item/projectile/Proj)
diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm
index 10b66fda908..b3c9895368a 100644
--- a/code/modules/power/smes.dm
+++ b/code/modules/power/smes.dm
@@ -478,9 +478,9 @@
else if(prob(15)) //Power drain
small_spark.queue()
if(prob(50))
- emp_act(1)
+ emp_act(EMP_HEAVY)
else
- emp_act(2)
+ emp_act(EMP_LIGHT)
else if(prob(5)) //smoke only
var/datum/effect/effect/system/smoke_spread/smoke = new /datum/effect/effect/system/smoke_spread()
smoke.set_up(3, 0, src.loc)
@@ -500,6 +500,8 @@
outputting = 0
/obj/machinery/power/smes/emp_act(severity)
+ . = ..()
+
if(prob(50))
inputting(rand(0,1))
outputting(rand(0,1))
@@ -513,7 +515,6 @@
if(prob(50))
energy_fail(rand(0 + (severity * 30),30 + (severity * 30)))
update_icon()
- ..()
/obj/machinery/power/smes/magical
diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm
index d8fb6c1b905..7a3c87c9740 100644
--- a/code/modules/power/tesla/energy_ball.dm
+++ b/code/modules/power/tesla/energy_ball.dm
@@ -430,7 +430,7 @@
if(issilicon(closest_mob))
var/mob/living/silicon/S = closest_mob
if(stun_mobs)
- S.emp_act(2)
+ S.emp_act(EMP_LIGHT)
tesla_zap(S, 7, power / 1.5, explosive, stun_mobs) // metallic folks bounce it further
else
tesla_zap(closest_mob, 5, power / 1.5, explosive, stun_mobs)
diff --git a/code/modules/projectiles/ammunition/bullets.dm b/code/modules/projectiles/ammunition/bullets.dm
index db8a80fc88f..4bea4daf47c 100644
--- a/code/modules/projectiles/ammunition/bullets.dm
+++ b/code/modules/projectiles/ammunition/bullets.dm
@@ -182,7 +182,11 @@
reload_sound = 'sound/weapons/reload_shell_emp.ogg'
/obj/item/ammo_casing/shotgun/stunshell/emp_act(severity)
- if(prob(100/severity)) BB = null
+ . = ..()
+
+ if(prob(100/severity))
+ BB = null
+
update_icon()
//Does not stun, only blinds, but has area of effect.
diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm
index 9edd7c56b86..2b1675cf280 100644
--- a/code/modules/projectiles/guns/energy.dm
+++ b/code/modules/projectiles/guns/energy.dm
@@ -46,8 +46,9 @@
if(.)
update_icon()
-/obj/item/gun/energy/emp_act(var/severity)
- ..()
+/obj/item/gun/energy/emp_act(severity)
+ . = ..()
+
disable_cell_temp(severity)
queue_icon_update()
diff --git a/code/modules/projectiles/guns/energy/nuclear.dm b/code/modules/projectiles/guns/energy/nuclear.dm
index f6c2c6a030e..8500ead260b 100644
--- a/code/modules/projectiles/guns/energy/nuclear.dm
+++ b/code/modules/projectiles/guns/energy/nuclear.dm
@@ -210,6 +210,8 @@
secondary_fire_sound = 'sound/weapons/laser3.ogg'
/obj/item/gun/energy/gun/skrell/emp_act(severity)
+ . = ..()
+
return //Fuck robots.
/obj/item/gun/energy/gun/skrell/pistol
diff --git a/code/modules/projectiles/guns/energy/rifle.dm b/code/modules/projectiles/guns/energy/rifle.dm
index e7d8d12ecee..94d3186f7c0 100644
--- a/code/modules/projectiles/guns/energy/rifle.dm
+++ b/code/modules/projectiles/guns/energy/rifle.dm
@@ -221,7 +221,7 @@
firemodes = list()
/obj/item/gun/energy/rifle/ionrifle/emp_act(severity)
- ..(max(severity, 2)) //so it doesn't EMP itself, I guess
+ . = ..()
/obj/item/gun/energy/rifle/ionrifle/mounted
name = "mounted ion rifle"
diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm
index 63f9a412528..9914a87744f 100644
--- a/code/modules/projectiles/projectile/special.dm
+++ b/code/modules/projectiles/projectile/special.dm
@@ -44,9 +44,9 @@
else
to_chat(src, "Warning: Power surge detected, source - EMP. Surge prevention module is depleted and requires replacement")
- R.emp_act(2) // Borgs emp_act is 1-2
+ R.emp_act(EMP_LIGHT) // Borgs emp_act is 1-2
else
- A.emp_act(3)
+ A.emp_act(EMP_LIGHT)
return
/obj/item/projectile/ion/small
diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm
index bb92d58e36f..93992058f9b 100644
--- a/code/modules/research/rdconsole.dm
+++ b/code/modules/research/rdconsole.dm
@@ -167,11 +167,13 @@ won't update every console in existence) but it's more of a hassle to do. Also,
src.updateUsrDialog()
return
-/obj/machinery/computer/rdconsole/emp_act(var/remaining_charges, var/mob/user)
+/obj/machinery/computer/rdconsole/emp_act(severity)
+ . = ..()
+
if(!emagged)
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
emagged = 1
- to_chat(user, "You you disable the security protocols.")
+ to_chat(usr, "You you disable the security protocols.")
return 1
/obj/machinery/computer/rdconsole/Topic(href, href_list)
diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm
index b748a545852..c071c4cd00b 100644
--- a/code/modules/research/server.dm
+++ b/code/modules/research/server.dm
@@ -96,8 +96,9 @@
TP.processing_stage = 0
/obj/machinery/r_n_d/server/emp_act(severity)
+ . = ..()
+
griefProtection()
- ..()
/obj/machinery/r_n_d/server/ex_act(severity)
griefProtection()
diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm
index 8273f15b13b..0ae10fe653c 100644
--- a/code/modules/shieldgen/emergency_shield.dm
+++ b/code/modules/shieldgen/emergency_shield.dm
@@ -95,10 +95,13 @@
return
/obj/machinery/shield/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1)
+ if(EMP_HEAVY)
qdel(src)
- if(2)
+
+ if(EMP_LIGHT)
if(prob(50))
qdel(src)
@@ -256,12 +259,14 @@
return
/obj/machinery/shieldgen/emp_act(severity)
+ . = ..()
+
switch(severity)
- if(1)
+ if(EMP_HEAVY)
src.health /= 2 //cut health in half
malfunction = TRUE
locked = pick(0,1)
- if(2)
+ if(EMP_LIGHT)
if(prob(50))
src.health *= 0.3 //chop off a third of the health
malfunction = TRUE
diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm
index 219935eb64e..bb09fe7adb8 100644
--- a/code/modules/shuttles/shuttle_console.dm
+++ b/code/modules/shuttles/shuttle_console.dm
@@ -165,5 +165,7 @@
/obj/machinery/computer/shuttle_control/ex_act()
return
-/obj/machinery/computer/shuttle_control/emp_act()
+/obj/machinery/computer/shuttle_control/emp_act(severity)
+ . = ..()
+
return
diff --git a/code/modules/spell_system/artifacts/items/poppet.dm b/code/modules/spell_system/artifacts/items/poppet.dm
index 0cdb9cc064b..88cf9a8337e 100644
--- a/code/modules/spell_system/artifacts/items/poppet.dm
+++ b/code/modules/spell_system/artifacts/items/poppet.dm
@@ -123,6 +123,8 @@
H.throw_at(get_edge_target_turf(H,pick(alldirs)), 5, 1)
/obj/item/poppet/emp_act(severity)
+ . = ..()
+
var/mob/living/carbon/human/H = target.resolve()
if(H)
H.emp_act(severity)
diff --git a/code/modules/telesci/gps.dm b/code/modules/telesci/gps.dm
index a8c65dc3d63..2f98429fa2e 100644
--- a/code/modules/telesci/gps.dm
+++ b/code/modules/telesci/gps.dm
@@ -119,6 +119,8 @@ var/list/GPS_list = list()
R.client.screen -= compass
/obj/item/device/gps/emp_act(severity)
+ . = ..()
+
emped = TRUE
addtimer(CALLBACK(src, PROC_REF(post_emp)), 30 SECONDS)
update_icon()
diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm
index beab86dc104..10092f539ae 100644
--- a/code/modules/vehicles/vehicle.dm
+++ b/code/modules/vehicles/vehicle.dm
@@ -151,8 +151,11 @@
return
/obj/vehicle/emp_act(severity)
+ . = ..()
+
if(organic)
return
+
var/was_on = on
stat |= EMPED
var/obj/effect/overlay/pulse2 = new /obj/effect/overlay(src.loc)
diff --git a/html/changelogs/fluffyghost-emprefactor.yml b/html/changelogs/fluffyghost-emprefactor.yml
new file mode 100644
index 00000000000..5125452c7cc
--- /dev/null
+++ b/html/changelogs/fluffyghost-emprefactor.yml
@@ -0,0 +1,57 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+# balance
+# admin
+# backend
+# security
+# refactor
+#################################
+
+# Your name.
+author: FluffyGhost
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - refactor: "EMPs are now consistent across the various objects."
+ - refactor: "EMPs damage is now standarized with EMP_HEAVY and EMP_LIGHT."
+ - backend: "Updated DCS part that deals with unique signals."
+ - rscadd: "Added DCS signals COMSIG_ATOM_PRE_EMP_ACT and COMSIG_ATOM_EMP_ACT for EMP events."
+ - backend: "Added datum component for EMP protection handling."
+ - rscadd: "EMP explosions (empulse) are now tridimensional, spreading across the decks/zlevels of the same map."
+ - rscadd: "EMP explosions (empulse) behave properly as a sphere between zlevels, with 9 meters being the currently assumed floor height."
+ - bugfix: "empulse now respects the tick limit, avoiding the server lagging to death on large or expensive EMPs."
+ - backend: "ELEMENT_DETACH flag was renamed to ELEMENT_DETACH_ON_HOST_DESTROY, as per TG updated name."
+ - backend: "EMPs now rise signals of the events through DCS."
+ - backend: "(Nearly) all emp_act now calls the parent first, properly and consistently handling signals."
+ - rscadd: "The spiral_range search function was ported over from TG, it is used by empulse."
+ - refactor: "All emp_act now calls the parent."
+ - refactor: "All emp_act now uses the defined damage, instead of the magic numbers."
+ - refactor: "EMP magic number 3 do not exist anymore, standarized everything that used it back into EMP_LIGHT."
+ - refactor: "Some function substitution for EMP that was not meant to behave like an EMP for other objects."
+ - rscadd: "The empulse function can now exclude types, in addition to objects."