diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm
index 5e0669880c7..cf73d207a6b 100644
--- a/code/__DEFINES/flags.dm
+++ b/code/__DEFINES/flags.dm
@@ -23,9 +23,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define ON_BORDER_1 (1<<9) // item has priority to check when entering or leaving
#define DROPDEL_1 (1<<10) // When dropped, it calls qdel on itself
#define PREVENT_CLICK_UNDER_1 (1<<11) //Prevent clicking things below it on the same turf eg. doors/ fulltile windows
-#define NO_EMP_WIRES_1 (1<<12)
-#define HOLOGRAM_1 (1<<13)
-#define TESLA_IGNORE_1 (1<<14) // TESLA_IGNORE grants immunity from being targeted by tesla-style electricity
+#define HOLOGRAM_1 (1<<12)
+#define TESLA_IGNORE_1 (1<<13) // TESLA_IGNORE grants immunity from being targeted by tesla-style electricity
//turf-only flags
@@ -66,3 +65,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define ACID_PROOF (1<<5) //acid stuck on it doesn't melt it.
#define INDESTRUCTIBLE (1<<6) //doesn't take damage
#define FREEZE_PROOF (1<<7) //can't be frozen
+
+#define EMP_PROTECT_SELF (1<<0)
+#define EMP_PROTECT_CONTENTS (1<<1)
+#define EMP_PROTECT_WIRES (1<<2)
diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm
index a5270a8aded..bd95c8550fe 100644
--- a/code/_globalvars/bitfields.dm
+++ b/code/_globalvars/bitfields.dm
@@ -118,7 +118,6 @@ GLOBAL_LIST_INIT(bitfields, list(
"ABSTRACT_1" = ABSTRACT_1,
"NODECONSTRUCT_1" = NODECONSTRUCT_1,
"OVERLAY_QUEUED_1" = OVERLAY_QUEUED_1,
- "NO_EMP_WIRES_1" = NO_EMP_WIRES_1,
"HOLOGRAM_1" = HOLOGRAM_1,
"TESLA_IGNORE_1" = TESLA_IGNORE_1
),
diff --git a/code/datums/components/empprotection.dm b/code/datums/components/empprotection.dm
new file mode 100644
index 00000000000..d9164529c6a
--- /dev/null
+++ b/code/datums/components/empprotection.dm
@@ -0,0 +1,11 @@
+/datum/component/empprotection
+ var/flags = NONE
+
+/datum/component/empprotection/Initialize(_flags)
+ if(!istype(parent, /atom))
+ return COMPONENT_INCOMPATIBLE
+ flags = _flags
+ RegisterSignal(list(COMSIG_ATOM_EMP_ACT), .proc/getEmpFlags)
+
+/datum/component/empprotection/proc/getEmpFlags(severity)
+ return flags
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index c308aec45ff..36b4b388b4e 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -221,9 +221,10 @@
return
/atom/proc/emp_act(severity)
- SendSignal(COMSIG_ATOM_EMP_ACT, severity)
- if(istype(wires) && !(flags_1 & NO_EMP_WIRES_1))
+ var/protection = SendSignal(COMSIG_ATOM_EMP_ACT, severity)
+ if(!(protection & EMP_PROTECT_WIRES) && istype(wires))
wires.emp_pulse()
+ return protection // Pass the protection value collected here upwards
/atom/proc/bullet_act(obj/item/projectile/P, def_zone)
SendSignal(COMSIG_ATOM_BULLET_ACT, P, def_zone)
diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm
index d745df25fbf..d7d1288ab33 100644
--- a/code/game/machinery/Sleeper.dm
+++ b/code/game/machinery/Sleeper.dm
@@ -78,9 +78,11 @@
to_chat(occupant, "[enter_message]")
/obj/machinery/sleeper/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
if(is_operational() && occupant)
open_machine()
- ..(severity)
/obj/machinery/sleeper/MouseDrop_T(mob/target, mob/user)
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser())
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 61d5dbe5f63..1ea4b09ee8f 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -153,10 +153,10 @@ Class Procs:
return PROCESS_KILL
/obj/machinery/emp_act(severity)
- if(use_power && !stat)
+ . = ..()
+ if(use_power && !stat && !(. & EMP_PROTECT_SELF))
use_power(7500/severity)
new /obj/effect/temp_visual/emp(loc)
- ..()
/obj/machinery/proc/open_machine(drop = TRUE)
state_open = TRUE
diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm
index 8438c8b3b58..625e327f5d6 100644
--- a/code/game/machinery/announcement_system.dm
+++ b/code/game/machinery/announcement_system.dm
@@ -169,9 +169,9 @@ GLOBAL_LIST_EMPTY(announcement_systems)
newhead = pick("OV#RL()D: \[UNKNOWN??\] DET*#CT)D!", "ER)#R - B*@ TEXT F*O(ND!", "AAS.exe is not responding. NanoOS is searching for a solution to the problem.")
/obj/machinery/announcement_system/emp_act(severity)
- if(!(stat & (NOPOWER|BROKEN)))
+ . = ..()
+ if(!(stat & (NOPOWER|BROKEN)) && !(. & EMP_PROTECT_SELF))
act_up()
- ..(severity)
/obj/machinery/announcement_system/emag_act()
if(obj_flags & EMAGGED)
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index d19270f04e7..a0fa11ac1d7 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -77,9 +77,10 @@
return ..()
/obj/machinery/camera/emp_act(severity)
+ . = ..()
if(!status)
return
- if(!isEmpProof())
+ if(!(. & EMP_PROTECT_SELF))
if(prob(150/severity))
update_icon()
var/list/previous_network = network
@@ -107,7 +108,6 @@
M.unset_machine()
M.reset_perspective(null)
to_chat(M, "The screen bursts into static.")
- ..()
/obj/machinery/camera/tesla_act(var/power)//EMP proof upgrade also makes it tesla immune
if(isEmpProof())
diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm
index e330d015dfb..f4963102c6f 100644
--- a/code/game/machinery/camera/presets.dm
+++ b/code/game/machinery/camera/presets.dm
@@ -75,6 +75,7 @@
// UPGRADE PROCS
/obj/machinery/camera/proc/upgradeEmpProof()
+ AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES | EMP_PROTECT_CONTENTS)
assembly.upgrades.Add(new /obj/item/stack/sheet/mineral/plasma(assembly))
upgrades |= CAMERA_UPGRADE_EMP_PROOF
diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm
index 3ccf7efef00..e6816a3170b 100644
--- a/code/game/machinery/cell_charger.dm
+++ b/code/game/machinery/cell_charger.dm
@@ -54,7 +54,7 @@
user.visible_message("[user] inserts a cell into [src].", "You insert a cell into [src].")
chargelevel = -1
updateicon()
- else
+ else
if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W))
return
if(default_deconstruction_crowbar(W))
@@ -105,14 +105,14 @@
return
/obj/machinery/cell_charger/emp_act(severity)
- if(stat & (BROKEN|NOPOWER))
+ . = ..()
+
+ if(stat & (BROKEN|NOPOWER) || . & EMP_PROTECT_CONTENTS)
return
if(charging)
charging.emp_act(severity)
- ..(severity)
-
/obj/machinery/cell_charger/RefreshParts()
charge_rate = 500
for(var/obj/item/stock_parts/capacitor/C in component_parts)
@@ -128,4 +128,3 @@
charging.give(charge_rate) //this is 2558, efficient batteries exist
updateicon()
-
\ No newline at end of file
diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm
index f52506ae040..003c33c0e7c 100644
--- a/code/game/machinery/cloning.dm
+++ b/code/game/machinery/cloning.dm
@@ -402,12 +402,13 @@
go_out()
/obj/machinery/clonepod/emp_act(severity)
- var/mob/living/mob_occupant = occupant
- if(mob_occupant && prob(100/(severity*efficiency)))
- connected_message(Gibberish("EMP-caused Accidental Ejection", 0))
- SPEAK(Gibberish("Exposure to electromagnetic fields has caused the ejection of [mob_occupant.real_name] prematurely." ,0))
- go_out()
- ..()
+ . = ..()
+ if (!(. & EMP_PROTECT_SELF))
+ var/mob/living/mob_occupant = occupant
+ if(mob_occupant && prob(100/(severity*efficiency)))
+ connected_message(Gibberish("EMP-caused Accidental Ejection", 0))
+ SPEAK(Gibberish("Exposure to electromagnetic fields has caused the ejection of [mob_occupant.real_name] prematurely." ,0))
+ go_out()
/obj/machinery/clonepod/ex_act(severity, target)
..()
diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm
index 4d9acb0586b..cbb68065810 100644
--- a/code/game/machinery/computer/_computer.dm
+++ b/code/game/machinery/computer/_computer.dm
@@ -95,14 +95,15 @@
set_light(0)
/obj/machinery/computer/emp_act(severity)
- switch(severity)
- if(1)
- if(prob(50))
- obj_break("energy")
- if(2)
- if(prob(10))
- obj_break("energy")
- ..()
+ . = ..()
+ if (!(. & EMP_PROTECT_SELF))
+ switch(severity)
+ if(1)
+ if(prob(50))
+ obj_break("energy")
+ if(2)
+ if(prob(10))
+ obj_break("energy")
/obj/machinery/computer/deconstruct(disassembled = TRUE, mob/user)
on_deconstruction()
diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm
index 46898bb2d70..9dad813677b 100644
--- a/code/game/machinery/computer/arcade.dm
+++ b/code/game/machinery/computer/arcade.dm
@@ -85,9 +85,9 @@
prize.forceMove(get_turf(src))
/obj/machinery/computer/arcade/emp_act(severity)
- ..(severity)
+ . = ..()
- if(stat & (NOPOWER|BROKEN))
+ if(stat & (NOPOWER|BROKEN) || . & EMP_PROTECT_SELF)
return
var/empprize = null
diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm
index d0a9251fbd3..fc3c32cd4d8 100644
--- a/code/game/machinery/computer/medical.dm
+++ b/code/game/machinery/computer/medical.dm
@@ -553,7 +553,8 @@
return
/obj/machinery/computer/med_data/emp_act(severity)
- if(!(stat & (BROKEN|NOPOWER)))
+ . = ..()
+ if(!(stat & (BROKEN|NOPOWER)) && !(. & EMP_PROTECT_SELF))
for(var/datum/data/record/R in GLOB.data_core.medical)
if(prob(10/severity))
switch(rand(1,6))
@@ -577,7 +578,6 @@
else if(prob(1))
qdel(R)
continue
- ..()
/obj/machinery/computer/med_data/proc/canUseMedicalRecordsConsole(mob/user, message = 1, record1, record2)
if(user)
diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm
index 3d9b909f996..6c04d393fee 100644
--- a/code/game/machinery/computer/security.dm
+++ b/code/game/machinery/computer/security.dm
@@ -783,8 +783,9 @@ What a mess.*/
printing = FALSE
/obj/machinery/computer/secure_data/emp_act(severity)
- if(stat & (BROKEN|NOPOWER))
- ..(severity)
+ . = ..()
+
+ if(stat & (BROKEN|NOPOWER) || . & EMP_PROTECT_SELF)
return
for(var/datum/data/record/R in GLOB.data_core.security)
@@ -817,8 +818,6 @@ What a mess.*/
qdel(R)
continue
- ..(severity)
-
/obj/machinery/computer/secure_data/proc/canUseSecurityRecordsConsole(mob/user, message1 = 0, record1, record2)
if(user)
if(authenticated)
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index ed92d9f385e..b9ee6862d50 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -208,6 +208,9 @@
playsound(src.loc, 'sound/items/welder.ogg', 100, 1)
/obj/machinery/door/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
if(prob(20/severity) && (istype(src, /obj/machinery/door/airlock) || istype(src, /obj/machinery/door/window)) )
INVOKE_ASYNC(src, .proc/open)
if(prob(severity*10 - 20))
@@ -215,7 +218,6 @@
secondsElectrified = -1
shockedby += "\[[time_stamp()]\]EM Pulse"
addtimer(CALLBACK(src, .proc/unelectrify), 300)
- ..()
/obj/machinery/door/proc/unelectrify()
secondsElectrified = 0
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index 0bdbd8976ad..b2e1ad7e5b0 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -81,9 +81,13 @@
add_overlay("overlay_fire")
/obj/machinery/firealarm/emp_act(severity)
+ . = ..()
+
+ if (. & EMP_PROTECT_SELF)
+ return
+
if(prob(50 / severity))
alarm()
- ..()
/obj/machinery/firealarm/emag_act(mob/user)
if(obj_flags & EMAGGED)
diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm
index 157553da0c4..701c637a56b 100644
--- a/code/game/machinery/flasher.dm
+++ b/code/game/machinery/flasher.dm
@@ -119,12 +119,12 @@
/obj/machinery/flasher/emp_act(severity)
- if(!(stat & (BROKEN|NOPOWER)))
+ . = ..()
+ if(!(stat & (BROKEN|NOPOWER)) && !(. & EMP_PROTECT_SELF))
if(bulb && prob(75/severity))
flash()
bulb.burn_out()
power_change()
- ..()
/obj/machinery/flasher/obj_break(damage_flag)
if(!(flags_1 & NODECONSTRUCT_1))
diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm
index f6182fdae01..d5bb8db0e38 100644
--- a/code/game/machinery/igniter.dm
+++ b/code/game/machinery/igniter.dm
@@ -120,6 +120,8 @@
return 1
/obj/machinery/sparker/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
if(!(stat & (BROKEN|NOPOWER)))
ignite()
- ..()
diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm
index c93f67b7d7a..8c0e65fa82d 100644
--- a/code/game/machinery/lightswitch.dm
+++ b/code/game/machinery/lightswitch.dm
@@ -61,6 +61,8 @@
updateicon()
/obj/machinery/light_switch/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
if(!(stat & (BROKEN|NOPOWER)))
power_change()
- ..()
diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm
index 9acd4730d87..c3162d640d0 100644
--- a/code/game/machinery/mass_driver.dm
+++ b/code/game/machinery/mass_driver.dm
@@ -31,7 +31,9 @@
/obj/machinery/mass_driver/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
if(stat & (BROKEN|NOPOWER))
return
drive()
- ..(severity)
\ No newline at end of file
diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm
index 0325cc2def3..ef0af7ae745 100644
--- a/code/game/machinery/porta_turret/portable_turret.dm
+++ b/code/game/machinery/porta_turret/portable_turret.dm
@@ -20,9 +20,6 @@
power_channel = EQUIP //drains power from the EQUIPMENT channel
var/base_icon_state = "standard"
-
- var/emp_vunerable = TRUE // Can be empd
-
var/scan_range = 7
var/atom/base = null //for turrets inside other objects
@@ -307,7 +304,10 @@
/obj/machinery/porta_turret/emp_act(severity)
- if(on && emp_vunerable)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
+ if(on)
//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
check_records = pick(0, 1)
@@ -322,8 +322,6 @@
if(!on)
on = TRUE
- ..()
-
/obj/machinery/porta_turret/take_damage(damage, damage_type = BRUTE, damage_flag = 0, sound_effect = 1)
. = ..()
if(.) //damage received
@@ -646,9 +644,12 @@
icon_state = "syndie_off"
base_icon_state = "syndie"
faction = list(ROLE_SYNDICATE)
- emp_vunerable = 0
desc = "A ballistic machine gun auto-turret."
+/obj/machinery/porta_turret/syndicate/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
+
/obj/machinery/porta_turret/syndicate/energy
icon_state = "standard_stun"
base_icon_state = "standard"
@@ -723,9 +724,12 @@
icon_state = "syndie_off"
base_icon_state = "syndie"
faction = list("neutral","silicon","turret")
- emp_vunerable = 0
mode = TURRET_LETHAL
+/obj/machinery/porta_turret/centcom_shuttle/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
+
/obj/machinery/porta_turret/centcom_shuttle/assess_perp(mob/living/carbon/human/perp)
return 0
diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm
index ea317b74e59..ece35564bf0 100755
--- a/code/game/machinery/recharger.dm
+++ b/code/game/machinery/recharger.dm
@@ -120,6 +120,9 @@
update_icon()
/obj/machinery/recharger/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_CONTENTS)
+ return
if(!(stat & (NOPOWER|BROKEN)) && anchored)
if(istype(charging, /obj/item/gun/energy))
var/obj/item/gun/energy/E = charging
@@ -130,7 +133,6 @@
var/obj/item/melee/baton/B = charging
if(B.cell)
B.cell.charge = 0
- ..()
/obj/machinery/recharger/update_icon(using_power = 0, scan) //we have an update_icon() in addition to the stuff in process to make it feel a tiny bit snappier.
diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm
index e1200e68046..8cdae470cf2 100644
--- a/code/game/machinery/rechargestation.dm
+++ b/code/game/machinery/rechargestation.dm
@@ -43,11 +43,12 @@
open_machine()
/obj/machinery/recharge_station/emp_act(severity)
+ . = ..()
if(!(stat & (BROKEN|NOPOWER)))
- if(occupant)
+ if(occupant && !(. & EMP_PROTECT_CONTENTS))
occupant.emp_act(severity)
- open_machine()
- ..()
+ if (!(. & EMP_PROTECT_SELF))
+ open_machine()
/obj/machinery/recharge_station/attackby(obj/item/P, mob/user, params)
if(state_open)
diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm
index bda9378c993..302d1352e7b 100644
--- a/code/game/machinery/shieldgen.dm
+++ b/code/game/machinery/shieldgen.dm
@@ -26,6 +26,9 @@
move_update_air(T)
/obj/structure/emergency_shield/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
switch(severity)
if(1)
qdel(src)
diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm
index acfdeb150cb..994e74d6eb7 100644
--- a/code/game/machinery/slotmachine.dm
+++ b/code/game/machinery/slotmachine.dm
@@ -152,7 +152,8 @@
balance = 0
/obj/machinery/computer/slot_machine/emp_act(severity)
- if(stat & (NOPOWER|BROKEN))
+ . = ..()
+ if(stat & (NOPOWER|BROKEN) || . & EMP_PROTECT_SELF)
return
if(prob(15 * severity))
return
diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm
index 872c5b8f1d6..dc4254b8255 100644
--- a/code/game/machinery/spaceheater.dm
+++ b/code/game/machinery/spaceheater.dm
@@ -126,12 +126,11 @@
settableTemperatureMedian + settableTemperatureRange)
/obj/machinery/space_heater/emp_act(severity)
- if(stat & (BROKEN|NOPOWER))
- ..(severity)
+ . = ..()
+ if(stat & (NOPOWER|BROKEN) || . & EMP_PROTECT_CONTENTS)
return
if(cell)
cell.emp_act(severity)
- ..(severity)
/obj/machinery/space_heater/attackby(obj/item/I, mob/user, params)
add_fingerprint(user)
diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm
index 6c3687f6b82..e7d6bf04917 100644
--- a/code/game/machinery/status_display.dm
+++ b/code/game/machinery/status_display.dm
@@ -63,11 +63,10 @@
update()
/obj/machinery/status_display/emp_act(severity)
- if(stat & (BROKEN|NOPOWER))
- ..(severity)
+ . = ..()
+ if(stat & (NOPOWER|BROKEN) || . & EMP_PROTECT_SELF)
return
set_picture("ai_bsod")
- ..(severity)
// set what is displayed
@@ -259,11 +258,10 @@
update()
/obj/machinery/ai_status_display/emp_act(severity)
- if(stat & (BROKEN|NOPOWER))
- ..(severity)
+ . = ..()
+ if(stat & (NOPOWER|BROKEN) || . & EMP_PROTECT_SELF)
return
set_picture("ai_bsod")
- ..(severity)
/obj/machinery/ai_status_display/proc/update()
diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm
index 79c737fc58a..c2fb13c34c2 100644
--- a/code/game/machinery/telecomms/telecomunications.dm
+++ b/code/game/machinery/telecomms/telecomunications.dm
@@ -140,10 +140,12 @@ GLOBAL_LIST_EMPTY(telecomms_list)
traffic -= netspeed
/obj/machinery/telecomms/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(prob(100/severity))
if(!(stat & EMPED))
stat |= EMPED
var/duration = (300 * 10)/severity
spawn(rand(duration - 20, duration + 20)) // Takes a long time for the machines to reboot.
stat &= ~EMPED
- ..()
diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm
index 46fb5cc35af..1524da42f22 100644
--- a/code/game/mecha/mecha_control_console.dm
+++ b/code/game/mecha/mecha_control_console.dm
@@ -85,7 +85,9 @@
return answer
/obj/item/mecha_parts/mecha_tracking/emp_act()
- qdel(src)
+ . = ..()
+ if(!(. & EMP_PROTECT_SELF))
+ qdel(src)
/obj/item/mecha_parts/mecha_tracking/Destroy()
if(ismecha(loc))
diff --git a/code/game/mecha/mecha_defense.dm b/code/game/mecha/mecha_defense.dm
index 0fbfafeb59e..a5fbb6cbde2 100644
--- a/code/game/mecha/mecha_defense.dm
+++ b/code/game/mecha/mecha_defense.dm
@@ -142,6 +142,9 @@
setDir(dir_in)
/obj/mecha/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
if(get_charge())
use_power((cell.charge/3)/(severity*2))
take_damage(30 / severity, BURN, "energy", 1)
@@ -333,4 +336,3 @@
else if(damtype == TOX)
visual_effect_icon = ATTACK_EFFECT_MECHTOXIN
..()
-
diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm
index f38c880b060..3d069f1cffb 100644
--- a/code/game/objects/items/defib.dm
+++ b/code/game/objects/items/defib.dm
@@ -144,8 +144,11 @@
to_chat(user, "You silently enable [src]'s safety protocols with the cryptographic sequencer.")
/obj/item/defibrillator/emp_act(severity)
- if(cell)
+ . = ..()
+ if(cell && !(. & EMP_PROTECT_CONTENTS))
deductcharge(1000 / severity)
+ if (. & EMP_PROTECT_SELF)
+ return
if(safety)
safety = FALSE
visible_message("[src] beeps: Safety protocols disabled!")
@@ -155,7 +158,6 @@
visible_message("[src] beeps: Safety protocols enabled!")
playsound(src, 'sound/machines/defib_saftyOn.ogg', 50, 0)
update_icon()
- ..()
/obj/item/defibrillator/proc/toggle_paddles()
set name = "Toggle Paddles"
diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index 093ee1c4b72..1047bcd4eb1 100644
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -661,7 +661,7 @@ GLOBAL_LIST_EMPTY(PDAs)
to_chat(user, "Message sent to [target_text]: \"[message]\"")
// Reset the photo
photo = null
- last_text = world.time
+ last_text = world.time
if (everyone)
last_everyone = world.time
@@ -999,11 +999,14 @@ GLOBAL_LIST_EMPTY(PDAs)
// Pass along the pulse to atoms in contents, largely added so pAIs are vulnerable to EMP
/obj/item/pda/emp_act(severity)
- for(var/atom/A in src)
- A.emp_act(severity)
- emped += 1
- spawn(200 * severity)
- emped -= 1
+ . = ..()
+ if (!(. & EMP_PROTECT_CONTENTS))
+ for(var/atom/A in src)
+ A.emp_act(severity)
+ if (!(. & EMP_PROTECT_SELF))
+ emped += 1
+ spawn(200 * severity)
+ emped -= 1
/proc/get_viewable_pdas()
. = list()
diff --git a/code/game/objects/items/devices/gps.dm b/code/game/objects/items/devices/gps.dm
index 0030eabcddf..07118e2a186 100644
--- a/code/game/objects/items/devices/gps.dm
+++ b/code/game/objects/items/devices/gps.dm
@@ -29,6 +29,9 @@ GLOBAL_LIST_EMPTY(GPS_list)
return ..()
/obj/item/gps/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
emped = TRUE
cut_overlay("working")
add_overlay("emp")
diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm
index f6d3192bcea..bc24e4bf836 100644
--- a/code/game/objects/items/devices/paicard.dm
+++ b/code/game/objects/items/devices/paicard.dm
@@ -156,7 +156,8 @@
visible_message("[src] flashes a message across its screen, \"Additional personalities available for download.\"", "[src] bleeps electronically.")
/obj/item/paicard/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
if(pai)
pai.emp_act(severity)
- ..()
-
diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm
index 1a81b3d16b9..b4783d059e8 100644
--- a/code/game/objects/items/devices/radio/radio.dm
+++ b/code/game/objects/items/devices/radio/radio.dm
@@ -6,7 +6,7 @@
desc = "A basic handheld radio that communicates with local telecommunication networks."
dog_fashion = /datum/dog_fashion/back
- flags_1 = CONDUCT_1 | HEAR_1 | NO_EMP_WIRES_1
+ flags_1 = CONDUCT_1 | HEAR_1
slot_flags = ITEM_SLOT_BELT
throw_speed = 3
throw_range = 7
@@ -95,6 +95,10 @@
for(var/ch_name in channels)
secure_radio_connections[ch_name] = add_radio(src, GLOB.radiochannels[ch_name])
+/obj/item/radio/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
+
/obj/item/radio/interact(mob/user)
if (..())
return
@@ -339,6 +343,9 @@
return ..()
/obj/item/radio/emp_act(severity)
+ . = ..()
+ if (. & EMP_PROTECT_SELF)
+ return
emped++ //There's been an EMP; better count it
var/curremp = emped //Remember which EMP this was
if (listening && ismob(loc)) // if the radio is turned on and on someone's person they notice
@@ -353,7 +360,6 @@
emped = 0
if (!istype(src, /obj/item/radio/intercom)) // intercoms will turn back on on their own
on = TRUE
- ..()
///////////////////////////////
//////////Borg Radios//////////
diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm
index a7d06be284a..28be94afb43 100644
--- a/code/game/objects/items/grenades/plastic.dm
+++ b/code/game/objects/items/grenades/plastic.dm
@@ -5,7 +5,7 @@
item_state = "plastic-explosive"
lefthand_file = 'icons/mob/inhands/weapons/bombs_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/bombs_righthand.dmi'
- flags_1 = NOBLUDGEON_1 | NO_EMP_WIRES_1
+ flags_1 = NOBLUDGEON_1
det_time = 10
display_timer = 0
w_class = WEIGHT_CLASS_SMALL
@@ -19,9 +19,13 @@
var/can_attach_mob = FALSE
var/full_damage_on_mobs = FALSE
-/obj/item/grenade/plastic/New()
+/obj/item/grenade/plastic/Initialize()
+ . = ..()
plastic_overlay = mutable_appearance(icon, "[item_state]2", HIGH_OBJ_LAYER)
- ..()
+
+/obj/item/grenade/plastic/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES)
/obj/item/grenade/plastic/Destroy()
qdel(nadeassembly)
diff --git a/code/game/objects/items/inducer.dm b/code/game/objects/items/inducer.dm
index aa8df115b5a..730a459ed4b 100644
--- a/code/game/objects/items/inducer.dm
+++ b/code/game/objects/items/inducer.dm
@@ -29,8 +29,8 @@
return cell
/obj/item/inducer/emp_act(severity)
- ..()
- if(cell)
+ . = ..()
+ if(cell && !(. & EMP_PROTECT_CONTENTS))
cell.emp_act(severity)
/obj/item/inducer/attack_obj(obj/O, mob/living/carbon/user)
@@ -181,5 +181,3 @@
/obj/item/inducer/sci/Initialize()
. = ..()
update_icon()
-
-
diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm
index 2285e012862..e457ac5c122 100644
--- a/code/game/objects/items/stunbaton.dm
+++ b/code/game/objects/items/stunbaton.dm
@@ -172,8 +172,9 @@
return 1
/obj/item/melee/baton/emp_act(severity)
- deductcharge(1000 / severity)
- ..()
+ . = ..()
+ if (!(. & EMP_PROTECT_SELF))
+ deductcharge(1000 / severity)
//Makeshift stun baton. Replacement for stun gloves.
/obj/item/melee/baton/cattleprod
diff --git a/code/game/objects/structures/barsigns.dm b/code/game/objects/structures/barsigns.dm
index f0a910b6ead..f168bd4653d 100644
--- a/code/game/objects/structures/barsigns.dm
+++ b/code/game/objects/structures/barsigns.dm
@@ -106,8 +106,11 @@
/obj/structure/sign/barsign/emp_act(severity)
- set_sign(new /datum/barsign/hiddensigns/empbarsign)
- broken = 1
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
+ set_sign(new /datum/barsign/hiddensigns/empbarsign)
+ broken = 1
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index 2302a6b4d07..ca8d01fc07e 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -436,9 +436,13 @@
user.overlay_fullscreen("remote_view", /obj/screen/fullscreen/impaired, 1)
/obj/structure/closet/emp_act(severity)
- for(var/obj/O in src)
- O.emp_act(severity)
- if(secure && !broken)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
+ if (!(. & EMP_PROTECT_CONTENTS))
+ for(var/obj/O in src)
+ O.emp_act(severity)
+ if(secure && !broken && !(. & EMP_PROTECT_SELF))
if(prob(50 / severity))
locked = !locked
update_icon()
@@ -448,8 +452,6 @@
else
req_access = list()
req_access += pick(get_all_accesses())
- ..()
-
/obj/structure/closet/contents_explosion(severity, target)
for(var/atom/A in contents)
diff --git a/code/modules/antagonists/blob/blob/theblob.dm b/code/modules/antagonists/blob/blob/theblob.dm
index 6fda7df1309..dc7aa821d6d 100644
--- a/code/modules/antagonists/blob/blob/theblob.dm
+++ b/code/modules/antagonists/blob/blob/theblob.dm
@@ -204,6 +204,9 @@
return null
/obj/structure/blob/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(severity > 0)
if(overmind)
overmind.blob_reagent_datum.emp_reaction(src, severity)
diff --git a/code/modules/antagonists/clockcult/clock_structure.dm b/code/modules/antagonists/clockcult/clock_structure.dm
index a7eb192dc86..300e85e380e 100644
--- a/code/modules/antagonists/clockcult/clock_structure.dm
+++ b/code/modules/antagonists/clockcult/clock_structure.dm
@@ -117,6 +117,9 @@
to_chat(user, "As you unsecure [src] from the floor, you see cracks appear in its surface!")
/obj/structure/destructible/clockwork/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(anchored && unanchored_icon)
anchored = FALSE
update_anchored(null, obj_integrity > max_integrity * 0.25)
@@ -203,6 +206,9 @@
toggle()
/obj/structure/destructible/clockwork/powered/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(forced_disable(TRUE))
new /obj/effect/temp_visual/emp(loc)
diff --git a/code/modules/antagonists/swarmer/swarmer.dm b/code/modules/antagonists/swarmer/swarmer.dm
index 3ea2e1d739d..85574058015 100644
--- a/code/modules/antagonists/swarmer/swarmer.dm
+++ b/code/modules/antagonists/swarmer/swarmer.dm
@@ -128,6 +128,9 @@
return ..() | SPAN_ROBOT
/mob/living/simple_animal/hostile/swarmer/emp_act()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(health > 1)
adjustHealth(health-1)
else
@@ -554,6 +557,9 @@
playsound(src, 'sound/items/welder.ogg', 100, 1)
/obj/structure/swarmer/emp_act()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
qdel(src)
/obj/structure/swarmer/trap
diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm
index c60519b45e0..ececaf683f6 100644
--- a/code/modules/assembly/flash.dm
+++ b/code/modules/assembly/flash.dm
@@ -153,11 +153,13 @@
to_chat(user, "[src] emits a blinding light!")
/obj/item/assembly/flash/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(!try_use_flash())
- return FALSE
+ return
AOE_flash()
burn_out()
- . = ..()
/obj/item/assembly/flash/activate()//AOE flash on signal recieved
if(!..())
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index 798b555444e..88b7f2d38a9 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -58,6 +58,9 @@
air_update_turf() // Update the environment if needed.
/obj/machinery/portable_atmospherics/pump/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(is_operational())
if(prob(50 / severity))
on = !on
@@ -65,7 +68,6 @@
direction = PUMP_OUT
pump.target_pressure = rand(0, 100 * ONE_ATMOSPHERE)
update_icon()
- ..()
/obj/machinery/portable_atmospherics/pump/replace_tank(mob/living/user, close_valve)
. = ..()
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index 4bb7b022884..29a454f59aa 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -56,11 +56,13 @@
air_update_turf()
/obj/machinery/portable_atmospherics/scrubber/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(is_operational())
if(prob(50 / severity))
on = !on
update_icon()
- ..()
/obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm
index 4be9df82983..7d8b1d352d3 100644
--- a/code/modules/clothing/chameleon.dm
+++ b/code/modules/clothing/chameleon.dm
@@ -200,6 +200,9 @@
chameleon_action.initialize_disguises()
/obj/item/clothing/under/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/clothing/under/chameleon/broken/Initialize()
@@ -226,6 +229,9 @@
chameleon_action.initialize_disguises()
/obj/item/clothing/suit/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/clothing/suit/chameleon/broken/Initialize()
@@ -251,6 +257,9 @@
chameleon_action.initialize_disguises()
/obj/item/clothing/glasses/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/clothing/glasses/chameleon/broken/Initialize()
@@ -277,6 +286,9 @@
chameleon_action.initialize_disguises()
/obj/item/clothing/gloves/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/clothing/gloves/chameleon/broken/Initialize()
@@ -303,6 +315,9 @@
chameleon_action.initialize_disguises()
/obj/item/clothing/head/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/clothing/head/chameleon/broken/Initialize()
@@ -350,6 +365,9 @@
chameleon_action.initialize_disguises()
/obj/item/clothing/mask/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/clothing/mask/chameleon/broken/Initialize()
@@ -400,6 +418,9 @@
chameleon_action.initialize_disguises()
/obj/item/clothing/shoes/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/clothing/shoes/chameleon/noslip
@@ -569,6 +590,9 @@
chameleon_action.initialize_disguises()
/obj/item/storage/backpack/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/storage/backpack/chameleon/broken/Initialize()
@@ -594,6 +618,9 @@
STR.silent = TRUE
/obj/item/storage/belt/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/storage/belt/chameleon/broken/Initialize()
@@ -612,6 +639,9 @@
chameleon_action.initialize_disguises()
/obj/item/radio/headset/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/radio/headset/chameleon/broken/Initialize()
@@ -631,6 +661,9 @@
chameleon_action.initialize_disguises()
/obj/item/pda/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/pda/chameleon/broken/Initialize()
diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm
index 179054bee7f..c64ecc0e0f7 100644
--- a/code/modules/clothing/glasses/_glasses.dm
+++ b/code/modules/clothing/glasses/_glasses.dm
@@ -286,8 +286,10 @@
glass_colour_type = /datum/client_colour/glass_colour/red
/obj/item/clothing/glasses/thermal/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
thermal_overload()
- ..()
/obj/item/clothing/glasses/thermal/syndi //These are now a traitor item, concealed as mesons. -Pete
name = "chameleon thermals"
@@ -305,7 +307,9 @@
chameleon_action.initialize_disguises()
/obj/item/clothing/glasses/thermal/syndi/emp_act(severity)
- ..()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
/obj/item/clothing/glasses/thermal/monocle
diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm
index 63648269422..19bcf470bda 100644
--- a/code/modules/clothing/glasses/hud.dm
+++ b/code/modules/clothing/glasses/hud.dm
@@ -17,7 +17,8 @@
H.remove_hud_from(user)
/obj/item/clothing/glasses/hud/emp_act(severity)
- if(obj_flags & EMAGGED)
+ . = ..()
+ if(obj_flags & EMAGGED || . & EMP_PROTECT_SELF)
return
obj_flags |= EMAGGED
desc = "[desc] The display is flickering slightly."
@@ -96,6 +97,8 @@
/obj/item/clothing/glasses/hud/security/chameleon/emp_act(severity)
. = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chameleon_action.emp_randomise()
@@ -192,5 +195,7 @@
user.update_inv_glasses()
/obj/item/clothing/glasses/hud/toggle/thermal/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
thermal_overload()
- ..()
diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm
index 3040af756eb..b3b74446ec5 100644
--- a/code/modules/clothing/spacesuits/chronosuit.dm
+++ b/code/modules/clothing/spacesuits/chronosuit.dm
@@ -67,6 +67,9 @@
return ..()
/obj/item/clothing/suit/space/chronos/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
var/mob/living/carbon/human/user = src.loc
switch(severity)
if(1)
diff --git a/code/modules/clothing/spacesuits/flightsuit.dm b/code/modules/clothing/spacesuits/flightsuit.dm
index 83b7ad59317..d117bf482bd 100644
--- a/code/modules/clothing/spacesuits/flightsuit.dm
+++ b/code/modules/clothing/spacesuits/flightsuit.dm
@@ -189,11 +189,13 @@
. = ..()
/obj/item/flightpack/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
var/damage = severity == 1 ? emp_strong_damage : emp_weak_damage
if(emp_damage <= (emp_disable_threshold * 1.5))
emp_damage += damage
usermessage("WARNING: Class [severity] EMP detected! Circuit damage at [(emp_damage/emp_disable_threshold)*100]%!", "boldwarning")
- return ..()
//Proc to change amount of momentum the wearer has, or dampen all momentum by a certain amount.
/obj/item/flightpack/proc/adjust_momentum(amountx, amounty, reduce_amount_total = 0)
diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm
index 4a8e368208c..0667f2be6f9 100644
--- a/code/modules/clothing/spacesuits/hardsuit.dm
+++ b/code/modules/clothing/spacesuits/hardsuit.dm
@@ -86,7 +86,7 @@
soundloop.last_radiation = rad_record
/obj/item/clothing/head/helmet/space/hardsuit/emp_act(severity)
- ..()
+ . = ..()
display_visor_message("[severity > 1 ? "Light" : "Strong"] electromagnetic pulse detected!")
diff --git a/code/modules/clothing/suits/reactive_armour.dm b/code/modules/clothing/suits/reactive_armour.dm
index e80a2fff14d..9cfb7b11bf5 100644
--- a/code/modules/clothing/suits/reactive_armour.dm
+++ b/code/modules/clothing/suits/reactive_armour.dm
@@ -52,11 +52,13 @@
return
/obj/item/clothing/suit/armor/reactive/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
active = 0
icon_state = "reactiveoff"
item_state = "reactiveoff"
reactivearmor_cooldown = world.time + 200
- ..()
//When the wearer gets hit, this armor will teleport the user a short distance away (to safety or to more danger, no one knows. That's the fun of it!)
/obj/item/clothing/suit/armor/reactive/teleport
diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm
index edc2305261b..5043b189df4 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm
@@ -305,7 +305,9 @@
return FALSE
/obj/machinery/smartfridge/drying_rack/emp_act(severity)
- ..()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
atmos_spawn_air("TEMP=1000")
diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm
index a55a5e16571..a1f1394e16b 100644
--- a/code/modules/holodeck/computer.dm
+++ b/code/modules/holodeck/computer.dm
@@ -162,8 +162,10 @@
nerf(!(obj_flags & EMAGGED))
/obj/machinery/computer/holodeck/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
emergency_shutdown()
- return ..()
/obj/machinery/computer/holodeck/ex_act(severity, target)
emergency_shutdown()
diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm
index 72c34b90ccc..ac6bf758a99 100644
--- a/code/modules/integrated_electronics/core/assemblies.dm
+++ b/code/modules/integrated_electronics/core/assemblies.dm
@@ -489,9 +489,11 @@
choice.ask_for_input(user)
/obj/item/electronic_assembly/emp_act(severity)
- ..()
- for(var/i in 1 to contents.len)
- var/atom/movable/AM = contents[i]
+ . = ..()
+ if(. & EMP_PROTECT_CONTENTS)
+ return
+ for(var/I in src)
+ var/atom/movable/AM = I
AM.emp_act(severity)
// Returns true if power was successfully drawn.
@@ -742,4 +744,4 @@
if(EAST)
pixel_x = -31
if(WEST)
- pixel_x = 31
\ No newline at end of file
+ pixel_x = 31
diff --git a/code/modules/mining/equipment/lazarus_injector.dm b/code/modules/mining/equipment/lazarus_injector.dm
index 1af66e37d6b..99e1ce20d76 100644
--- a/code/modules/mining/equipment/lazarus_injector.dm
+++ b/code/modules/mining/equipment/lazarus_injector.dm
@@ -51,6 +51,9 @@
return
/obj/item/lazarus_injector/emp_act()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(!malfunctioning)
malfunctioning = 1
diff --git a/code/modules/mining/equipment/wormhole_jaunter.dm b/code/modules/mining/equipment/wormhole_jaunter.dm
index b8ae25a87a4..437d6fb26f6 100644
--- a/code/modules/mining/equipment/wormhole_jaunter.dm
+++ b/code/modules/mining/equipment/wormhole_jaunter.dm
@@ -51,6 +51,9 @@
qdel(src)
/obj/item/wormhole_jaunter/emp_act(power)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
var/triggered = FALSE
if(usr.get_item_by_slot(SLOT_BELT) == src)
diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm
index 802b869d02a..bacdc4524bd 100644
--- a/code/modules/mob/living/brain/MMI.dm
+++ b/code/modules/mob/living/brain/MMI.dm
@@ -148,6 +148,9 @@
to_chat(brainmob, "Radio is [radio.listening==1 ? "now" : "no longer"] receiving broadcast.")
/obj/item/mmi/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(!brainmob || iscyborg(loc))
return
else
@@ -159,7 +162,6 @@
if(3)
brainmob.emp_damage = min(brainmob.emp_damage + rand(0,10), 30)
brainmob.emote("alarm")
- ..()
/obj/item/mmi/Destroy()
if(iscyborg(loc))
diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm
index a10394cfb97..61777dd210c 100644
--- a/code/modules/mob/living/carbon/carbon_defense.dm
+++ b/code/modules/mob/living/carbon/carbon_defense.dm
@@ -203,10 +203,12 @@
adjustBruteLoss(10)
/mob/living/carbon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_CONTENTS)
+ return
for(var/X in internal_organs)
var/obj/item/organ/O = X
O.emp_act(severity)
- ..()
/mob/living/carbon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, override = 0, tesla_shock = 0, illusion = 0, stun = TRUE)
if(tesla_shock && (flags_1 & TESLA_IGNORE_1))
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 3f1ee1bd0ee..33344486b16 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -469,6 +469,9 @@
/mob/living/carbon/human/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_CONTENTS)
+ return
var/informed = FALSE
for(var/obj/item/bodypart/L in src.bodyparts)
if(L.status == BODYPART_ROBOTIC)
@@ -482,7 +485,6 @@
if(2)
L.receive_damage(0,5)
Stun(100)
- ..()
/mob/living/carbon/human/acid_act(acidpwr, acid_volume, bodyzone_hit)
var/list/damaged = list()
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 99325838ca4..851bf433345 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -317,9 +317,11 @@
return shock_damage
/mob/living/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_CONTENTS)
+ return
for(var/obj/O in contents)
O.emp_act(severity)
- ..()
/mob/living/singularity_act()
var/gain = 20
diff --git a/code/modules/mob/living/silicon/ai/ai_defense.dm b/code/modules/mob/living/silicon/ai/ai_defense.dm
index d07f85ef6a0..7c59c2b791b 100644
--- a/code/modules/mob/living/silicon/ai/ai_defense.dm
+++ b/code/modules/mob/living/silicon/ai/ai_defense.dm
@@ -22,6 +22,9 @@
return 0
/mob/living/silicon/ai/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
disconnect_shell()
if (prob(30))
switch(pick(1,2))
@@ -29,7 +32,6 @@
view_core()
if(2)
SSshuttle.requestEvac(src,"ALERT: Energy surge detected in AI core! Station integrity may be compromised! Initiati--%m091#ar-BZZT")
- ..()
/mob/living/silicon/ai/ex_act(severity, target)
switch(severity)
diff --git a/code/modules/mob/living/silicon/pai/pai_defense.dm b/code/modules/mob/living/silicon/pai/pai_defense.dm
index 440568c997d..417a24cd68d 100644
--- a/code/modules/mob/living/silicon/pai/pai_defense.dm
+++ b/code/modules/mob/living/silicon/pai/pai_defense.dm
@@ -3,6 +3,9 @@
return FALSE
/mob/living/silicon/pai/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
take_holo_damage(50/severity)
Knockdown(400/severity)
silent = max(30/severity, silent)
diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm
index 4048ee06a4a..ef1da59c363 100644
--- a/code/modules/mob/living/silicon/robot/robot_defense.dm
+++ b/code/modules/mob/living/silicon/robot/robot_defense.dm
@@ -77,12 +77,14 @@
/mob/living/silicon/robot/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
switch(severity)
if(1)
Stun(160)
if(2)
Stun(60)
- ..()
/mob/living/silicon/robot/emag_act(mob/user)
diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm
index 9926bc35fc3..3a138a5dadc 100644
--- a/code/modules/mob/living/silicon/robot/robot_modules.dm
+++ b/code/modules/mob/living/silicon/robot/robot_modules.dm
@@ -58,6 +58,9 @@
return ..()
/obj/item/robot_module/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_CONTENTS)
+ return
for(var/obj/O in modules)
O.emp_act(severity)
..()
diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm
index 7f34ea33057..647039e123e 100644
--- a/code/modules/mob/living/silicon/silicon_defense.dm
+++ b/code/modules/mob/living/silicon/silicon_defense.dm
@@ -91,20 +91,22 @@
return 0 //So borgs they don't die trying to fix wiring
/mob/living/silicon/emp_act(severity)
+ . = ..()
+ to_chat(src, "Warning: Electromagnetic pulse detected.")
+ if(. & EMP_PROTECT_SELF)
+ return
switch(severity)
if(1)
src.take_bodypart_damage(20)
if(2)
src.take_bodypart_damage(10)
to_chat(src, "*BZZZT*")
- to_chat(src, "Warning: Electromagnetic pulse detected.")
for(var/mob/living/M in buckled_mobs)
if(prob(severity*50))
unbuckle_mob(M)
M.Knockdown(40)
M.visible_message("[M] is thrown off of [src]!")
flash_act(affect_silicon = 1)
- ..()
/mob/living/silicon/bullet_act(obj/item/projectile/Proj)
if((Proj.damage_type == BRUTE || Proj.damage_type == BURN))
diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index ccfcdfbc34a..6ec6d59228d 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -320,6 +320,9 @@
return ..()
/mob/living/simple_animal/bot/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
var/was_on = on
stat |= EMPED
new /obj/effect/temp_visual/emp(loc)
diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm
index 2ae83606761..e8a92dce9ea 100644
--- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm
@@ -459,10 +459,12 @@ Auto Patrol[]"},
/mob/living/simple_animal/bot/ed209/emp_act(severity)
-
- if(severity==2 && prob(70))
- ..(severity-1)
- else
+ if(severity == 2 && prob(70))
+ severity = 1
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
+ if (severity >= 2)
new /obj/effect/temp_visual/emp(loc)
var/list/mob/living/carbon/targets = new
for(var/mob/living/carbon/C in view(12,src))
diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm
index 4bbabbe1bbc..600f6e58e47 100644
--- a/code/modules/mob/living/simple_animal/bot/mulebot.dm
+++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm
@@ -687,11 +687,11 @@
calc_path()
/mob/living/simple_animal/bot/mulebot/emp_act(severity)
- if(cell)
+ . = ..()
+ if(cell && !(. & EMP_PROTECT_CONTENTS))
cell.emp_act(severity)
if(load)
load.emp_act(severity)
- ..()
/mob/living/simple_animal/bot/mulebot/explode()
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
index 40aaf83cc4c..db542833352 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
@@ -219,6 +219,9 @@
/mob/living/simple_animal/drone/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
Stun(100)
to_chat(src, "ER@%R: MME^RY CO#RU9T! R&$b@0tin)...")
if(severity == 1)
diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm
index 3e5363ac371..bcba26a5d12 100644
--- a/code/modules/mob/living/simple_animal/slime/slime.dm
+++ b/code/modules/mob/living/simple_animal/slime/slime.dm
@@ -224,8 +224,10 @@
return 0
/mob/living/simple_animal/slime/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
powerlevel = 0 // oh no, the power!
- ..()
/mob/living/simple_animal/slime/MouseDrop(atom/movable/A as mob|obj)
if(isliving(A) && A != src && usr == src)
diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm
index 4091f8b6ae3..19d3b560463 100644
--- a/code/modules/modular_computers/computers/machinery/modular_computer.dm
+++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm
@@ -144,6 +144,9 @@
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
/obj/machinery/modular_computer/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_CONTENTS)
+ return
if(cpu)
cpu.emp_act(severity)
diff --git a/code/modules/paperwork/stamps.dm b/code/modules/paperwork/stamps.dm
index 97038bd94c5..aeb3f528cdc 100644
--- a/code/modules/paperwork/stamps.dm
+++ b/code/modules/paperwork/stamps.dm
@@ -91,6 +91,9 @@
stamp_names = sortList(stamp_names)
/obj/item/stamp/chameleon/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
change_to(pick(stamp_types))
/obj/item/stamp/chameleon/proc/change_to(obj/item/stamp/stamp_type)
diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm
index 96e35164c48..099edc19091 100644
--- a/code/modules/power/antimatter/control.dm
+++ b/code/modules/power/antimatter/control.dm
@@ -100,6 +100,9 @@
/obj/machinery/power/am_control_unit/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
switch(severity)
if(1)
if(active)
@@ -109,9 +112,6 @@
if(active)
toggle_power()
stability -= rand(10,20)
- ..()
- return 0
-
/obj/machinery/power/am_control_unit/blob_act()
stability -= 20
diff --git a/code/modules/power/antimatter/shielding.dm b/code/modules/power/antimatter/shielding.dm
index bd6b61e306d..8f4508be355 100644
--- a/code/modules/power/antimatter/shielding.dm
+++ b/code/modules/power/antimatter/shielding.dm
@@ -93,7 +93,7 @@
/obj/machinery/am_shielding/emp_act()//Immune due to not really much in the way of electronics.
- return 0
+ return
/obj/machinery/am_shielding/ex_act(severity, target)
stability -= (80 - (severity * 20))
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index 776dbf07d67..6d001dd1112 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -1257,17 +1257,20 @@
// damage and destruction acts
/obj/machinery/power/apc/emp_act(severity)
- if(cell)
- cell.emp_act(severity)
- if(occupier)
- occupier.emp_act(severity)
+ . = ..()
+ if (!(. & EMP_PROTECT_CONTENTS))
+ if(cell)
+ cell.emp_act(severity)
+ if(occupier)
+ occupier.emp_act(severity)
+ if(. & EMP_PROTECT_SELF)
+ return
lighting = 0
equipment = 0
environ = 0
update_icon()
update()
addtimer(CALLBACK(src, .proc/reset, APC_RESET_EMP), 600)
- ..()
/obj/machinery/power/apc/blob_act(obj/structure/blob/B)
set_broken()
diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm
index 498b9e608b8..a36800c2f9b 100644
--- a/code/modules/power/cell.dm
+++ b/code/modules/power/cell.dm
@@ -131,10 +131,12 @@
rigged = TRUE //broken batterys are dangerous
/obj/item/stock_parts/cell/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
charge -= 1000 / severity
if (charge < 0)
charge = 0
- ..()
/obj/item/stock_parts/cell/ex_act(severity, target)
..()
@@ -320,8 +322,9 @@
charge = 0
update_icon()
-/obj/item/stock_parts/cell/emproof/emp_act(severity)
- return
+/obj/item/stock_parts/cell/emproof/empty/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF)
/obj/item/stock_parts/cell/emproof/corrupt()
return
@@ -336,6 +339,9 @@
return
/obj/item/stock_parts/cell/beam_rifle/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
charge = CLAMP((charge-(10000/severity)),0,maxcharge)
/obj/item/stock_parts/cell/emergency_light
diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm
index 3ca4c701994..27ba1dcaf5a 100644
--- a/code/modules/power/singularity/emitter.dm
+++ b/code/modules/power/singularity/emitter.dm
@@ -60,6 +60,10 @@
sparks.attach(src)
sparks.set_up(5, TRUE, src)
+/obj/machinery/power/emitter/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
+
/obj/machinery/power/emitter/RefreshParts()
var/max_firedelay = 120
var/firedelay = 120
@@ -138,11 +142,6 @@
if(!anchored)
step(src, get_dir(M, src))
-
-/obj/machinery/power/emitter/emp_act(severity)//Emitters are hardened but still might have issues
- return 1
-
-
/obj/machinery/power/emitter/process()
if(stat & (BROKEN))
return
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index 3ea81568a78..58dfc3b69be 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -59,6 +59,9 @@ field_generator power level display
fields = list()
connected_gens = list()
+/obj/machinery/field/generator/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
/obj/machinery/field/generator/process()
if(active == FG_ONLINE)
@@ -151,10 +154,6 @@ field_generator power level display
if(!anchored)
step(src, get_dir(M, src))
-/obj/machinery/field/generator/emp_act()
- return 0
-
-
/obj/machinery/field/generator/blob_act(obj/structure/blob/B)
if(active)
return 0
diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm
index d514a2c4e99..229323d8b0d 100644
--- a/code/modules/power/smes.dm
+++ b/code/modules/power/smes.dm
@@ -408,6 +408,9 @@
/obj/machinery/power/smes/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
input_attempt = rand(0,1)
inputting = input_attempt
output_attempt = rand(0,1)
@@ -419,7 +422,6 @@
charge = 0
update_icon()
log_smes("an emp")
- ..()
/obj/machinery/power/smes/engineering
charge = 1.5e6 // Engineering starts with some charge for singulo
diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm
index e6e5b84231b..fb2946ae275 100644
--- a/code/modules/projectiles/gun.dm
+++ b/code/modules/projectiles/gun.dm
@@ -122,9 +122,10 @@
user.visible_message("[user] fires [src]!", null, null, COMBAT_MESSAGE_RANGE)
/obj/item/gun/emp_act(severity)
- for(var/obj/O in contents)
- O.emp_act(severity)
-
+ . = ..()
+ if(!(. & EMP_PROTECT_CONTENTS))
+ for(var/obj/O in contents)
+ O.emp_act(severity)
/obj/item/gun/afterattack(atom/target, mob/living/user, flag, params)
if(firing_burst)
diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm
index 27eaad2c525..f1d48f2f08c 100644
--- a/code/modules/projectiles/guns/energy.dm
+++ b/code/modules/projectiles/guns/energy.dm
@@ -21,10 +21,12 @@
var/dead_cell = FALSE //set to true so the gun is given an empty cell
/obj/item/gun/energy/emp_act(severity)
- cell.use(round(cell.charge / severity))
- chambered = null //we empty the chamber
- recharge_newshot() //and try to charge a new shot
- update_icon()
+ . = ..()
+ if(!(. & EMP_PROTECT_CONTENTS))
+ cell.use(round(cell.charge / severity))
+ chambered = null //we empty the chamber
+ recharge_newshot() //and try to charge a new shot
+ update_icon()
/obj/item/gun/energy/get_cell()
return cell
diff --git a/code/modules/projectiles/guns/energy/energy_gun.dm b/code/modules/projectiles/guns/energy/energy_gun.dm
index d2ea2ab5f5f..99f8166297d 100644
--- a/code/modules/projectiles/guns/energy/energy_gun.dm
+++ b/code/modules/projectiles/guns/energy/energy_gun.dm
@@ -127,7 +127,9 @@
to_chat(M, "Your [name]'s reactor overloads!")
/obj/item/gun/energy/e_gun/nuclear/emp_act(severity)
- ..()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
fail_chance = min(fail_chance + round(15/severity), 100)
/obj/item/gun/energy/e_gun/nuclear/update_icon()
diff --git a/code/modules/projectiles/guns/misc/beam_rifle.dm b/code/modules/projectiles/guns/misc/beam_rifle.dm
index 56967b89f8a..21feda365d6 100644
--- a/code/modules/projectiles/guns/misc/beam_rifle.dm
+++ b/code/modules/projectiles/guns/misc/beam_rifle.dm
@@ -195,6 +195,9 @@
return ..()
/obj/item/gun/energy/beam_rifle/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
chambered = null
recharge_newshot()
diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
index 170b3a3a65f..a4c85df9437 100644
--- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
+++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm
@@ -315,6 +315,9 @@ obj/machinery/chem_dispenser/proc/work_animation()
return cell
/obj/machinery/chem_dispenser/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
var/list/datum/reagents/R = list()
var/total = min(rand(7,15), FLOOR(cell.charge*powerefficiency, 1))
var/datum/reagents/Q = new(total*10)
@@ -330,7 +333,6 @@ obj/machinery/chem_dispenser/proc/work_animation()
cell.emp_act(severity)
work_animation()
visible_message("[src] malfunctions, spraying chemicals everywhere!")
- ..()
/obj/machinery/chem_dispenser/RefreshParts()
diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm
index 98da69b6464..20e05782ef4 100644
--- a/code/modules/research/server.dm
+++ b/code/modules/research/server.dm
@@ -41,10 +41,12 @@
working = TRUE
/obj/machinery/rnd/server/emp_act()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
stat |= EMPED
addtimer(CALLBACK(src, .proc/unemp), 600)
refresh_working()
- return ..()
/obj/machinery/rnd/server/proc/unemp()
stat &= ~EMPED
diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm
index 5c442c13693..e93da8b139e 100644
--- a/code/modules/surgery/organs/augments_arms.dm
+++ b/code/modules/surgery/organs/augments_arms.dm
@@ -56,11 +56,13 @@
..()
/obj/item/organ/cyberimp/arm/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(prob(15/severity) && owner)
to_chat(owner, "[src] is hit by EMP!")
// give the owner an idea about why his implant is glitching
Retract()
- ..()
/obj/item/organ/cyberimp/arm/proc/Retract()
if(!holder || (holder in src))
@@ -134,6 +136,9 @@
/obj/item/organ/cyberimp/arm/gun/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
if(prob(30/severity) && owner && !crit_fail)
Retract()
owner.visible_message("A loud bang comes from [owner]\'s [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm!")
@@ -143,8 +148,6 @@
owner.IgniteMob()
owner.adjustFireLoss(25)
crit_fail = 1
- else // The gun will still discharge anyway.
- ..()
/obj/item/organ/cyberimp/arm/gun/laser
diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm
index e50e0e3fc3b..133fe5d8bee 100644
--- a/code/modules/surgery/organs/augments_chest.dm
+++ b/code/modules/surgery/organs/augments_chest.dm
@@ -29,7 +29,8 @@
synthesizing = FALSE
/obj/item/organ/cyberimp/chest/nutriment/emp_act(severity)
- if(!owner)
+ . = ..()
+ if(!owner || . & EMP_PROTECT_SELF)
return
owner.reagents.add_reagent("bad_food", poison_amount / severity)
to_chat(owner, "You feel like your insides are burning.")
@@ -89,7 +90,8 @@
revive_cost += 40
/obj/item/organ/cyberimp/chest/reviver/emp_act(severity)
- if(!owner)
+ . = ..()
+ if(!owner || . & EMP_PROTECT_SELF)
return
if(reviving)
@@ -198,4 +200,3 @@
toggle(silent = TRUE)
return 0
-
diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm
index 57d81cad28f..4aa06f01c6e 100644
--- a/code/modules/surgery/organs/augments_internal.dm
+++ b/code/modules/surgery/organs/augments_internal.dm
@@ -30,12 +30,12 @@
w_class = WEIGHT_CLASS_TINY
/obj/item/organ/cyberimp/brain/emp_act(severity)
- if(!owner)
+ . = ..()
+ if(!owner || . & EMP_PROTECT_SELF)
return
var/stun_amount = 200/severity
owner.Stun(stun_amount)
to_chat(owner, "Your body seizes up!")
- return stun_amount
/obj/item/organ/cyberimp/brain/anti_drop
@@ -70,13 +70,13 @@
/obj/item/organ/cyberimp/brain/anti_drop/emp_act(severity)
- if(!owner)
+ . = ..()
+ if(!owner || . & EMP_PROTECT_SELF)
return
var/range = severity ? 10 : 5
var/atom/A
if(active)
release_items()
- ..()
for(var/obj/item/I in stored_items)
A = pick(oview(range))
I.throw_at(A, range, 2)
@@ -113,11 +113,11 @@
owner.SetKnockdown(STUN_SET_AMOUNT)
/obj/item/organ/cyberimp/brain/anti_stun/emp_act(severity)
- if(crit_fail)
+ . = ..()
+ if(crit_fail || . & EMP_PROTECT_SELF)
return
crit_fail = TRUE
addtimer(CALLBACK(src, .proc/reboot), 90 / severity)
- ..()
/obj/item/organ/cyberimp/brain/anti_stun/proc/reboot()
crit_fail = FALSE
@@ -135,12 +135,13 @@
w_class = WEIGHT_CLASS_TINY
/obj/item/organ/cyberimp/mouth/breathing_tube/emp_act(severity)
+ . = ..()
+ if(!owner || . & EMP_PROTECT_SELF)
+ return
if(prob(60/severity))
to_chat(owner, "Your breathing tube suddenly closes!")
owner.losebreath += 2
-
-
//BOX O' IMPLANTS
/obj/item/storage/box/cyber_implants
diff --git a/code/modules/surgery/organs/eyes.dm b/code/modules/surgery/organs/eyes.dm
index fc0bdd4c044..5092b533743 100644
--- a/code/modules/surgery/organs/eyes.dm
+++ b/code/modules/surgery/organs/eyes.dm
@@ -89,11 +89,11 @@
status = ORGAN_ROBOTIC
/obj/item/organ/eyes/robotic/emp_act(severity)
- if(!owner)
+ . = ..()
+ if(!owner || . & EMP_PROTECT_SELF)
+ return
+ if(prob(10 * severity))
return
- if(severity > 1)
- if(prob(10 * severity))
- return
to_chat(owner, "Static obfuscates your vision!")
owner.flash_act(visual = 1)
@@ -232,9 +232,11 @@
owner.cut_overlay(mob_overlay)
/obj/item/organ/eyes/robotic/glow/emp_act()
- if(active)
- deactivate(silent = TRUE)
-
+ . = ..()
+ if(!active || . & EMP_PROTECT_SELF)
+ return
+ deactivate(silent = TRUE)
+
/obj/item/organ/eyes/robotic/glow/Insert(mob/living/carbon/M, special = FALSE, drop_if_replaced = FALSE)
. = ..()
if (mobhook && mobhook.parent != M)
diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm
index 6de223e67b2..54244866490 100644
--- a/code/modules/surgery/organs/heart.dm
+++ b/code/modules/surgery/organs/heart.dm
@@ -152,6 +152,9 @@
synthetic = TRUE
/obj/item/organ/heart/cybernetic/emp_act()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
Stop()
/obj/item/organ/heart/freedom
@@ -167,4 +170,4 @@
to_chat(owner, "You feel yourself dying, but you refuse to give up!")
owner.heal_overall_damage(15, 15)
if(owner.reagents.get_reagent_amount("ephedrine") < 20)
- owner.reagents.add_reagent("ephedrine", 10)
\ No newline at end of file
+ owner.reagents.add_reagent("ephedrine", 10)
diff --git a/code/modules/surgery/organs/liver.dm b/code/modules/surgery/organs/liver.dm
index 360e58924ba..393978b3edc 100755
--- a/code/modules/surgery/organs/liver.dm
+++ b/code/modules/surgery/organs/liver.dm
@@ -78,6 +78,9 @@
toxLethality = 0.008 //20% less damage than a normal liver
/obj/item/organ/liver/cybernetic/emp_act(severity)
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
switch(severity)
if(1)
damage+=100
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index a3fe2202b62..727033838bb 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -346,6 +346,9 @@
synthetic = TRUE
/obj/item/organ/lungs/cybernetic/emp_act()
+ . = ..()
+ if(. & EMP_PROTECT_SELF)
+ return
owner.losebreath = 20
diff --git a/code/modules/vehicles/atv.dm b/code/modules/vehicles/atv.dm
index ac5be5b51c3..eb6a9a92e24 100644
--- a/code/modules/vehicles/atv.dm
+++ b/code/modules/vehicles/atv.dm
@@ -32,7 +32,6 @@
/obj/machinery/porta_turret/syndicate/vehicle_turret
name = "mounted turret"
scan_range = 7
- emp_vunerable = 1
density = FALSE
/obj/vehicle/ridden/atv/turret/Initialize()
diff --git a/tgstation.dme b/tgstation.dme
index a45e3603a21..acb24d56a8b 100755
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -318,6 +318,7 @@
#include "code\datums\components\decal.dm"
#include "code\datums\components\earhealing.dm"
#include "code\datums\components\earprotection.dm"
+#include "code\datums\components\empprotection.dm"
#include "code\datums\components\forensics.dm"
#include "code\datums\components\infective.dm"
#include "code\datums\components\jousting.dm"