diff --git a/code/__defines/_flags.dm b/code/__defines/_flags.dm index 4bd4edcca7..8ee22fdfc6 100644 --- a/code/__defines/_flags.dm +++ b/code/__defines/_flags.dm @@ -1,2 +1,12 @@ /// 33554431 (2^24 - 1) is the maximum value our bitflags can reach. #define MAX_BITFLAG_DIGITS 8 + +///Object will protect itself. +#define EMP_PROTECT_SELF (1<<0) +///Object will protect its contents from being EMPed. +#define EMP_PROTECT_CONTENTS (1<<1) +///Object will protect its wiring from being EMPed. +#define EMP_PROTECT_WIRES (1<<2) + +///Protects against all EMP types. +#define EMP_PROTECT_ALL (EMP_PROTECT_SELF | EMP_PROTECT_CONTENTS | EMP_PROTECT_WIRES) diff --git a/code/__defines/emp.dm b/code/__defines/emp.dm new file mode 100644 index 0000000000..a2ae0d7ff9 --- /dev/null +++ b/code/__defines/emp.dm @@ -0,0 +1,5 @@ +#define EMP_HEAVY 1 +#define EMP_MEDIUM 2 +#define EMP_LIGHT 3 +#define EMP_HARMLESS 4 +#define EMP_NONE 5 diff --git a/code/__defines/wires.dm b/code/__defines/wires.dm index 7462fc5d42..8aedc44c1e 100644 --- a/code/__defines/wires.dm +++ b/code/__defines/wires.dm @@ -125,3 +125,7 @@ #define WIRE_SORT_FORWARD "Sort Forward" #define WIRE_SORT_SIDE "Sort Side" #define WIRE_SORT_SCAN "Sort Scan" + +#define WIRE_HACK "Hack" +#define WIRE_DISABLE "Disable" +#define WIRE_SHOCK "High Voltage Ground" diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index a94211ac6d..21db9fda28 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -1650,3 +1650,59 @@ GLOBAL_DATUM(dview_mob, /mob/dview) final_material_list[mat] = mat_per_item[index] object.set_custom_materials(final_material_list, multiplier) index += 1 + +/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/datums/components/antags/changeling/powers/fabricate_clothing.dm b/code/datums/components/antags/changeling/powers/fabricate_clothing.dm index 07cc532710..e0186c550e 100644 --- a/code/datums/components/antags/changeling/powers/fabricate_clothing.dm +++ b/code/datums/components/antags/changeling/powers/fabricate_clothing.dm @@ -33,6 +33,7 @@ has_sensor = FALSE // Reveals ling, and doesn't make sense anyway! /obj/item/clothing/under/chameleon/changeling/emp_act(severity, recursive) //As these are purely organic, EMP does nothing to them. + . = ..() return /obj/item/clothing/under/chameleon/changeling/verb/shred() //Remove individual pieces if needed. @@ -53,8 +54,9 @@ origin_tech = list() canremove = FALSE -/obj/item/clothing/head/chameleon/changeling/emp_act(severity, recursive) - return +/obj/item/clothing/head/chameleon/changeling/Initialize(mapload) + . = ..() + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) /obj/item/clothing/head/chameleon/changeling/verb/shred() //The copypasta is real. set name = "Shred Helmet" @@ -78,8 +80,9 @@ origin_tech = list() canremove = FALSE -/obj/item/clothing/suit/chameleon/changeling/emp_act(severity, recursive) - return +/obj/item/clothing/suit/chameleon/changeling/Initialize(mapload) + . = ..() + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) /obj/item/clothing/suit/chameleon/changeling/verb/shred() set name = "Shred Suit" @@ -103,8 +106,9 @@ origin_tech = list() canremove = FALSE -/obj/item/clothing/shoes/chameleon/changeling/emp_act(severity, recursive) - return +/obj/item/clothing/shoes/chameleon/changeling/Initialize(mapload) + . = ..() + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) /obj/item/clothing/shoes/chameleon/changeling/verb/shred() set name = "Shred Shoes" @@ -128,8 +132,9 @@ origin_tech = list() canremove = FALSE -/obj/item/storage/backpack/chameleon/changeling/emp_act(severity, recursive) - return +/obj/item/storage/backpack/chameleon/changeling/Initialize(mapload) + . = ..() + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) /obj/item/storage/backpack/chameleon/changeling/verb/shred() set name = "Shred Backpack" @@ -156,8 +161,9 @@ origin_tech = list() canremove = FALSE -/obj/item/clothing/gloves/chameleon/changeling/emp_act(severity, recursive) - return +/obj/item/clothing/gloves/chameleon/changeling/Initialize(mapload) + . = ..() + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) /obj/item/clothing/gloves/chameleon/changeling/verb/shred() set name = "Shred Gloves" @@ -182,8 +188,9 @@ origin_tech = list() canremove = FALSE -/obj/item/clothing/mask/chameleon/changeling/emp_act(severity, recursive) - return +/obj/item/clothing/mask/chameleon/changeling/Initialize(mapload) + . = ..() + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) /obj/item/clothing/mask/chameleon/changeling/verb/shred() set name = "Shred Mask" @@ -203,8 +210,9 @@ origin_tech = list() canremove = FALSE -/obj/item/clothing/glasses/chameleon/changeling/emp_act(severity, recursive) - return +/obj/item/clothing/glasses/chameleon/changeling/Initialize(mapload) + . = ..() + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) /obj/item/clothing/glasses/chameleon/changeling/verb/shred() set name = "Shred Glasses" @@ -228,8 +236,9 @@ origin_tech = list() canremove = FALSE -/obj/item/storage/belt/chameleon/changeling/emp_act(severity, recursive) - return +/obj/item/storage/belt/chameleon/changeling/Initialize(mapload) + . = ..() + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) /obj/item/storage/belt/chameleon/changeling/verb/shred() set name = "Shred Belt" diff --git a/code/datums/elements/empprotection.dm b/code/datums/elements/empprotection.dm new file mode 100644 index 0000000000..b877f9b84f --- /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, list(COMSIG_ATOM_PRE_EMP_ACT, COMSIG_ATOM_EXAMINE_TAGS)) + return ..() + +/datum/element/empprotection/proc/getEmpFlags(datum/source, severity) + SIGNAL_HANDLER + + return (flags & EMP_PROTECT_ALL) diff --git a/code/datums/wires/camera.dm b/code/datums/wires/camera.dm index 322478688c..e6d1db0ace 100644 --- a/code/datums/wires/camera.dm +++ b/code/datums/wires/camera.dm @@ -59,6 +59,3 @@ if(WIRE_CAM_ALARM) C.visible_message("[icon2html(C,viewers(holder))] *beep*", "[icon2html(C,viewers(holder))] *beep*") ..() - -/datum/wires/camera/proc/CanDeconstruct() - return is_all_cut() diff --git a/code/datums/wires/r_n_d.dm b/code/datums/wires/r_n_d.dm new file mode 100644 index 0000000000..32521472c9 --- /dev/null +++ b/code/datums/wires/r_n_d.dm @@ -0,0 +1,43 @@ +/datum/wires/rnd + holder_type = /obj/machinery/rnd + proper_name = "R&D Machinery" + randomize = TRUE + +/datum/wires/rnd/New(atom/holder) + wires = list( + WIRE_HACK, WIRE_DISABLE, + WIRE_SHOCK + ) + add_duds(5) + ..() + +/datum/wires/rnd/interactable(mob/user) + if(!..()) + return FALSE + var/obj/machinery/rnd/R = holder + if(R.panel_open) + return TRUE + +/datum/wires/rnd/get_status() + var/obj/machinery/rnd/R = holder + var/list/status = list() + status += "The red light is [R.disabled ? "off" : "on"]." + status += "The blue light is [R.hacked ? "off" : "on"]." + return status + +/datum/wires/rnd/on_pulse(wire) + set waitfor = FALSE + var/obj/machinery/rnd/R = holder + switch(wire) + if(WIRE_HACK) + R.hacked = !R.hacked + if(WIRE_DISABLE) + R.disabled = !R.disabled + +/datum/wires/rnd/on_cut(wire, mend, source) + var/obj/machinery/rnd/R = holder + switch(wire) + if(WIRE_HACK) + R.hacked = !mend + if(WIRE_DISABLE) + R.disabled = !mend diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index baa29bd2d0..d2f9b06a96 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -1,3 +1,4 @@ +#define MAXIMUM_EMP_WIRES 3 /datum/wires /// TRUE if the wires will be different every time a new wire datum is created. @@ -476,3 +477,16 @@ /datum/wires/proc/is_attached(color) if(assemblies[color]) return TRUE + +/datum/wires/proc/emp_pulse() + var/list/possible_wires = shuffle(wires) + var/remaining_pulses = MAXIMUM_EMP_WIRES + + for(var/wire in possible_wires) + if(prob(33)) + pulse(wire) + remaining_pulses-- + if(!remaining_pulses) + break + +#undef MAXIMUM_EMP_WIRES diff --git a/code/game/atom/_atom.dm b/code/game/atom/_atom.dm index 7baeb9e4ef..ed8739d336 100644 --- a/code/game/atom/_atom.dm +++ b/code/game/atom/_atom.dm @@ -63,6 +63,8 @@ /// Radiation insulation types var/rad_insulation = RAD_NO_INSULATION + var/datum/wires/wires = null + /atom/Destroy() if(reagents) QDEL_NULL(reagents) @@ -142,14 +144,20 @@ /atom/proc/emp_act(severity, recursive) + SHOULD_CALL_PARENT(TRUE) recursive++ if(recursive > 5) //After a certain depth, we're just going to assume that it's too insulated to be EMP'd. return - for(var/atom/A in contents) - if(isbelly(A)) //Prey are protected - continue - A.emp_act(severity, recursive) - return + var/protection = SEND_SIGNAL(src, COMSIG_ATOM_PRE_EMP_ACT, severity) + if(!(protection & EMP_PROTECT_WIRES) && istype(wires)) + wires.emp_pulse() + + if(!(protection & EMP_PROTECT_CONTENTS)) + for(var/atom/A in contents) + A.emp_act(severity, recursive) + + SEND_SIGNAL(src, COMSIG_ATOM_EMP_ACT, severity, protection) + return protection /atom/proc/bullet_act(obj/item/projectile/P, def_zone) if(SEND_SIGNAL(src, COMSIG_ATOM_BULLET_ACT, P, def_zone) & COMPONENT_CANCEL_ATTACK_CHAIN) @@ -643,3 +651,7 @@ GLOBAL_LIST_EMPTY(icon_dimensions) blood_color = null germ_level = 0 fluorescent = 0 + +/// Sets the wire datum of an atom +/atom/proc/set_wires(datum/wires/new_wires) + wires = new_wires 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 d67c022059..df50a5ab3d 100644 --- a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm +++ b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm @@ -188,7 +188,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 + temp_apc.emp_act(EMP_LIGHT) // Such power surges are not good for APC electronics if(temp_apc.cell) temp_apc.cell.maxcharge -= between(0, (temp_apc.cell.maxcharge/2) + 500, temp_apc.cell.maxcharge) if(temp_apc.cell.maxcharge < 100) // That's it, you busted the APC cell completely. Break the APC and completely destroy the cell. diff --git a/code/game/gamemodes/technomancer/instability.dm b/code/game/gamemodes/technomancer/instability.dm index ddae942514..e2e283d9c3 100644 --- a/code/game/gamemodes/technomancer/instability.dm +++ b/code/game/gamemodes/technomancer/instability.dm @@ -129,7 +129,7 @@ safe_blink(src, range = 6) to_chat(src, span_warning("You're teleported against your will!")) if(4) - emp_act(3) + emp_act(EMP_LIGHT) if(51 to 100) //Severe rng = rand(0,3) @@ -137,7 +137,7 @@ if(0) electrocute_act(instability * 0.5, "extremely unstable energies", 0.75) if(1) - emp_act(2) + emp_act(EMP_MEDIUM) if(2) adjustFireLoss(instability * 0.3) //30 burn @ 100 instability to_chat(src, span_danger("Your chassis alerts you to extreme overheating from an unknown external force!")) @@ -151,7 +151,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, span_danger("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 6b856cb0fb..bcc419175e 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -428,6 +428,10 @@ go_out() /obj/machinery/sleeper/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return + if(filtering) toggle_filter() @@ -441,7 +445,6 @@ if(occupant) go_out() - ..(severity, recursive) /obj/machinery/sleeper/proc/toggle_filter() if(!occupant || !beaker) filtering = 0 diff --git a/code/game/machinery/air_alarm.dm b/code/game/machinery/air_alarm.dm index 5addae0282..18367749fd 100644 --- a/code/game/machinery/air_alarm.dm +++ b/code/game/machinery/air_alarm.dm @@ -83,8 +83,6 @@ var/shorted = 0 circuit = /obj/item/circuitboard/airalarm - var/datum/wires/alarm/wires - var/mode = AALARM_MODE_SCRUBBING var/screen = AALARM_SCREEN_MAIN var/area_uid @@ -137,8 +135,7 @@ set_frequency(frequency) if(!pixel_x && !pixel_y) offset_airalarm() - if(!wires) - wires = new(src) + set_wires(new /datum/wires/alarm(src)) alarm_area.air_alarms += src if(!alarm_area.main_air_alarm_is_operating()) // select main alarm alarm_area.elect_main_air_alarm() diff --git a/code/game/machinery/airconditioner_vr.dm b/code/game/machinery/airconditioner_vr.dm index 0ff8a6c893..6a2219896f 100644 --- a/code/game/machinery/airconditioner_vr.dm +++ b/code/game/machinery/airconditioner_vr.dm @@ -131,11 +131,13 @@ update_icon() /obj/machinery/power/thermoregulator/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(!on) on = TRUE target_temp += rand(0, 1000) update_icon() - ..(severity, recursive) /obj/machinery/power/thermoregulator/overload(var/obj/machinery/power/source) if(!anchored || !powernet) diff --git a/code/game/machinery/atm_ret_field.dm b/code/game/machinery/atm_ret_field.dm index 0084c4e2eb..c3d6d712e6 100644 --- a/code/game/machinery/atm_ret_field.dm +++ b/code/game/machinery/atm_ret_field.dm @@ -110,14 +110,15 @@ update_icon() /obj/machinery/atmospheric_field_generator/emp_act(severity, recursive) - if(!(stat & EMPED)) - stat |= EMPED - disable_field() //shutting dowwwwwwn - spawn(rand(reboot_delay_min,reboot_delay_max)) - stat &= ~EMPED - if(alwaysactive || wasactive) //reboot after a short delay if we were online before - generate_field() - ..() + . = ..() + if (. & EMP_PROTECT_SELF || (stat & EMPED)) + return + stat |= EMPED + disable_field() //shutting dowwwwwwn + spawn(rand(reboot_delay_min,reboot_delay_max)) + stat &= ~EMPED + if(alwaysactive || wasactive) //reboot after a short delay if we were online before + generate_field() /obj/machinery/atmospheric_field_generator/ex_act(severity) switch(severity) diff --git a/code/game/machinery/atmoalter/pump.dm b/code/game/machinery/atmoalter/pump.dm index b1719b7ef7..fa4178864e 100644 --- a/code/game/machinery/atmoalter/pump.dm +++ b/code/game/machinery/atmoalter/pump.dm @@ -49,8 +49,8 @@ return /obj/machinery/portable_atmospherics/powered/pump/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || stat & (BROKEN|NOPOWER)) return if(prob(50/severity)) @@ -62,8 +62,6 @@ target_pressure = rand(0,1300) update_icon() - ..(severity, recursive) - /obj/machinery/portable_atmospherics/powered/pump/process() ..() var/power_draw = -1 diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm index 9d3a5e2bc7..6e1328d35a 100644 --- a/code/game/machinery/atmoalter/scrubber.dm +++ b/code/game/machinery/atmoalter/scrubber.dm @@ -27,16 +27,14 @@ AddElement(/datum/element/climbable) /obj/machinery/portable_atmospherics/powered/scrubber/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || stat & (BROKEN|NOPOWER)) return if(prob(50/severity)) on = !on update_icon() - ..(severity, recursive) - /obj/machinery/portable_atmospherics/powered/scrubber/update_icon() cut_overlays() diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 7b656b34af..06cc0a89eb 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -23,8 +23,6 @@ ///Are we currently printing something var/busy = FALSE - var/datum/wires/autolathe/wires = null - ///Coefficient applied to consumed materials. Lower values result in lower material consumption. var/creation_efficiency = 1 ///modifier for lathe build speed. Lower values are faster. @@ -51,7 +49,7 @@ ) . = ..() - wires = new(src) + set_wires(new /datum/wires/autolathe(src)) if(!GLOB.autounlock_techwebs[/datum/techweb/autounlocking/autolathe]) GLOB.autounlock_techwebs[/datum/techweb/autounlocking/autolathe] = new /datum/techweb/autounlocking/autolathe diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 1a4df26727..c0cb23aad5 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -20,9 +20,6 @@ var/toughness = 5 //sorta fragile - // WIRES - var/datum/wires/camera/wires = null // Wires datum - //OTHER var/view_range = 7 @@ -41,7 +38,7 @@ var/client_huds = null /obj/machinery/camera/Initialize(mapload) - wires = new(src) + set_wires(new /datum/wires/camera(src)) assembly = new(src) assembly.state = 4 LAZYOR(client_huds, GLOB.global_hud.whitense) @@ -93,6 +90,9 @@ return /obj/machinery/camera/emp_act(severity, recursive, forced) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(!isEmpProof() && (forced || 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)) @@ -173,7 +173,7 @@ else if((W.has_tool_quality(TOOL_WIRECUTTER) || istype(W, /obj/item/multitool)) && panel_open) interact(user) - else if(W.has_tool_quality(TOOL_WELDER) && (wires.CanDeconstruct() || (stat & BROKEN))) + else if(W.has_tool_quality(TOOL_WELDER) && (wires.is_all_cut() || (stat & BROKEN))) if(weld(W, user)) if(assembly) assembly.loc = src.loc diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index ad2d954596..579571096f 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -402,8 +402,10 @@ go_out() /obj/machinery/clonepod/emp_act(severity, recursive) - if(prob(100/severity)) - malfunction() + . = ..() + if (. & EMP_PROTECT_SELF || !(prob(100/severity))) + return + malfunction() ..() /obj/machinery/clonepod/ex_act(severity) diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm index 7008d01790..34c8c42762 100644 --- a/code/game/machinery/computer/arcade.dm +++ b/code/game/machinery/computer/arcade.dm @@ -62,8 +62,8 @@ /obj/machinery/computer/arcade/emp_act(severity, recursive) - if(stat & (NOPOWER|BROKEN)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || (stat & (NOPOWER|BROKEN))) return var/empprize = null var/num_of_prizes = 0 @@ -80,8 +80,6 @@ empprize = pickweight(prizes) new empprize(src.loc) - ..(severity, recursive) - /////////////////// // BATTLE HERE // /////////////////// diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index 4794d320d3..4795ad34af 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -30,8 +30,11 @@ return 1 /obj/machinery/computer/emp_act(severity, recursive) - if(prob(20/severity)) set_broken() - ..() + . = ..() + if (. & EMP_PROTECT_SELF) + return + if(prob(20/severity)) + set_broken() /obj/machinery/computer/ex_act(severity) switch(severity) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 9d68d801db..4b9e18e6aa 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -479,8 +479,8 @@ SStgui.update_uis(src) /obj/machinery/computer/med_data/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || stat & (BROKEN|NOPOWER)) return for(var/datum/data/record/R in GLOB.data_core.medical) @@ -506,9 +506,6 @@ qdel(R) continue - ..(severity, recursive) - - /obj/machinery/computer/med_data/laptop //[TO DO] Change name to PCU and update mapdata to include replacement computers name = "\improper Medical Laptop" desc = "A personal computer unit. It seems to have only the medical records program installed." diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 00e45f8c72..7e2e195a2d 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -490,8 +490,8 @@ return selection.img /obj/machinery/computer/secure_data/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF ||stat & (BROKEN|NOPOWER)) return for(var/datum/data/record/R in GLOB.data_core.security) @@ -517,8 +517,6 @@ qdel(R) continue - ..(severity, recursive) - /obj/machinery/computer/secure_data/detective_computer icon_state = "forensic" diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index f2e78e3cd3..a22ca22be1 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -367,8 +367,8 @@ SStgui.update_uis(src) /obj/machinery/computer/skills/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || stat & (BROKEN|NOPOWER)) return for(var/datum/data/record/R in GLOB.data_core.security) @@ -394,8 +394,6 @@ qdel(R) continue - ..(severity, recursive) - #undef GENERAL_RECORD_LIST #undef GENERAL_RECORD_MAINT #undef GENERAL_RECORD_DATA diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index f99a77fbc1..19e45590a1 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -98,7 +98,8 @@ Deployable items return /obj/machinery/deployable/barrier/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) + . = ..() + if (. & EMP_PROTECT_SELF || (stat & (BROKEN|NOPOWER))) return if(prob(50/severity)) locked = !locked diff --git a/code/game/machinery/door_control.dm b/code/game/machinery/door_control.dm index fe00cfb0b6..d3f6b7f841 100644 --- a/code/game/machinery/door_control.dm +++ b/code/game/machinery/door_control.dm @@ -7,8 +7,8 @@ layer = ABOVE_WINDOW_LAYER flags = WALL_ITEM var/desiredstate = 0 - var/exposedwires = 0 - var/wires = 3 + var/exposedwires_num = 0 + var/wires_num = 3 /* Bitflag, 1=checkID 2=Network Access @@ -20,7 +20,7 @@ active_power_usage = 4 /obj/machinery/button/remote/attack_ai(mob/user as mob) - if(wires & 2) + if(wires_num & 2) return attack_hand(user) else to_chat(user, "Error, no route to host.") @@ -43,7 +43,7 @@ if(stat & (NOPOWER|BROKEN)) return - if(!allowed(user) && (wires & 1)) + if(!allowed(user) && (wires_num & 1)) to_chat(user, span_warning("Access Denied")) flick("doorctrl-denied",src) return diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 8b8b72d86c..de4161c177 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -45,7 +45,6 @@ var/hasShocked = 0 //Prevents multiple shocks from happening var/secured_wires = 0 var/security_level = 1 //Acts as a multiplier on the time required to hack an airlock with a hacktool - var/datum/wires/airlock/wires = null var/open_sound_powered = 'sound/machines/door/covert1o.ogg' var/open_sound_unpowered = 'sound/machines/door/airlockforced.ogg' @@ -1195,11 +1194,13 @@ About the new airlock wires panel: electronics.one_access = 1 /obj/machinery/door/airlock/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(prob(40/severity)) var/duration = world.time + ((30 / severity) SECONDS) if(duration > 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 2f1b45ae17..0ed32a088c 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -413,10 +413,11 @@ /obj/machinery/door/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(prob(20/severity) && (istype(src,/obj/machinery/door/airlock) || istype(src,/obj/machinery/door/window)) ) open() - ..() - /obj/machinery/door/ex_act(severity) switch(severity) diff --git a/code/game/machinery/exonet_node.dm b/code/game/machinery/exonet_node.dm index 0533e6fcc3..9734d43e2e 100644 --- a/code/game/machinery/exonet_node.dm +++ b/code/game/machinery/exonet_node.dm @@ -89,13 +89,14 @@ // Parameters: 1 (severity - how strong the EMP is, with lower numbers being stronger) // Description: Shuts off the machine for awhile if an EMP hits it. Ion anomalies also call this to turn it off. /obj/machinery/exonet_node/emp_act(severity, recursive) - if(!(stat & EMPED)) - stat |= EMPED - var/duration = (300 * 10)/severity - spawn(rand(duration - 20, duration + 20)) - stat &= ~EMPED + . = ..() + if (. & EMP_PROTECT_SELF || (stat & EMPED)) + return + stat |= EMPED + var/duration = (300 * 10)/severity + spawn(rand(duration - 20, duration + 20)) + stat &= ~EMPED update_icon() - ..() // Proc: process() // Parameters: None diff --git a/code/game/machinery/fire_alarm.dm b/code/game/machinery/fire_alarm.dm index 70abc53d7e..047831bfec 100644 --- a/code/game/machinery/fire_alarm.dm +++ b/code/game/machinery/fire_alarm.dm @@ -135,9 +135,11 @@ FIRE ALARM return alarm() /obj/machinery/firealarm/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(prob(50 / severity)) alarm(rand(30 / severity, 60 / severity)) - ..() /obj/machinery/firealarm/attackby(obj/item/W as obj, mob/user as mob) add_fingerprint(user) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index 1a3f789633..8d425c674e 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -101,12 +101,11 @@ O.Weaken(flash_time) /obj/machinery/flasher/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || stat & (BROKEN|NOPOWER)) return if(prob(75/severity)) flash() - ..(severity, recursive) /obj/machinery/flasher/portable/HasProximity(turf/T, datum/weakref/WF, oldloc) if(isnull(WF)) diff --git a/code/game/machinery/holoposter.dm b/code/game/machinery/holoposter.dm index 6eb1d7ab3b..7d2ff4d257 100644 --- a/code/game/machinery/holoposter.dm +++ b/code/game/machinery/holoposter.dm @@ -112,5 +112,8 @@ GLOBAL_LIST_EMPTY(holoposters) update_icon() /obj/machinery/holoposter/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || stat & BROKEN) + return stat |= BROKEN update_icon() diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm index 0b1a684fac..4d725bdd8e 100644 --- a/code/game/machinery/jukebox.dm +++ b/code/game/machinery/jukebox.dm @@ -20,7 +20,6 @@ volume = 0.5 //CHOMPEdit // Vars for hacking - var/datum/wires/jukebox/wires = null var/hacked = 0 // Whether to show the hidden songs or not var/freq = 0 // Currently no effect, will return in phase II of mediamanager. //VOREStation Add @@ -372,7 +371,7 @@ /obj/machinery/media/jukebox/ghost/power_change() return /obj/machinery/media/jukebox/ghost/emp_act(severity, recursive) - return + return ..() /obj/machinery/media/jukebox/ghost/emag_act(remaining_charges, mob/user) return /obj/machinery/media/jukebox/ghost/explode() diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 7575ce20d9..ea3cac7605 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -86,11 +86,10 @@ update_icon() /obj/machinery/light_switch/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || stat & (BROKEN|NOPOWER)) return power_change() - ..(severity, recursive) //Breakers for event maps diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 44a96fd19a..1042e4b562 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -163,6 +163,9 @@ Class Procs: return PROCESS_KILL /obj/machinery/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(use_power && stat == 0) use_power(7500/severity) @@ -173,7 +176,6 @@ Class Procs: pulse2.anchored = TRUE pulse2.set_dir(pick(GLOB.cardinal)) QDEL_IN(pulse2, 1 SECOND) - ..() /obj/machinery/ex_act(severity) switch(severity) diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index 27fe4cb0be..80eab17574 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -56,7 +56,7 @@ return /obj/machinery/mass_driver/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) + . = ..() + if (. & EMP_PROTECT_SELF || stat & (BROKEN|NOPOWER)) return drive() - ..(severity, recursive) diff --git a/code/game/machinery/nuclear_bomb.dm b/code/game/machinery/nuclear_bomb.dm index 15cfc21649..e12ef256bb 100644 --- a/code/game/machinery/nuclear_bomb.dm +++ b/code/game/machinery/nuclear_bomb.dm @@ -17,7 +17,7 @@ GLOBAL_VAR(bomb_set) var/yes_code = 0.0 var/safety = 1.0 var/obj/item/disk/nuclear/auth = null - var/list/wires = list() + var/list/wires_list = list() var/light_wire var/safety_wire var/timing_wire @@ -28,13 +28,13 @@ GLOBAL_VAR(bomb_set) /obj/machinery/nuclearbomb/Initialize(mapload) . = ..() r_code = "[rand(10000, 99999.0)]"//Creates a random code upon object spawn. - wires["Red"] = 0 - wires["Blue"] = 0 - wires["Green"] = 0 - wires["Marigold"] = 0 - wires["Fuschia"] = 0 - wires["Black"] = 0 - wires["Pearl"] = 0 + wires_list["Red"] = 0 + wires_list["Blue"] = 0 + wires_list["Green"] = 0 + wires_list["Marigold"] = 0 + wires_list["Fuschia"] = 0 + wires_list["Black"] = 0 + wires_list["Pearl"] = 0 var/list/w = list("Red","Blue","Green","Marigold","Black","Fuschia","Pearl") light_wire = pick(w) w -= light_wire @@ -202,9 +202,9 @@ GLOBAL_VAR(bomb_set) return /obj/machinery/nuclearbomb/proc/nukehack_win(mob/user as mob) - var/dat = "Nuclear Fission Explosive
\nNuclear Device Wires:
" - for(var/wire in wires) - dat += text("[wire] Wire: [wires[wire] ? "Mend" : "Cut"] Pulse
") + var/dat = "Nuclear Fission Explosive
\nNuclear Device wires_list:
" + for(var/wire in wires_list) + dat += text("[wire] Wire: [wires_list[wire] ? "Mend" : "Cut"] Pulse
") dat += text("
The device is [timing ? "shaking!" : "still"]
") dat += text("The device is [safety ? "quiet" : "whirring"].
") dat += text("The lights are [lighthack ? "static" : "functional"].
") @@ -242,7 +242,7 @@ GLOBAL_VAR(bomb_set) if(!istype(usr.get_active_hand(), /obj/item/multitool)) to_chat(usr, "You need a multitool!") else - if(wires[temp_wire]) + if(wires_list[temp_wire]) to_chat(usr, "You can't pulse a cut wire.") else if(light_wire == temp_wire) @@ -266,7 +266,7 @@ GLOBAL_VAR(bomb_set) if(!I.has_tool_quality(TOOL_WIRECUTTER)) to_chat(usr, "You need wirecutters!") else - wires[temp_wire] = !wires[temp_wire] + wires_list[temp_wire] = !wires_list[temp_wire] if(safety_wire == temp_wire) if(timing) explode() diff --git a/code/game/machinery/pda_multicaster.dm b/code/game/machinery/pda_multicaster.dm index 27ff82b1f6..4c17a96c21 100644 --- a/code/game/machinery/pda_multicaster.dm +++ b/code/game/machinery/pda_multicaster.dm @@ -112,10 +112,12 @@ update_power() /obj/machinery/pda_multicaster/emp_act(severity, recursive) - if(!(stat & EMPED)) - stat |= EMPED - var/duration = (300 * 10)/severity - spawn(rand(duration - 20, duration + 20)) - stat &= ~EMPED + . = ..() + if (. & EMP_PROTECT_SELF || (stat & EMPED)) + return + stat |= EMPED + var/duration = (300 * 10)/severity + spawn(rand(duration - 20, duration + 20)) + stat &= ~EMPED update_icon() ..() diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index f4e35cd7ce..2516488dd5 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -640,6 +640,9 @@ attempt_retaliate(damage) /obj/machinery/porta_turret/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return 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 @@ -656,15 +659,14 @@ if(!enabled) enabled = TRUE - ..() - /obj/machinery/porta_turret/ai_defense/emp_act(severity, recursive) - if(prob(33)) // One in three chance to resist an EMP. This is significant if an AoE EMP is involved against multiple turrets. + . = ..() + if (. & EMP_PROTECT_SELF || prob(33)) // One in three chance to resist an EMP. This is significant if an AoE EMP is involved against multiple turrets. return - ..() /obj/machinery/porta_turret/alien/emp_act(severity, recursive) // This is overrided to give an EMP resistance as well as avoid scambling the turret settings. - if(prob(75)) // Superior alien technology, I guess. + . = ..() + if (. & EMP_PROTECT_SELF || prob(75)) // Superior alien technology, I guess. return enabled = FALSE spawn(rand(1 MINUTE, 2 MINUTES)) diff --git a/code/game/machinery/suit_storage/suit_cycler.dm b/code/game/machinery/suit_storage/suit_cycler.dm index fdf68a69c3..041244f9c2 100644 --- a/code/game/machinery/suit_storage/suit_cycler.dm +++ b/code/game/machinery/suit_storage/suit_cycler.dm @@ -50,8 +50,6 @@ GLOBAL_LIST_EMPTY(suit_cycler_typecache) var/obj/item/clothing/suit/space/void/suit = null var/obj/item/clothing/head/helmet/space/helmet = null - var/datum/wires/suit_storage_unit/wires = null - /obj/machinery/suit_cycler/Initialize(mapload) . = ..() @@ -66,7 +64,7 @@ GLOBAL_LIST_EMPTY(suit_cycler_typecache) if(!target_department || !target_species) stat |= BROKEN - wires = new(src) + set_wires(new /datum/wires/suit_storage_unit(src)) /obj/machinery/suit_cycler/Destroy() qdel(wires) diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 416e55ab9b..0841343c7c 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -210,6 +210,9 @@ traffic -= netspeed /obj/machinery/telecomms/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(prob(100/severity)) if(!(stat & EMPED)) stat |= EMPED @@ -217,7 +220,6 @@ var/duration = (300 * 10)/severity spawn(rand(duration - 20, duration + 20)) // Takes a long time for the machines to reboot. stat &= ~EMPED - ..() /obj/machinery/telecomms/proc/checkheat() if(QDELETED(src)) diff --git a/code/game/machinery/turret_control.dm b/code/game/machinery/turret_control.dm index 5571db5d34..14d77a4185 100644 --- a/code/game/machinery/turret_control.dm +++ b/code/game/machinery/turret_control.dm @@ -225,6 +225,9 @@ set_light(1.5, 1,"#003300") /obj/machinery/turretid/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return 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 @@ -242,5 +245,3 @@ if(!enabled) enabled = TRUE updateTurrets() - - ..() diff --git a/code/game/machinery/virtual_reality/vr_console.dm b/code/game/machinery/virtual_reality/vr_console.dm index ed8c9afcc0..c2818e0b9b 100644 --- a/code/game/machinery/virtual_reality/vr_console.dm +++ b/code/game/machinery/virtual_reality/vr_console.dm @@ -119,8 +119,8 @@ /obj/machinery/vr_sleeper/emp_act(severity, recursive) - if(stat & (BROKEN|NOPOWER)) - ..(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || stat & (BROKEN|NOPOWER)) return if(occupant) @@ -134,8 +134,6 @@ smoke.start("#202020") perform_exit() - ..(severity, recursive) - /obj/machinery/vr_sleeper/verb/eject() set src in view(1) set category = "Object" diff --git a/code/game/mecha/components/_component.dm b/code/game/mecha/components/_component.dm index e44458c3f7..e4693a62cc 100644 --- a/code/game/mecha/components/_component.dm +++ b/code/game/mecha/components/_component.dm @@ -55,8 +55,11 @@ // Damage code. -/obj/item/mecha_parts/component/emp_act(severity = 4, recursive) - if(severity + emp_resistance > 4) +/obj/item/mecha_parts/component/emp_act(severity = EMP_HARMLESS, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return + if(severity + emp_resistance >= EMP_NONE) return severity = clamp(severity + emp_resistance, 1, 4) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 635fc02001..ea77a5f1cf 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1339,13 +1339,15 @@ */ /obj/mecha/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(get_charge()) use_power((cell.charge/2)/severity) take_damage(50 / severity,"energy") src.mecha_log_message("EMP detected",1) if(prob(80)) check_for_internal_damage(list(MECHA_INT_FIRE,MECHA_INT_TEMP_CONTROL,MECHA_INT_CONTROL_LOST,MECHA_INT_SHORT_CIRCUIT),1) - return /obj/mecha/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature>src.max_temperature) diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm index 99b29b0642..84c9353a19 100644 --- a/code/game/mecha/mecha_control_console.dm +++ b/code/game/mecha/mecha_control_console.dm @@ -104,8 +104,10 @@ return data /obj/item/mecha_parts/mecha_tracking/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return qdel(src) - return /obj/item/mecha_parts/mecha_tracking/ex_act() qdel(src) @@ -119,7 +121,7 @@ /obj/item/mecha_parts/mecha_tracking/proc/shock() var/obj/mecha/M = in_mecha() if(M) - M.emp_act(4) + M.emp_act(EMP_HARMLESS) qdel(src) /obj/item/mecha_parts/mecha_tracking/proc/get_mecha_log() diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index b23f3f4733..dd7581a472 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -9,7 +9,6 @@ var/smoke_strength = 3 var/obj/item/mine/mineitemtype = /obj/item/mine var/panel_open = FALSE - var/datum/wires/mines/wires = null var/camo_net = FALSE // Will the mine 'cloak' on deployment? // The trap item will be triggered in some manner when detonating. Default only checks for grenades. @@ -17,7 +16,7 @@ /obj/effect/mine/Initialize(mapload) icon_state = "landmine_armed" - wires = new(src) + set_wires(new /datum/wires/mines(src)) . = ..() if(ispath(trap)) trap = new trap(src) diff --git a/code/game/objects/effects/temporary_visuals/miscellaneous.dm b/code/game/objects/effects/temporary_visuals/miscellaneous.dm index 363c152cbf..961a4dd5a3 100644 --- a/code/game/objects/effects/temporary_visuals/miscellaneous.dm +++ b/code/game/objects/effects/temporary_visuals/miscellaneous.dm @@ -148,3 +148,13 @@ /obj/effect/temp_visual/circle_wave/dirt color = COLOR_ASTEROID_ROCK + +/obj/effect/temp_visual/emp + name = "emp sparks" + icon_state = "empdisable" + +/obj/effect/temp_visual/emp/pulse + name = "emp pulse" + icon_state = "emppulse" + duration = 8 + randomdir = 0 diff --git a/code/game/objects/empulse.dm b/code/game/objects/empulse.dm index 31bc2b804d..9427197d21 100644 --- a/code/game/objects/empulse.dm +++ b/code/game/objects/empulse.dm @@ -5,7 +5,8 @@ // # define EMPDEBUG 10 /proc/empulse(turf/epicenter, first_range, second_range, third_range, fourth_range, log=0) - if(!epicenter) return + if(!epicenter) + return if(!istype(epicenter, /turf)) epicenter = get_turf(epicenter.loc) @@ -15,13 +16,7 @@ log_game("EMP with size ([first_range], [second_range], [third_range], [fourth_range]) in area [epicenter.loc.name] ") if(first_range > 1) - var/obj/effect/overlay/pulse = new /obj/effect/overlay(epicenter) - pulse.icon = 'icons/effects/effects.dmi' - pulse.icon_state = "emppulse" - pulse.name = "emp pulse" - pulse.anchored = TRUE - spawn(20) - qdel(pulse) + new /obj/effect/temp_visual/emp/pulse(epicenter) if(first_range > second_range) second_range = first_range @@ -31,9 +26,9 @@ fourth_range = third_range for(var/mob/M in range(first_range, epicenter)) - M << 'sound/effects/EMPulse.ogg' + playsound(epicenter, 'sound/effects/EMPulse.ogg', 100, TRUE) - for(var/atom/T in range(fourth_range, epicenter)) + for(var/atom/T in spiral_range_turfs(fourth_range, epicenter)) #ifdef EMPDEBUG var/time = world.timeofday #endif @@ -42,33 +37,33 @@ distance = 0 //Worst effects, really hurts if(distance < first_range) - T.emp_act(1) + T.emp_act(EMP_HEAVY) else if(distance == first_range) if(prob(50)) - T.emp_act(1) + T.emp_act(EMP_HEAVY) else - T.emp_act(2) + T.emp_act(EMP_MEDIUM) //Slightly less painful else if(distance <= second_range) - T.emp_act(2) + T.emp_act(EMP_MEDIUM) else if(distance == second_range) if(prob(50)) - T.emp_act(2) + T.emp_act(EMP_MEDIUM) else - T.emp_act(3) + T.emp_act(EMP_LIGHT) //Even less slightly less painful else if(distance <= third_range) - T.emp_act(3) + T.emp_act(EMP_LIGHT) else if(distance == third_range) if(prob(50)) - T.emp_act(2) + T.emp_act(EMP_MEDIUM) else - T.emp_act(3) + T.emp_act(EMP_LIGHT) //This should be more or less harmless else if(distance <= fourth_range) - T.emp_act(4) + T.emp_act(EMP_HARMLESS) #ifdef EMPDEBUG if((world.timeofday - time) >= EMPDEBUG) log_and_message_admins("EMPDEBUG: [T.name] - [T.type] - took [world.timeofday - time]ds to process emp_act()!") #endif - return 1 + return TRUE diff --git a/code/game/objects/items/devices/communicator/communicator.dm b/code/game/objects/items/devices/communicator/communicator.dm index 2b6751e00f..c69189967c 100644 --- a/code/game/objects/items/devices/communicator/communicator.dm +++ b/code/game/objects/items/devices/communicator/communicator.dm @@ -235,6 +235,9 @@ // Parameters: None // Description: Drops all calls when EMPed, so the holder can then get murdered by the antagonist. /obj/item/communicator/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return close_connection(reason = "Hardware error de%#_^@%-BZZZZZZZT") // Proc: add_to_EPv2() diff --git a/code/game/objects/items/devices/defib.dm b/code/game/objects/items/devices/defib.dm index 09c8aafcf4..f3a63e33ff 100644 --- a/code/game/objects/items/devices/defib.dm +++ b/code/game/objects/items/devices/defib.dm @@ -516,6 +516,9 @@ return 1 /obj/item/shockpaddles/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return var/new_safety = rand(0, 1) if(safety != new_safety) safety = new_safety @@ -526,7 +529,6 @@ make_announcement("beeps, \"Safety protocols disabled!\"", "warning") playsound(src, 'sound/machines/defib_safetyoff.ogg', 50, 0) update_icon() - ..() /obj/item/shockpaddles/robot name = "defibrillator paddles" @@ -612,7 +614,9 @@ STOP_PROCESSING(SSobj, src) /obj/item/shockpaddles/standalone/emp_act(severity, recursive) - ..() + . = ..() + if (. & EMP_PROTECT_SELF) + return var/new_fail = 0 switch(severity) if(1) diff --git a/code/game/objects/items/devices/flash.dm b/code/game/objects/items/devices/flash.dm index 7b928abbd5..b97a38cc9a 100644 --- a/code/game/objects/items/devices/flash.dm +++ b/code/game/objects/items/devices/flash.dm @@ -292,7 +292,9 @@ return /obj/item/flash/emp_act(severity, recursive) - if(broken) return + . = ..() + if (. & EMP_PROTECT_SELF || broken) + return flash_recharge() if(!check_capacitor()) return diff --git a/code/game/objects/items/devices/gps.dm b/code/game/objects/items/devices/gps.dm index a2c9e9ccc2..756ce78823 100644 --- a/code/game/objects/items/devices/gps.dm +++ b/code/game/objects/items/devices/gps.dm @@ -167,7 +167,8 @@ GLOBAL_LIST_EMPTY(GPS_list) update_icon() /obj/item/gps/emp_act(severity, recursive) - if(emped) // Without a fancy callback system, this will have to do. + . = ..() + if (. & EMP_PROTECT_SELF || emped) return var/severity_modifier = severity ? severity : 4 // In case emp_act gets called without any arguments. var/duration = 5 MINUTES / severity_modifier diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm index a438bb7ad9..3f48e092d4 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -375,11 +375,11 @@ if(last_notify == 0 || (5 MINUTES <= world.time - last_notify)) audible_message(span_notice("\The [src] flashes a message across its screen, \"Additional personalities available for download.\""), hearing_distance = world.view, runemessage = "bleeps!") last_notify = world.time - +/* /obj/item/paicard/emp_act(severity, recursive) for(var/mob/M in src) M.emp_act(severity, recursive) - +*/ /obj/item/paicard/ex_act(severity) if(pai) pai.ex_act(severity) diff --git a/code/game/objects/items/devices/personal_shield_generator_vr.dm b/code/game/objects/items/devices/personal_shield_generator_vr.dm index 17f8a51df6..be9f571a98 100644 --- a/code/game/objects/items/devices/personal_shield_generator_vr.dm +++ b/code/game/objects/items/devices/personal_shield_generator_vr.dm @@ -112,6 +112,9 @@ */ /obj/item/personal_shield_generator/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(bcell && shield_active) switch(severity) if(1) //Point blank EMP shots have a good chance of burning the cell charge. diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 3f1b6601de..7b1edade44 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -14,7 +14,6 @@ var/traitor_frequency = 0 //tune to frequency to unlock traitor supplies var/canhear_range = 3 // the range which mobs can hear this radio from var/loudspeaker = TRUE // Allows borgs to disable canhear_range. - var/datum/wires/radio/wires = null var/b_stat = 0 var/broadcasting = FALSE var/listening = TRUE @@ -64,7 +63,7 @@ for (var/ch_name in channels) secure_radio_connections[ch_name] = SSradio.add_object(src, GLOB.radiochannels[ch_name], RADIO_CHAT) - wires = new(src) + set_wires(new /datum/wires/radio(src)) internal_channels = GLOB.default_internal_channels.Copy() GLOB.listening_objects += src @@ -620,11 +619,13 @@ GLOBAL_DATUM(autospeaker, /mob/living/silicon/ai/announcer) else return /obj/item/radio/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return broadcasting = FALSE listening = FALSE for (var/ch_name in channels) channels[ch_name] = 0 - ..() /obj/item/radio/start_off listening = FALSE diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 1d7207b9b0..f3613f9e37 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -45,7 +45,7 @@ desc = "A heavily reinforced case containing cyborg logic boards, with space for a standard power cell." icon_state = "chest" part = list(BP_GROIN,BP_TORSO) - var/wires = 0.0 + var/wires_const = 0.0 var/obj/item/cell/cell = null /obj/item/robot_parts/head @@ -139,13 +139,13 @@ if(istype(W, /obj/item/robot_parts/chest)) if(src.chest) return - if(W:wires && W:cell) + if(W:wires_const && W:cell) user.drop_item() W.loc = src src.chest = W src.update_icon() - else if(!W:wires) - to_chat(user, span_warning("You need to attach wires to it first!")) + else if(!W:wires_const) + to_chat(user, span_warning("You need to attach wires_const to it first!")) else to_chat(user, span_warning("You need to attach a cell to it first!")) @@ -250,13 +250,13 @@ src.cell = W to_chat(user, span_notice("You insert the cell!")) if(istype(W, /obj/item/stack/cable_coil)) - if(src.wires) + if(src.wires_const) to_chat(user, span_warning("You have already inserted wire!")) return else var/obj/item/stack/cable_coil/coil = W coil.use(1) - src.wires = 1.0 + src.wires_const = 1.0 to_chat(user, span_notice("You insert the wire!")) return diff --git a/code/game/objects/items/stacks/matter_synth.dm b/code/game/objects/items/stacks/matter_synth.dm index 3a4842c75f..c35f62bfa7 100644 --- a/code/game/objects/items/stacks/matter_synth.dm +++ b/code/game/objects/items/stacks/matter_synth.dm @@ -23,6 +23,8 @@ energy = min(energy + amount, max_energy) /datum/matter_synth/proc/emp_act(severity, recursive) + if (. & EMP_PROTECT_SELF) + return use_charge(max_energy * 0.1 / severity) /datum/matter_synth/medicine diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm index 856ff2158a..fa80269341 100644 --- a/code/game/objects/items/weapons/explosives.dm +++ b/code/game/objects/items/weapons/explosives.dm @@ -8,7 +8,6 @@ flags = NOBLUDGEON w_class = ITEMSIZE_SMALL origin_tech = list(TECH_ILLEGAL = 2) - var/datum/wires/explosive/c4/wires = null var/timer = 10 var/atom/target = null var/open_panel = 0 @@ -20,7 +19,7 @@ /obj/item/plastique/Initialize(mapload) . = ..() - wires = new(src) + set_wires(new /datum/wires/explosive/c4(src)) image_overlay = image('icons/obj/assemblies.dmi', "plastic-explosive2") /obj/item/plastique/Destroy() diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index 23a8f02cb5..fab866d314 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -155,7 +155,8 @@ Implant Specifics:
"} return dat /obj/item/implant/tracking/emp_act(severity, recursive) - if (malfunction) //no, dawg, you can't malfunction while you are malfunctioning + . = ..() + if (. & EMP_PROTECT_SELF || malfunction) //no, dawg, you can't malfunction while you are malfunctioning return malfunction = MALFUNCTION_TEMPORARY @@ -295,7 +296,8 @@ Implant Specifics:
"} to_chat(usr, "The implanted explosive implant in [source] can be activated by saying something containing the phrase ''[src.phrase]'', say [src.phrase] to attempt to activate.") /obj/item/implant/explosive/emp_act(severity, recursive) - if (malfunction) + . = ..() + if (. & EMP_PROTECT_SELF || malfunction) return malfunction = MALFUNCTION_TEMPORARY switch (severity) @@ -399,7 +401,8 @@ the implant may become unstable and either pre-maturely inject the subject or si return /obj/item/implant/chem/emp_act(severity, recursive) - if (malfunction) + . = ..() + if (. & EMP_PROTECT_SELF || malfunction) return malfunction = MALFUNCTION_TEMPORARY @@ -565,7 +568,8 @@ the implant may become unstable and either pre-maturely inject the subject or si STOP_PROCESSING(SSobj, src) /obj/item/implant/death_alarm/emp_act(severity, recursive) //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 + . = ..() + if (. & EMP_PROTECT_SELF || malfunction) //so I'm just going to add a meltdown chance here return malfunction = MALFUNCTION_TEMPORARY if(prob(40)) //CHOMPEDIT: Make the malfunction a probability because annoying diff --git a/code/game/objects/items/weapons/implants/implant_vr.dm b/code/game/objects/items/weapons/implants/implant_vr.dm index fcc0e53976..b5efea9f8e 100644 --- a/code/game/objects/items/weapons/implants/implant_vr.dm +++ b/code/game/objects/items/weapons/implants/implant_vr.dm @@ -114,6 +114,9 @@ /obj/item/implant/sizecontrol/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(isliving(imp_in)) var/newsize = pick(RESIZE_HUGE,RESIZE_BIG,RESIZE_NORMAL,RESIZE_SMALL,RESIZE_TINY,RESIZE_A_HUGEBIG,RESIZE_A_BIGNORMAL,RESIZE_A_NORMALSMALL,RESIZE_A_SMALLTINY) var/mob/living/H = imp_in diff --git a/code/game/objects/items/weapons/implants/implantcircuits.dm b/code/game/objects/items/weapons/implants/implantcircuits.dm index 4c0d1be144..85626270d0 100644 --- a/code/game/objects/items/weapons/implants/implantcircuits.dm +++ b/code/game/objects/items/weapons/implants/implantcircuits.dm @@ -33,6 +33,9 @@ return dat /obj/item/implant/integrated_circuit/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return IC.emp_act(severity, recursive) /obj/item/implant/integrated_circuit/examine(mob/user) diff --git a/code/game/objects/items/weapons/implants/neuralbasic.dm b/code/game/objects/items/weapons/implants/neuralbasic.dm index dfcdab01fe..2040c5f3b3 100644 --- a/code/game/objects/items/weapons/implants/neuralbasic.dm +++ b/code/game/objects/items/weapons/implants/neuralbasic.dm @@ -51,9 +51,8 @@ Implant Specifics:
"} return dat /obj/item/implant/neural/emp_act(severity, recursive) - if(!my_brain) - return - if(malfunction) //Don't malfunction while malfunctioning. + . = ..() + if (. & EMP_PROTECT_SELF || !my_brain || malfunction) return malfunction = MALFUNCTION_TEMPORARY diff --git a/code/game/objects/items/weapons/medigun/medigun_backpack.dm b/code/game/objects/items/weapons/medigun/medigun_backpack.dm index c12b1a3db2..b1a9cb1f47 100644 --- a/code/game/objects/items/weapons/medigun/medigun_backpack.dm +++ b/code/game/objects/items/weapons/medigun/medigun_backpack.dm @@ -256,6 +256,8 @@ /obj/item/medigun_backpack/emp_act(severity) . = ..() + if (. & EMP_PROTECT_SELF) + return if(bcell) bcell.emp_act(severity) diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm index 6b539b14ea..5401b5fdb8 100644 --- a/code/game/objects/items/weapons/melee/energy.dm +++ b/code/game/objects/items/weapons/melee/energy.dm @@ -374,7 +374,7 @@ if(istype(AM, /obj) && proximity && active) // EMP stuff. var/obj/O = AM - O.emp_act(3) // A weaker severity is used because this has infinite uses. + O.emp_act(EMP_LIGHT) // A weaker severity is used because this has infinite uses. playsound(O, 'sound/effects/EMPulse.ogg', 100, 1) user.setClickCooldown(user.get_attack_speed(src)) // A lot of objects don't set click delay. return ..() @@ -383,7 +383,7 @@ . = ..() if(target.isSynthetic() && active) // Do some extra damage. Not a whole lot more since emp_act() is pretty nasty on FBPs already. - target.emp_act(3) // A weaker severity is used because this has infinite uses. + target.emp_act(EMP_LIGHT) // A weaker severity is used because this has infinite uses. playsound(target, 'sound/effects/EMPulse.ogg', 100, 1) target.adjustFireLoss(force * 3) // 15 Burn, for 20 total. playsound(target, 'sound/weapons/blade1.ogg', 100, 1) diff --git a/code/game/objects/items/weapons/melee/shock_maul.dm b/code/game/objects/items/weapons/melee/shock_maul.dm index 3c9bcb27d9..5eb5a19392 100644 --- a/code/game/objects/items/weapons/melee/shock_maul.dm +++ b/code/game/objects/items/weapons/melee/shock_maul.dm @@ -271,11 +271,12 @@ powercheck(hitcost) /obj/item/melee/shock_maul/emp_act(severity, recursive) - if(status) - status = FALSE - visible_message(span_warning("\The [src]'s power field hisses and sputters out.")) - update_held_icon() - ..() + . = ..() + if (. & EMP_PROTECT_SELF || !status) + return + status = FALSE + visible_message(span_warning("\The [src]'s power field hisses and sputters out.")) + update_held_icon() /obj/item/melee/shock_maul/get_description_interaction() var/list/results = list() diff --git a/code/game/objects/items/weapons/storage/wallets.dm b/code/game/objects/items/weapons/storage/wallets.dm index 87477a778d..ecdd601167 100644 --- a/code/game/objects/items/weapons/storage/wallets.dm +++ b/code/game/objects/items/weapons/storage/wallets.dm @@ -126,6 +126,9 @@ color = new_color /obj/item/storage/wallet/poly/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return var/original_state = icon_state icon_state = "wallet-emp" update_icon() @@ -134,7 +137,6 @@ if(src) icon_state = original_state update_icon() - ..() /obj/item/storage/wallet/womens name = "women's wallet" 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 142422c8b3..1a4363961c 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 @@ -20,6 +20,9 @@ return ..() /obj/structure/closet/secure_closet/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(!broken) if(prob(50/severity)) locked = !locked @@ -30,7 +33,6 @@ else req_access = list() req_access += pick(SSaccess.get_all_station_access()) - ..() /obj/structure/closet/secure_closet/proc/togglelock(mob/user as mob) if(opened) diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index 1872fb2229..ef74ce95bf 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -224,6 +224,9 @@ return 1 /obj/structure/closet/crate/secure/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(!broken && !opened && prob(50/severity)) if(!locked) locked = TRUE @@ -237,7 +240,6 @@ req_access = list() req_access += pick(SSaccess.get_all_station_access()) update_icon() - ..() /obj/structure/closet/crate/plastic name = "plastic crate" diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index f0f4c45b7f..ccf59ecadf 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -548,7 +548,3 @@ expanding_turfs += next_turf return expanding_turfs - -// /empulse handles emp acting stuff in range. You can override this to do specialty stuff, but otherwise we don't want it to do a recursive check. -/turf/emp_act(severity, recursive) - return diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index c5c885dbb7..bb0f8160de 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -16,7 +16,7 @@ var/list/attached_overlays = null var/obj/item/assembly_holder/holder = null var/cooldown = FALSE //To prevent spam - var/wires = WIRE_RECEIVE | WIRE_PULSE + var/wires_type = WIRE_RECEIVE | WIRE_PULSE var/const/WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate() var/const/WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder @@ -34,16 +34,16 @@ return /obj/item/assembly/proc/pulsed(var/radio = 0) - if(holder && (wires & WIRE_RECEIVE)) + if(holder && (wires_type & WIRE_RECEIVE)) activate() - if(radio && (wires & WIRE_RADIO_RECEIVE)) + if(radio && (wires_type & WIRE_RADIO_RECEIVE)) activate() return 1 /obj/item/assembly/proc/pulse(var/radio = 0) - if(holder && (wires & WIRE_PULSE)) + if(holder && (wires_type & WIRE_PULSE)) holder.process_activation(src, 1, 0) - if(holder && (wires & WIRE_PULSE_SPECIAL)) + if(holder && (wires_type & WIRE_PULSE_SPECIAL)) holder.process_activation(src, 0, 1) return 1 diff --git a/code/modules/blob2/blobs/base_blob.dm b/code/modules/blob2/blobs/base_blob.dm index a19c58d645..8ab26dd06d 100644 --- a/code/modules/blob2/blobs/base_blob.dm +++ b/code/modules/blob2/blobs/base_blob.dm @@ -82,8 +82,10 @@ GLOBAL_LIST_EMPTY(all_blobs) return ..() /obj/structure/blob/emp_act(severity, recursive) - if(overmind) - overmind.blob_type.on_emp(src, severity) + . = ..() + if (. & EMP_PROTECT_SELF || !overmind) + return + overmind.blob_type.on_emp(src, severity) /obj/structure/blob/proc/pulsed() if(pulse_timestamp <= world.time) diff --git a/code/modules/blob2/overmind/types/electromagnetic_web.dm b/code/modules/blob2/overmind/types/electromagnetic_web.dm index 079b832856..77ce9c33cc 100644 --- a/code/modules/blob2/overmind/types/electromagnetic_web.dm +++ b/code/modules/blob2/overmind/types/electromagnetic_web.dm @@ -23,7 +23,7 @@ empulse(B.loc, 0, 1, 2) /datum/blob_type/electromagnetic_web/on_attack(obj/structure/blob/B, mob/living/victim) - victim.emp_act(2) + victim.emp_act(EMP_MEDIUM) /datum/blob_type/electromagnetic_web/on_chunk_tick(obj/item/blobcore_chunk/B) var/turf/T = get_turf(B) diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index 9cd8c4c47a..606fa17f11 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -49,13 +49,15 @@ GLOB.chamelion_jumpsuit_choices = generate_chameleon_choices(/obj/item/clothing/under, blocked) /obj/item/clothing/under/chameleon/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "psychedelic" desc = "Groovy!" icon_state = "psyche" LAZYSET(item_state_slots, slot_w_uniform_str, "psyche") update_icon() update_clothing_icon() - ..() /obj/item/clothing/under/chameleon/verb/change(picked in GLOB.chamelion_jumpsuit_choices) set name = "Change Jumpsuit Appearance" @@ -86,12 +88,14 @@ GLOB.chamelion_head_choices = generate_chameleon_choices(/obj/item/clothing/head, blocked) /obj/item/clothing/head/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "grey cap" desc = "It's a baseball hat in a tasteful grey colour." icon_state = "greysoft" update_icon() update_clothing_icon() - ..() /obj/item/clothing/head/chameleon/verb/change(picked in GLOB.chamelion_head_choices) set name = "Change Hat/Helmet Appearance" @@ -121,12 +125,14 @@ GLOB.chamelion_suit_choices = generate_chameleon_choices(/obj/item/clothing/suit, blocked) /obj/item/clothing/suit/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "armor" desc = "An armored vest that protects against some damage." icon_state = "armor" update_icon() update_clothing_icon() - ..() /obj/item/clothing/suit/chameleon/verb/change(picked in GLOB.chamelion_suit_choices) set name = "Change Oversuit Appearance" @@ -155,12 +161,14 @@ GLOB.chamelion_shoe_choices = generate_chameleon_choices(/obj/item/clothing/shoes, blocked) /obj/item/clothing/shoes/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "black shoes" desc = "A pair of black shoes." icon_state = "black" update_icon() update_clothing_icon() - ..() /obj/item/clothing/shoes/chameleon/verb/change(picked in GLOB.chamelion_shoe_choices) set name = "Change Footwear Appearance" @@ -189,6 +197,9 @@ GLOB.chamelion_back_choices = generate_chameleon_choices(/obj/item/storage/backpack, blocked) /obj/item/storage/backpack/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "backpack" desc = "You wear this on your back and put items into it." icon_state = "backpack" @@ -196,7 +207,6 @@ if (ismob(src.loc)) var/mob/M = src.loc M.update_inv_back() - ..() /obj/item/storage/backpack/chameleon/verb/change(picked in GLOB.chamelion_back_choices) set name = "Change Backpack Appearance" @@ -241,12 +251,14 @@ GLOB.chamelion_glove_choices = generate_chameleon_choices(/obj/item/clothing/gloves, list(src.type)) /obj/item/clothing/gloves/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "black gloves" desc = "It looks like a pair of gloves, but it seems to have a small dial inside." icon_state = "black" update_icon() update_clothing_icon() - ..() /obj/item/clothing/gloves/chameleon/verb/change(picked in GLOB.chamelion_glove_choices) set name = "Change Gloves Appearance" @@ -275,12 +287,14 @@ GLOB.chamelion_mask_choices = generate_chameleon_choices(/obj/item/clothing/mask, list(src.type)) /obj/item/clothing/mask/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "gas mask" desc = "It's a gas mask." icon_state = "gas_alt" //ChompEdit: file change update_icon() update_clothing_icon() - ..() /obj/item/clothing/mask/chameleon/verb/change(picked in GLOB.chamelion_mask_choices) set name = "Change Mask Appearance" @@ -311,12 +325,14 @@ clothing_choices = generate_chameleon_choices(/obj/item/clothing/glasses, list(src.type)) /obj/item/clothing/glasses/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "Optical Meson Scanner" desc = "It's a set of mesons." icon_state = "meson" update_icon() update_clothing_icon() - ..() /obj/item/clothing/glasses/chameleon/verb/change(picked in clothing_choices) set name = "Change Glasses Appearance" @@ -345,6 +361,9 @@ GLOB.chamelion_belt_choices = generate_chameleon_choices(/obj/item/storage/belt, list(src.type)) /obj/item/storage/belt/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "belt" desc = "Can hold various things." icon_state = "utilitybelt" @@ -352,7 +371,6 @@ if(ismob(src.loc)) var/mob/M = src.loc M.update_inv_belt() - ..() /obj/item/storage/belt/chameleon/verb/change(picked in GLOB.chamelion_belt_choices) set name = "Change Belt Appearance" @@ -386,12 +404,14 @@ GLOB.chamelion_accessory_choices = generate_chameleon_choices(/obj/item/clothing/accessory, blocked) /obj/item/clothing/accessory/chameleon/emp_act(severity, recursive) //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. + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "black tie" desc = "Looks like a black tie, but his one also has a dial inside." icon_state = "blacktie" update_icon() update_clothing_icon() - ..() /obj/item/clothing/accessory/chameleon/verb/change(picked in GLOB.chamelion_accessory_choices) set name = "Change Accessory Appearance" @@ -447,6 +467,9 @@ return P /obj/item/gun/energy/chameleon/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return name = "desert eagle" desc = "It's a desert eagle." icon_state = "deagle" @@ -455,7 +478,6 @@ var/mob/M = src.loc M.update_inv_r_hand() M.update_inv_l_hand() - ..() /obj/item/gun/energy/chameleon/disguise(var/newtype) var/obj/item/gun/copy = ..() diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 93ca31250a..c7042d7ca5 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -560,6 +560,9 @@ BLIND // can't see anything flash_protection = FLASH_PROTECTION_REDUCED /obj/item/clothing/glasses/thermal/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(ishuman(src.loc)) var/mob/living/carbon/human/M = src.loc to_chat(M, span_red("The Optical Thermal Scanner overloads and blinds you!")) @@ -571,7 +574,6 @@ BLIND // can't see anything M.disabilities |= NEARSIGHTED spawn(100) M.disabilities &= ~NEARSIGHTED - ..() /obj/item/clothing/glasses/thermal/Initialize(mapload) . = ..() diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 690ae2a1b5..ce2da437c4 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -101,6 +101,9 @@ /obj/item/clothing/glasses/omnihud/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(tgarscreen) SStgui.close_uis(src) var/disconnect_tgar = tgarscreen @@ -113,7 +116,6 @@ icon_state = "3d" if(ishuman(loc)) to_chat(loc, span_warning("The lenses of your [src.name] malfunction!")) - ..() /obj/item/clothing/glasses/omnihud/proc/flashed() if(flash_prot && ishuman(loc)) diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index 12a92d9006..1d66e23b7c 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -95,8 +95,6 @@ var/emp_protection = 0 item_flags = PHORONGUARD //VOREStation add - // Wiring! How exciting. - var/datum/wires/rig/wires var/datum/effect/effect/system/spark_spread/spark_system var/datum/mini_hud/rig/minihud @@ -113,7 +111,7 @@ suit_state = icon_state item_state = icon_state - wires = new(src) + set_wires(new /datum/wires/rig(src)) if(!LAZYLEN(req_access) && !LAZYLEN(req_one_access)) locked = 0 @@ -819,6 +817,9 @@ return 0 /obj/item/rig/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return //set malfunctioning if(emp_protection < 30) //for ninjas, really. malfunctioning += 10 diff --git a/code/modules/clothing/suits/reactive_armour.dm b/code/modules/clothing/suits/reactive_armour.dm index 6f61048726..830a5562cf 100644 --- a/code/modules/clothing/suits/reactive_armour.dm +++ b/code/modules/clothing/suits/reactive_armour.dm @@ -87,7 +87,7 @@ /obj/item/clothing/suit/armor/reactive/emp_act(severity, recursive) . = ..() - if(bad_effect || !active) + if (. & EMP_PROTECT_SELF || bad_effect || !active) return visible_message(emp_message) bad_effect = TRUE diff --git a/code/modules/economy/vending.dm b/code/modules/economy/vending.dm index 5ac4b4a4eb..d1a77b6e7a 100644 --- a/code/modules/economy/vending.dm +++ b/code/modules/economy/vending.dm @@ -73,7 +73,6 @@ var/scan_id = 1 var/obj/item/coin/coin - var/datum/wires/vending/wires = null var/list/log = list() var/req_log_access = ACCESS_CARGO //default access for checking logs is cargo @@ -83,7 +82,7 @@ /obj/machinery/vending/Initialize(mapload) . = ..() - wires = new(src) + set_wires(new /datum/wires/vending(src)) if(product_slogans) slogan_list += splittext(product_slogans, ";") diff --git a/code/modules/events/comms_blackout.dm b/code/modules/events/comms_blackout.dm index c3d4d5c580..2ac1eaed42 100644 --- a/code/modules/events/comms_blackout.dm +++ b/code/modules/events/comms_blackout.dm @@ -9,4 +9,4 @@ to_chat(A, span_boldwarning("Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you-BZZT")) to_chat(A, span_boldwarning("
")) for(var/obj/machinery/telecomms/T in GLOB.telecomms_list) - 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 81053e8afa..f25c0eb7f0 100644 --- a/code/modules/events/communications_blackout.dm +++ b/code/modules/events/communications_blackout.dm @@ -17,6 +17,6 @@ /datum/event/communications_blackout/start() for(var/obj/machinery/telecomms/T in GLOB.telecomms_list) - T.emp_act(1) + T.emp_act(EMP_HEAVY) for(var/obj/machinery/exonet_node/N in GLOB.machines) - N.emp_act(1) + N.emp_act(EMP_HEAVY) diff --git a/code/modules/food/kitchen/smartfridge/smartfridge.dm b/code/modules/food/kitchen/smartfridge/smartfridge.dm index f9d351a807..2994f9f6b9 100644 --- a/code/modules/food/kitchen/smartfridge/smartfridge.dm +++ b/code/modules/food/kitchen/smartfridge/smartfridge.dm @@ -21,7 +21,6 @@ var/scan_id = 1 var/is_secure = 0 var/wrenchable = 0 - var/datum/wires/smartfridge/wires = null var/persistent = null // Path of persistence datum used to track contents circuit = /obj/item/circuitboard/smartfridge //This one is meant to be uncraftable, however. @@ -36,9 +35,9 @@ if(persistent) SSpersistence.track_value(src, persistent) if(is_secure) - wires = new/datum/wires/smartfridge/secure(src) + set_wires(new /datum/wires/smartfridge/secure(src)) else - wires = new/datum/wires/smartfridge(src) + set_wires(new /datum/wires/smartfridge(src)) soundloop = new(list(src), FALSE) // CHOMPEdit: Fridge hum! update_icon() diff --git a/code/modules/hydroponics/seed_storage.dm b/code/modules/hydroponics/seed_storage.dm index 2f98970deb..e6aabcffb2 100644 --- a/code/modules/hydroponics/seed_storage.dm +++ b/code/modules/hydroponics/seed_storage.dm @@ -37,11 +37,10 @@ var/smart = 0 //Used for hacking. Overrides the scanner. var/hacked = 0 var/lockdown = 0 - var/datum/wires/seedstorage/wires = null /obj/machinery/seed_storage/Initialize(mapload) . = ..() - wires = new(src) + set_wires(new /datum/wires/seedstorage(src)) if(!contraband_seeds.len) contraband_seeds = pick( /// Some form of ambrosia in all lists. prob(30);list( /// General produce diff --git a/code/modules/integrated_electronics/core/integrated_circuit.dm b/code/modules/integrated_electronics/core/integrated_circuit.dm index 7568914529..4b21a93f85 100644 --- a/code/modules/integrated_electronics/core/integrated_circuit.dm +++ b/code/modules/integrated_electronics/core/integrated_circuit.dm @@ -53,6 +53,9 @@ a creative player the means to solve many problems. Circuits are held inside an . = ..() /obj/item/integrated_circuit/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return for(var/datum/integrated_io/io in inputs + outputs + activators) io.scramble() diff --git a/code/modules/integrated_electronics/core/tools.dm b/code/modules/integrated_electronics/core/tools.dm index eec248e033..fc4018a0ff 100644 --- a/code/modules/integrated_electronics/core/tools.dm +++ b/code/modules/integrated_electronics/core/tools.dm @@ -268,10 +268,11 @@ /obj/item/integrated_electronics/detailer, //CHOMP Edit, ) -//CHOMPAdd, this whole proc. Emp'ing this one bag causes a recursion loop of over 700 emp_act's, +//Emp'ing this one bag causes a recursion loop of over 700 emp_act's, //Which is enough to trigger byond's recursion level protection -/obj/item/storage/bag/circuits/emp_act() - return //No +/obj/item/storage/bag/circuits/basic/Initialize(mapload) + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) + . = ..() /obj/item/storage/bag/circuits/basic/Initialize(mapload) new /obj/item/storage/bag/circuits/mini/arithmetic(src) diff --git a/code/modules/integrated_electronics/subtypes/memory.dm b/code/modules/integrated_electronics/subtypes/memory.dm index 201f5e7d97..87fe1503f0 100644 --- a/code/modules/integrated_electronics/subtypes/memory.dm +++ b/code/modules/integrated_electronics/subtypes/memory.dm @@ -85,11 +85,11 @@ /obj/item/integrated_circuit/memory/constant/do_work() var/datum/integrated_io/O = outputs[1] O.push_data() - +/* /obj/item/integrated_circuit/memory/constant/emp_act(severity, recursive) // Prevents default EMP behavior for single-slot constants memory. return - +*/ /obj/item/integrated_circuit/memory/constant/attack_self(mob/user) . = ..(user) if(.) diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm index 3db9285061..2a61887f6a 100644 --- a/code/modules/mob/living/carbon/brain/MMI.dm +++ b/code/modules/mob/living/carbon/brain/MMI.dm @@ -173,19 +173,18 @@ origin_tech = list(TECH_BIO = 4) /obj/item/mmi/emp_act(severity, recursive) - if(!brainmob) + . = ..() + if (. & EMP_PROTECT_SELF || !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(5,10) - if(4) - brainmob.emp_damage += rand(0,5) - ..() + switch(severity) + if(EMP_HEAVY) + brainmob.emp_damage += rand(20,30) + if(EMP_MEDIUM) + brainmob.emp_damage += rand(10,20) + if(EMP_LIGHT) + brainmob.emp_damage += rand(5,10) + if(EMP_HARMLESS) + brainmob.emp_damage += rand(0,5) /obj/item/mmi/digital var/searching = 0 diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index 9ec657fe8a..d272c84756 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -30,9 +30,6 @@ qdel(dna) return ..() -/mob/living/carbon/brain/emp_act(severity, recursive) //Brains can't be EMP'd... - return - /mob/living/carbon/brain/say_understands(var/other)//Goddamn is this hackish, but this say code is so odd if(istype(container, /obj/item/mmi)) if(issilicon(other)) diff --git a/code/modules/mob/living/carbon/brain/posibrain.dm b/code/modules/mob/living/carbon/brain/posibrain.dm index a9c898f035..c88fa9e906 100644 --- a/code/modules/mob/living/carbon/brain/posibrain.dm +++ b/code/modules/mob/living/carbon/brain/posibrain.dm @@ -90,19 +90,18 @@ playsound(src, 'sound/misc/buzzbeep.ogg', 50, 1) /obj/item/mmi/digital/posibrain/emp_act(severity, recursive) - if(!src.brainmob) + . = ..() + if (. & EMP_PROTECT_SELF || !brainmob) return - else - switch(severity) - if(1) - src.brainmob.emp_damage += rand(20,30) - if(2) - src.brainmob.emp_damage += rand(10,20) - if(3) - src.brainmob.emp_damage += rand(5,10) - if(4) - src.brainmob.emp_damage += rand(0,5) - ..() + switch(severity) + if(EMP_HEAVY) + src.brainmob.emp_damage += rand(20,30) + if(EMP_MEDIUM) + src.brainmob.emp_damage += rand(10,20) + if(EMP_LIGHT) + src.brainmob.emp_damage += rand(5,10) + if(EMP_HARMLESS) + src.brainmob.emp_damage += rand(0,5) /obj/item/mmi/digital/posibrain/Initialize(mapload) . = ..() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 8e4e51838e..45b8e9cd39 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -80,6 +80,9 @@ //higher sensitivity values incur additional effects, starting with confusion/blinding/knockdown and ending with increasing amounts of damage //the degree of damage and duration of effects can be tweaked up or down based on the species emp_dmg_mod and emp_stun_mod vars (default 1) on top of tuning the random ranges /mob/living/carbon/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF || !species) + return //pregen our stunning stuff, had to do this seperately or else byond complained. remember that severity falls off with distance based on the source, so we don't need to do any extra distance calcs here. var/agony_str = ((rand(4,6)*15)-(15*severity))*species.emp_stun_mod //big ouchies at high severity, causes 0-75 halloss/agony; shotgun beanbags and revolver rubbers do 60 var/deafen_dur = (rand(9,16)-severity)*species.emp_stun_mod //5-15 deafen, on par with a flashbang @@ -89,13 +92,13 @@ if(species.emp_sensitivity) //receive warning message and basic effects to_chat(src, span_bolddanger("*BZZZT*")) switch(severity) - if(1) + if(EMP_HEAVY) to_chat(src, span_danger("DANGER: Extreme EM flux detected!")) - if(2) + if(EMP_MEDIUM) to_chat(src, span_danger("Danger: High EM flux detected!")) - if(3) + if(EMP_LIGHT) to_chat(src, span_danger("Warning: Moderate EM flux detected!")) - if(4) + if(EMP_HARMLESS) to_chat(src, span_danger("Warning: Minor EM flux detected!")) if(prob(90-(10*severity))) //50-80% chance to fire an emote. most are harmless, but vomit might reduce your nutrition level which could suck (so the whole thing is padded out with extras) src.emote(pick("twitch", "twitch_v", "choke", "pale", "blink", "blink_r", "shiver", "sneeze", "vomit", "gasp", "cough", "drool")) @@ -128,7 +131,6 @@ src.adjustToxLoss(rand(25-(severity*5),35-(severity*5)) * species.emp_dmg_mod) if(species.emp_sensitivity & EMP_OXY_DMG) src.adjustOxyLoss(rand(25-(severity*5),35-(severity*5)) * species.emp_dmg_mod) - ..() /mob/living/carbon/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0, var/def_zone = null, var/stun = 1) if(SEND_SIGNAL(src, COMSIG_BEING_ELECTROCUTED, shock_damage, source, siemens_coeff, def_zone, stun) & COMPONENT_CARBON_CANCEL_ELECTROCUTE) diff --git a/code/modules/mob/living/carbon/human/species/station/protean/protean_blob.dm b/code/modules/mob/living/carbon/human/species/station/protean/protean_blob.dm index 877da07eab..f3726b6cc8 100644 --- a/code/modules/mob/living/carbon/human/species/station/protean/protean_blob.dm +++ b/code/modules/mob/living/carbon/human/species/station/protean/protean_blob.dm @@ -298,10 +298,11 @@ return ..() /mob/living/simple_mob/protean_blob/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(humanform) return humanform.emp_act(severity, recursive) - else - return ..() /mob/living/simple_mob/protean_blob/ex_act(severity) if(humanform) diff --git a/code/modules/mob/living/carbon/human/species/station/protean/protean_rig.dm b/code/modules/mob/living/carbon/human/species/station/protean/protean_rig.dm index 99bef451c1..cce59ade56 100644 --- a/code/modules/mob/living/carbon/human/species/station/protean/protean_rig.dm +++ b/code/modules/mob/living/carbon/human/species/station/protean/protean_rig.dm @@ -422,10 +422,10 @@ /obj/item/rig/protean/take_hit(damage, source, is_emp=0) return //We don't do that here - +/* /obj/item/rig/protean/emp_act(severity, recursive) return //Same here - +*/ /obj/item/rig/protean/cut_suit() return //nope diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 2c8e75c2cd..41cad1e410 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -95,28 +95,28 @@ damage = damage * blocked switch(round(damage)) if(91 to INFINITY) - emp_act(1) + emp_act(EMP_HEAVY) if(76 to 90) if(prob(50)) - emp_act(1) + emp_act(EMP_HEAVY) else - emp_act(2) + emp_act(EMP_MEDIUM) if(61 to 75) - emp_act(2) + emp_act(EMP_MEDIUM) if(46 to 60) if(prob(50)) - emp_act(2) + emp_act(EMP_MEDIUM) else - emp_act(3) + emp_act(EMP_LIGHT) if(31 to 45) - emp_act(3) + emp_act(EMP_LIGHT) if(16 to 30) if(prob(50)) - emp_act(3) + emp_act(EMP_LIGHT) else - emp_act(4) + emp_act(EMP_HARMLESS) if(0 to 15) - emp_act(4) + emp_act(EMP_HARMLESS) flash_weak_pain() updatehealth() SEND_SIGNAL(src, COMSIG_MOB_AFTER_APPLY_DAMAGE, damage, damagetype, def_zone, blocked, sharp, edge, used_weapon, projectile) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 10e6e6b94c..e1196fda47 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -157,7 +157,8 @@ return 0 //only carbon liveforms have this proc /mob/living/emp_act(severity, recursive) - if(is_incorporeal()) // Can't emp shadekin in phase + . = ..() + if (. & EMP_PROTECT_SELF || is_incorporeal()) // Can't emp shadekin in phase return if(LAZYLEN(modifiers)) @@ -393,7 +394,7 @@ Sleeping(5) stuttering += 20 make_jittery(150) - emp_act(1) + emp_act(EMP_HEAVY) to_chat(src, span_critical("You've been struck by lightning!")) // Called when touching a lava tile. diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index b5fe9edd71..0913e3b325 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -432,6 +432,9 @@ ..() /mob/living/silicon/pai/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return // Silence for 2 minutes // 20% chance to damage critical components // 50% chance to damage a non critical component diff --git a/code/modules/mob/living/silicon/robot/drone/swarm_items.dm b/code/modules/mob/living/silicon/robot/drone/swarm_items.dm index 460143722e..788e9034bb 100644 --- a/code/modules/mob/living/silicon/robot/drone/swarm_items.dm +++ b/code/modules/mob/living/silicon/robot/drone/swarm_items.dm @@ -124,6 +124,9 @@ pulse_delay = 2 SECONDS /obj/effect/temporary_effect/pulse/disintegrate/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return visible_message(span_warning("\The [src] flickers, before dispersing energetically.")) qdel(src) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 586c7263d0..819a27107c 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -29,7 +29,6 @@ var/integrated_light_power = 6 var/list/robotdecal_on = list() var/glowy_enabled = FALSE - var/datum/wires/robot/wires can_be_antagged = TRUE @@ -153,7 +152,7 @@ add_language(LANGUAGE_GALCOM, 1) add_language(LANGUAGE_EAL, 1) - wires = new(src) + set_wires(new /datum/wires/robot(src)) robot_modules_background = new() robot_modules_background.icon_state = "block" diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm index 688db29b99..3a02f2799d 100644 --- a/code/modules/mob/living/silicon/robot/robot_damage.dm +++ b/code/modules/mob/living/silicon/robot/robot_damage.dm @@ -157,7 +157,8 @@ parts -= picked /mob/living/silicon/robot/emp_act(severity, recursive) - if(SEND_SIGNAL(src, COMSIG_ROBOT_EMP_ACT, severity) & COMPONENT_BLOCK_EMP) - return // Cancelled by a component + . = ..() + if (. & EMP_PROTECT_SELF || SEND_SIGNAL(src, COMSIG_ROBOT_EMP_ACT, severity) & COMPONENT_BLOCK_EMP) // Cancelled by a component + return uneq_all() ..() //Damage is handled at /silicon/ level. diff --git a/code/modules/mob/living/silicon/robot/robot_modules/station.dm b/code/modules/mob/living/silicon/robot/robot_modules/station.dm index 822c1fd8ec..c74ecb3654 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules/station.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules/station.dm @@ -102,6 +102,9 @@ return ..() /obj/item/robot_module/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(modules) for(var/obj/O in modules) O.emp_act(severity, recursive) @@ -111,7 +114,6 @@ if(synths) for(var/datum/matter_synth/S in synths) S.emp_act(severity, recursive) - return /obj/item/robot_module/proc/respawn_consumable(var/mob/living/silicon/robot/R, var/rate) SHOULD_CALL_PARENT(TRUE) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 45c3ac85ee..a4b87595cf 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -74,7 +74,8 @@ return /mob/living/silicon/emp_act(severity, recursive) - if(SEND_SIGNAL(src, COMSIG_SILICON_EMP_ACT, severity) & COMPONENT_BLOCK_EMP) + . = ..() + if (. & EMP_PROTECT_SELF || SEND_SIGNAL(src, COMSIG_SILICON_EMP_ACT, severity) & COMPONENT_BLOCK_EMP) return switch(severity) if(1) @@ -92,7 +93,6 @@ flash_eyes(affect_silicon = 1) to_chat(src, span_bolddanger("*BZZZT*")) to_chat(src, span_danger("Warning: Electromagnetic pulse detected.")) - ..() /mob/living/silicon/stun_effect_act(var/stun_amount, var/agony_amount, var/def_zone, var/used_weapon=null, var/electric = FALSE) return //immune diff --git a/code/modules/mob/living/simple_mob/defense.dm b/code/modules/mob/living/simple_mob/defense.dm index fa47ceed42..bd8b91b702 100644 --- a/code/modules/mob/living/simple_mob/defense.dm +++ b/code/modules/mob/living/simple_mob/defense.dm @@ -235,7 +235,9 @@ // Electromagnetism /mob/living/simple_mob/emp_act(severity, recursive) - ..() // To emp_act() its contents. + . = ..() + if (. & EMP_PROTECT_SELF) + return if(!isSynthetic()) return switch(severity) diff --git a/code/modules/modular_computers/computers/modular_computer/damage.dm b/code/modules/modular_computers/computers/modular_computer/damage.dm index 8ff1560888..e608006718 100644 --- a/code/modules/modular_computers/computers/modular_computer/damage.dm +++ b/code/modules/modular_computers/computers/modular_computer/damage.dm @@ -40,6 +40,9 @@ // 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(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return take_damage(rand(100,200) / severity, 50 / severity, 0) // "Stun" weapons can cause minor damage to components (short-circuits?) diff --git a/code/modules/nifsoft/nif.dm b/code/modules/nifsoft/nif.dm index 7830cb716a..b8a13c1591 100644 --- a/code/modules/nifsoft/nif.dm +++ b/code/modules/nifsoft/nif.dm @@ -188,6 +188,9 @@ You can also set the stat of a NIF to NIF_TEMPFAIL without any issues to disable //EMP adds wear and disables all nifsoft /obj/item/nif/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return notify("Danger! Significant electromagnetic interference!",TRUE) for(var/nifsoft in nifsofts) if(nifsoft) diff --git a/code/modules/organs/internal/eyes.dm b/code/modules/organs/internal/eyes.dm index a88b58deb7..e162892660 100644 --- a/code/modules/organs/internal/eyes.dm +++ b/code/modules/organs/internal/eyes.dm @@ -107,6 +107,7 @@ return -1 /obj/item/organ/internal/eyes/emp_act(severity, recursive) - ..() - if(owner && robotic) - owner.eye_blurry += (4/severity) + . = ..() + if (. & EMP_PROTECT_SELF || !robotic || !owner) + return + owner.eye_blurry += (4/severity) diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index ef7e8e7422..f5c502356e 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -417,6 +417,9 @@ robotize() /obj/item/organ/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return for(var/obj/O as anything in src.contents) O.emp_act(severity, recursive) @@ -424,13 +427,13 @@ return for(var/i = 1; i <= robotic; i++) switch (severity) - if (1) + if (EMP_HEAVY) take_damage(rand(5,9)) - if (2) + if (EMP_MEDIUM) take_damage(rand(3,7)) - if (3) + if (EMP_LIGHT) take_damage(rand(2,5)) - if (4) + if (EMP_HARMLESS) take_damage(rand(1,3)) /obj/item/organ/proc/removed(var/mob/living/user) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 97f8ac26f7..9ae8b4a5e4 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -131,6 +131,9 @@ return ..() /obj/item/organ/external/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return for(var/obj/O as anything in src.contents) O.emp_act(severity, recursive) diff --git a/code/modules/organs/subtypes/machine.dm b/code/modules/organs/subtypes/machine.dm index aadd1644f5..c04f97cd6a 100644 --- a/code/modules/organs/subtypes/machine.dm +++ b/code/modules/organs/subtypes/machine.dm @@ -19,7 +19,9 @@ owner.visible_message(span_danger("\The [owner] twitches visibly!")) /obj/item/organ/internal/cell/emp_act(severity, recursive) - ..() + . = ..() + if (. & EMP_PROTECT_SELF) + return owner?.adjust_nutrition(-rand(10 / severity, 50 / severity)) /obj/item/organ/internal/cell/machine/handle_organ_proc_special() @@ -109,11 +111,12 @@ if(istype(holder_mob)) holder_mob.drop_from_inventory(src) qdel(src) - +/* +// EMP loops inside things, this should still work? /obj/item/organ/internal/mmi_holder/emp_act(severity, recursive) if(stored_mmi) stored_mmi.emp_act(severity, recursive) - +*/ /obj/item/organ/internal/mmi_holder/posibrain name = "positronic brain interface" brain_type = /obj/item/mmi/digital/posibrain diff --git a/code/modules/organs/subtypes/nano.dm b/code/modules/organs/subtypes/nano.dm index c3f28c720f..06a42a3e30 100644 --- a/code/modules/organs/subtypes/nano.dm +++ b/code/modules/organs/subtypes/nano.dm @@ -184,10 +184,10 @@ icon_state = "posi1" stored_mmi.icon_state = "posi1" stored_mmi.brainmob.languages = owner.languages - +/* /obj/item/organ/internal/mmi_holder/posibrain/nano/emp_act(severity, recursive) return //Proteans handle EMP's differently - +*/ // The 'out on the ground' object, not the organ holder /obj/item/mmi/digital/posibrain/nano name = "protean posibrain" diff --git a/code/modules/overmap/ships/computers/sensors.dm b/code/modules/overmap/ships/computers/sensors.dm index 5b372f14db..b40c8f0797 100644 --- a/code/modules/overmap/ships/computers/sensors.dm +++ b/code/modules/overmap/ships/computers/sensors.dm @@ -235,7 +235,8 @@ change_power_consumption(1500 * (range**2), USE_POWER_IDLE) //Exponential increase, also affects speed of overheating /obj/machinery/shipsensors/emp_act(severity, recursive) - if(!use_power) + . = ..() + if (. & EMP_PROTECT_SELF || !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 193492c185..810a4894cd 100644 --- a/code/modules/power/antimatter/control.dm +++ b/code/modules/power/antimatter/control.dm @@ -83,22 +83,22 @@ /obj/machinery/power/am_control_unit/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return switch(severity) - if(1) + if(EMP_HEAVY) if(active) toggle_power() stability -= rand(15,30) - if(2) + if(EMP_MEDIUM) if(active) toggle_power() stability -= rand(10,20) - if(3) + if(EMP_LIGHT) if(active) toggle_power() stability -= rand(8,15) - if(4) + if(EMP_HARMLESS) if(active) toggle_power() stability -= rand(5,10) - ..() - return FALSE - /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 462863bf2d..b85cabc25b 100644 --- a/code/modules/power/antimatter/shielding.dm +++ b/code/modules/power/antimatter/shielding.dm @@ -89,7 +89,7 @@ /obj/machinery/am_shielding/emp_act(severity, recursive)//Immune due to not really much in the way of electronics. - return FALSE + return /obj/machinery/am_shielding/ex_act(severity) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 7e94f480aa..4224a7cdb5 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -137,7 +137,6 @@ GLOBAL_LIST_EMPTY(apcs) var/has_electronics = APC_HAS_ELECTRONICS_NONE // 0 - none, 1 - plugged in, 2 - secured by screwdriver var/beenhit = 0 // used for counting how many times it has been hit, used for Aliens at the moment var/longtermpower = 10 - var/datum/wires/apc/wires = null var/emergency_lights = FALSE var/update_state = -1 var/update_overlay = -1 @@ -187,7 +186,7 @@ GLOBAL_LIST_EMPTY(apcs) /obj/machinery/power/apc/Initialize(mapload, ndir, building) . = ..() - wires = new(src) + set_wires(new /datum/wires/apc(src)) GLOB.apcs += src // offset 24 pixels in direction of dir @@ -1189,6 +1188,9 @@ GLOBAL_LIST_EMPTY(apcs) // damage and destruction acts /obj/machinery/power/apc/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return // Fail for 8-12 minutes (divided by severity) // Division by 2 is required, because machinery ticks are every two seconds. Without it we would fail for 16-24 minutes. @@ -1204,7 +1206,6 @@ GLOBAL_LIST_EMPTY(apcs) severity = severity+1 update_icon() - ..(severity, recursive) /obj/machinery/power/apc/ex_act(severity) diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index d8713889e1..c2ccaf6f82 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -14,8 +14,6 @@ throw_speed = 3 throw_range = 5 w_class = ITEMSIZE_NORMAL - /// Are we EMP immune? - var/emp_proof = FALSE var/static/cell_uid = 1 // Unique ID of this power cell. Used to reduce bunch of uglier code in nanoUI. var/c_uid var/charge = 1000 // maximum charge on spawn @@ -234,7 +232,8 @@ rigged = 1 //broken batterys are dangerous /obj/item/cell/emp_act(severity, recursive) - if(emp_proof) + . = ..() + if (. & EMP_PROTECT_SELF) return //remove this once emp changes on dev are merged in if(isrobot(loc)) @@ -246,7 +245,6 @@ charge = 0 update_icon() - ..() /obj/item/cell/ex_act(severity) diff --git a/code/modules/power/cells/device_cells.dm b/code/modules/power/cells/device_cells.dm index 7ad4206cdd..a21b8c76d5 100644 --- a/code/modules/power/cells/device_cells.dm +++ b/code/modules/power/cells/device_cells.dm @@ -61,7 +61,10 @@ desc = "A small power cell designed to power handheld devices. Shielded from EMPs." icon_state = "s_st" matter = list(MAT_STEEL = 400, MAT_GLASS = 60) - emp_proof = TRUE + +/obj/item/cell/device/empproof/Initialize(mapload) + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) + return ..() /obj/item/cell/device/empproof/empty charge = 0 @@ -90,7 +93,10 @@ desc = "A small power cell designed to power handheld weaponry. Shielded from EMPs." icon_state = "s_hi" matter = list(MAT_STEEL = 400, MAT_GLASS = 60) - emp_proof = TRUE + +/obj/item/cell/device/weapon/empproof/Initialize(mapload) + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) + return ..() /obj/item/cell/device/weapon/empproof/empty charge = 0 diff --git a/code/modules/power/cells/power_cells.dm b/code/modules/power/cells/power_cells.dm index dcd6fae3f3..ddc182d505 100644 --- a/code/modules/power/cells/power_cells.dm +++ b/code/modules/power/cells/power_cells.dm @@ -151,7 +151,10 @@ maxcharge = 30000 //determines how badly mobs get shocked matter = list(MAT_STEEL = 700, MAT_GLASS = 80) robot_durability = 200 - emp_proof = TRUE + +/obj/item/cell/infinite/Initialize(mapload) + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) + return ..() /obj/item/cell/infinite/check_charge() return 1 diff --git a/code/modules/power/grid_checker.dm b/code/modules/power/grid_checker.dm index dd99bb8f55..04e60c0153 100644 --- a/code/modules/power/grid_checker.dm +++ b/code/modules/power/grid_checker.dm @@ -8,7 +8,6 @@ anchored = TRUE var/power_failing = FALSE // Turns to TRUE when the grid check event is fired by the Game Master, or perhaps a cheeky antag. // Wire stuff below. - var/datum/wires/grid_checker/wires var/wire_locked_out = FALSE var/wire_allow_manual_1 = FALSE var/wire_allow_manual_2 = FALSE @@ -19,7 +18,7 @@ . = ..() connect_to_network() update_icon() - wires = new(src) + set_wires(new /datum/wires/grid_checker(src)) default_apply_parts() /obj/machinery/power/grid_checker/Destroy() diff --git a/code/modules/power/pacman2.dm b/code/modules/power/pacman2.dm index 74d1862bb2..ce01853623 100644 --- a/code/modules/power/pacman2.dm +++ b/code/modules/power/pacman2.dm @@ -159,5 +159,5 @@ /obj/machinery/power/port_gen/pacman2/emag_act(var/remaining_uses, var/mob/user) emagged = 1 - emp_act(1) + emp_act(EMP_HEAVY) return 1 diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 26c29e0ea8..bf06418eea 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -72,18 +72,21 @@ . += span_notice("The generator is off.") /obj/machinery/power/port_gen/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return var/duration = 6000 //ten minutes switch(severity) - if(1) + if(EMP_HEAVY) stat &= BROKEN if(prob(75)) explode() - if(2) + if(EMP_MEDIUM) if(prob(50)) stat &= BROKEN if(prob(10)) explode() - if(3) + if(EMP_LIGHT) if(prob(25)) stat &= BROKEN duration = 300 - if(4) + if(EMP_HARMLESS) if(prob(10)) stat &= BROKEN duration = 300 diff --git a/code/modules/power/port_gen_vr.dm b/code/modules/power/port_gen_vr.dm index fe548c3e44..0625292cea 100644 --- a/code/modules/power/port_gen_vr.dm +++ b/code/modules/power/port_gen_vr.dm @@ -459,9 +459,6 @@ power_gen = cool_rotations runner.nutrition -= nutrition_drain -/obj/machinery/power/rtg/reg/emp_act(severity, recursive) - return - /obj/item/circuitboard/machine/reg_d name = T_BOARD("D-Type-REG") build_path = /obj/machinery/power/rtg/reg diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 7d2c9f0641..75ea114d31 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -82,10 +82,6 @@ to_chat(user, span_warning("\The [src] needs to be firmly secured to the floor first.")) return 1 - -/obj/machinery/power/emitter/emp_act(severity, recursive) - return TRUE - /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 1ef3d7e469..4f009cbd05 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -169,10 +169,6 @@ ..() return - -/obj/machinery/field_generator/emp_act(severity, recursive) - return FALSE - /obj/machinery/field_generator/bullet_act(var/obj/item/projectile/Proj) if(istype(Proj, /obj/item/projectile/beam)) power += Proj.damage * EMITTER_DAMAGE_POWER_TRANSFER diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index e95f4cca1f..36a47b60b5 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -19,11 +19,10 @@ var/list/obj/structure/particle_accelerator/connected_parts var/assembled = 0 var/parts = null - var/datum/wires/particle_acc/control_box/wires = null /obj/machinery/particle_accelerator/control_box/Initialize(mapload) . = ..() - wires = new(src) + set_wires(new /datum/wires/particle_acc/control_box(src)) connected_parts = list() update_active_power_usage(initial(active_power_usage) * (strength + 1)) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index aaf33860a1..f434957dc1 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -542,6 +542,9 @@ GLOBAL_LIST_EMPTY(smeses) qdel(src) // Either way we want to ensure the SMES is deleted. /obj/machinery/power/smes/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return inputting(rand(0,1)) outputting(rand(0,1)) output_level = rand(0, output_level_max) @@ -550,7 +553,6 @@ GLOBAL_LIST_EMPTY(smeses) if (charge < 0) charge = 0 update_icon() - ..() /obj/machinery/power/smes/bullet_act(var/obj/item/projectile/Proj) take_damage(Proj.get_structure_damage()) diff --git a/code/modules/power/smes_construction.dm b/code/modules/power/smes_construction.dm index 4b8f8aa74e..70e41397c8 100644 --- a/code/modules/power/smes_construction.dm +++ b/code/modules/power/smes_construction.dm @@ -104,7 +104,6 @@ var/cur_coils = 1 // Current amount of installed coils var/safeties_enabled = 1 // If 0 modifications can be done without discharging the SMES, at risk of critical failure. var/failing = 0 // If 1 critical failure has occured and SMES explosion is imminent. - var/datum/wires/smes/wires var/grounding = 1 // Cut to quickly discharge, at cost of "minor" electrical issues in output powernet. var/RCon = 1 // Cut to disable AI and remote control. var/RCon_tag = "NO_TAG" // RCON tag, change to show it on SMES Remote control console. @@ -153,7 +152,7 @@ . = ..() component_parts = list() component_parts += new /obj/item/stack/cable_coil(src,30) - wires = new /datum/wires/smes(src) + set_wires(new /datum/wires/smes(src)) // Allows for mapped-in SMESs with larger capacity/IO if(mapload) diff --git a/code/modules/power/tesla/coil.dm b/code/modules/power/tesla/coil.dm index a9369a897a..46b7a9af64 100644 --- a/code/modules/power/tesla/coil.dm +++ b/code/modules/power/tesla/coil.dm @@ -19,7 +19,6 @@ var/input_power_multiplier = 1 var/zap_cooldown = 10 var/last_zap = 0 - var/datum/wires/tesla_coil/wires = null var/zap_range = 5 var/lossy_transfer = TRUE //If true, we lose power upon shooting the next beam by our power_loss var. Only comes to play if power_loss is > 1 @@ -50,7 +49,7 @@ /obj/machinery/power/tesla_coil/Initialize(mapload) . = ..() - wires = new(src) + set_wires(new /datum/wires/tesla_coil(src)) /obj/machinery/power/tesla_coil/Initialize(mapload) . = ..() diff --git a/code/modules/power/tesla/energy_ball.dm b/code/modules/power/tesla/energy_ball.dm index fff31bb094..f8638d632b 100644 --- a/code/modules/power/tesla/energy_ball.dm +++ b/code/modules/power/tesla/energy_ball.dm @@ -295,7 +295,7 @@ if(issilicon(closest_mob)) var/mob/living/silicon/S = closest_mob if(stun_mobs) - S.emp_act(3 /*EMP_LIGHT*/) + S.emp_act(EMP_LIGHT) tesla_zap(closest_mob, 7, power / 1.5, explosive, stun_mobs, current_jumps = current_jumps) // metallic folks bounce it further else tesla_zap(closest_mob, 5, power / 1.5, explosive, stun_mobs, current_jumps = current_jumps) diff --git a/code/modules/power/tesla/tesla_act.dm b/code/modules/power/tesla/tesla_act.dm index 7405777120..710ab4d0a7 100644 --- a/code/modules/power/tesla/tesla_act.dm +++ b/code/modules/power/tesla/tesla_act.dm @@ -29,7 +29,7 @@ if(prob(85) && explosive) explosion(loc, 0, 2, 4, /*flame_range = 2,*/ adminlog = FALSE/*, smoke = FALSE*/) // VOREStation Edit - No devastation range else if(prob(50)) - emp_act(2) + emp_act(EMP_MEDIUM) else ex_act(2) diff --git a/code/modules/projectiles/ammunition/rounds.dm b/code/modules/projectiles/ammunition/rounds.dm index 063063c2dc..d8461f7cf8 100644 --- a/code/modules/projectiles/ammunition/rounds.dm +++ b/code/modules/projectiles/ammunition/rounds.dm @@ -316,6 +316,9 @@ matter = list(MAT_STEEL = 360, MAT_GLASS = 720) /obj/item/ammo_casing/a12g/stunshell/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return if(prob(100/severity)) BB = null update_icon() diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 89609b8afe..551741c5ef 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -111,7 +111,9 @@ update_icon() /obj/item/gun/energy/emp_act(severity, recursive) - ..() + . = ..() + if (. & EMP_PROTECT_SELF) + return update_icon() /obj/item/gun/energy/consume_next_projectile() diff --git a/code/modules/projectiles/guns/energy/kinetic_accelerator_vr.dm b/code/modules/projectiles/guns/energy/kinetic_accelerator_vr.dm index f190ed5316..6041659f82 100644 --- a/code/modules/projectiles/guns/energy/kinetic_accelerator_vr.dm +++ b/code/modules/projectiles/guns/energy/kinetic_accelerator_vr.dm @@ -211,9 +211,6 @@ deltimer(recharge_timerid) recharge_timerid = addtimer(CALLBACK(src, PROC_REF(reload)), recharge_time * carried, TIMER_STOPPABLE) -/obj/item/gun/energy/kinetic_accelerator/emp_act(severity, recursive) - return - /obj/item/gun/energy/kinetic_accelerator/proc/reload() power_supply.give(power_supply.maxcharge) // process_chamber() diff --git a/code/modules/projectiles/guns/energy/pump.dm b/code/modules/projectiles/guns/energy/pump.dm index d01a84aaae..15d195b6f5 100644 --- a/code/modules/projectiles/guns/energy/pump.dm +++ b/code/modules/projectiles/guns/energy/pump.dm @@ -107,6 +107,9 @@ ..() /obj/item/gun/energy/locked/frontier/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return return ..(severity+2, recursive) /obj/item/gun/energy/locked/frontier/ex_act() //|rugged| diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 9cd57fe807..7e8f48fd13 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -13,9 +13,6 @@ slot_flags = SLOT_BACK projectile_type = /obj/item/projectile/ion -/obj/item/gun/energy/ionrifle/emp_act(severity, recursive) - return - /obj/item/gun/energy/ionrifle/empty cell_type = null diff --git a/code/modules/recycling/disposal_junctions.dm b/code/modules/recycling/disposal_junctions.dm index 058b2c17df..73850942a9 100644 --- a/code/modules/recycling/disposal_junctions.dm +++ b/code/modules/recycling/disposal_junctions.dm @@ -56,7 +56,6 @@ var/last_sort = FALSE var/sort_scan = TRUE var/panel_open = FALSE - var/datum/wires/wires = null // ...Why isnt this defined on /atom... /obj/structure/disposalpipe/sortjunction/proc/updatedesc() desc = initial(desc) @@ -90,7 +89,7 @@ if(sortType) LAZYADD(GLOB.tagger_locations["[sortType]"], get_z(src)) - wires = new /datum/wires/disposals(src) + set_wires(new /datum/wires/disposals(src)) updatedir() updatename() diff --git a/code/modules/research/tg/machinery/circuit_imprinter.dm b/code/modules/research/tg/machinery/circuit_imprinter.dm index 0b86f1e941..709cb0c71b 100644 --- a/code/modules/research/tg/machinery/circuit_imprinter.dm +++ b/code/modules/research/tg/machinery/circuit_imprinter.dm @@ -8,7 +8,7 @@ /obj/machinery/rnd/production/circuit_imprinter/Initialize(mapload) . = ..() - wires = new /datum/wires/circuit_imprinter(src) + set_wires(new /datum/wires/circuit_imprinter(src)) /obj/machinery/rnd/production/circuit_imprinter/compute_efficiency() var/rating = 0 diff --git a/code/modules/research/tg/machinery/protolathe.dm b/code/modules/research/tg/machinery/protolathe.dm index 0a2312573e..bcc5104f6e 100644 --- a/code/modules/research/tg/machinery/protolathe.dm +++ b/code/modules/research/tg/machinery/protolathe.dm @@ -8,4 +8,4 @@ /obj/machinery/rnd/production/protolathe/Initialize(mapload) . = ..() - wires = new /datum/wires/protolathe(src) + set_wires(new /datum/wires/protolathe(src)) diff --git a/code/modules/research/tg/rdmachines.dm b/code/modules/research/tg/rdmachines.dm index 01a54f9cfb..dc399c8817 100644 --- a/code/modules/research/tg/rdmachines.dm +++ b/code/modules/research/tg/rdmachines.dm @@ -15,8 +15,6 @@ var/datum/techweb/stored_research ///The item loaded inside the machine, used by experimentors and destructive analyzers only. var/datum/weakref/loaded_item - /// Wires for hacking, not every rnd machine has this set - var/datum/wires/protolathe/wires = null /obj/machinery/rnd/Initialize(mapload) . = ..() @@ -24,6 +22,7 @@ CONNECT_TO_RND_SERVER_ROUNDSTART(stored_research, src) if(stored_research) on_connected_techweb() + set_wires(new /datum/wires/rnd(src)) /obj/machinery/rnd/Destroy() if(stored_research) diff --git a/code/modules/research/tg/server.dm b/code/modules/research/tg/server.dm index f6ba9de14a..ea90d5d439 100644 --- a/code/modules/research/tg/server.dm +++ b/code/modules/research/tg/server.dm @@ -53,6 +53,8 @@ /obj/machinery/rnd/server/emp_act(severity, recursive) . = ..() + if (. & EMP_PROTECT_SELF) + return stat |= EMPED addtimer(CALLBACK(src, PROC_REF(fix_emp)), 60 SECONDS) refresh_working() diff --git a/code/modules/shieldgen/directional_shield.dm b/code/modules/shieldgen/directional_shield.dm index b964677205..5d5ed71bb2 100644 --- a/code/modules/shieldgen/directional_shield.dm +++ b/code/modules/shieldgen/directional_shield.dm @@ -227,6 +227,9 @@ . += "Its shield matrix is at [round( (shield_health / max_shield_health) * 100, 0.01)]% strength." /obj/item/shield_projector/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return adjust_health(-max_shield_health / severity) // A strong EMP will kill the shield instantly, but weaker ones won't on the first hit. // Subtypes diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm index 0391c351c3..d52b50ef20 100644 --- a/code/modules/shieldgen/emergency_shield.dm +++ b/code/modules/shieldgen/emergency_shield.dm @@ -81,6 +81,9 @@ return /obj/machinery/shield/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return switch(severity) if(1) qdel(src) @@ -257,6 +260,9 @@ return /obj/machinery/shieldgen/emp_act(severity, recursive) + . = ..() + if (. & EMP_PROTECT_SELF) + return switch(severity) if(1) src.health /= 2 //cut health in half diff --git a/code/modules/shieldgen/energy_shield.dm b/code/modules/shieldgen/energy_shield.dm index 54fae0cb9e..28c9fa6672 100644 --- a/code/modules/shieldgen/energy_shield.dm +++ b/code/modules/shieldgen/energy_shield.dm @@ -215,9 +215,10 @@ // EMP. It may seem weak but keep in mind that multiple shield segments are likely to be affected. /obj/effect/shield/emp_act(severity, recursive) - if(!disabled_for) - take_damage(rand(30,60) / severity, SHIELD_DAMTYPE_EM) - + . = ..() + if (. & EMP_PROTECT_SELF || disabled_for) + return + take_damage(rand(30,60) / severity, SHIELD_DAMTYPE_EM) // Explosions /obj/effect/shield/ex_act(var/severity) diff --git a/code/modules/shieldgen/shield_generator.dm b/code/modules/shieldgen/shield_generator.dm index fc472b0dcd..299f840459 100644 --- a/code/modules/shieldgen/shield_generator.dm +++ b/code/modules/shieldgen/shield_generator.dm @@ -8,7 +8,6 @@ icon_state = "generator0" circuit = /obj/item/circuitboard/shield_generator density = TRUE - var/datum/wires/shield_generator/wires = null var/list/field_segments = list() // List of all shield segments owned by this generator. var/list/damaged_segments = list() // List of shield segments that have failed and are currently regenerating. var/shield_modes = 0 // Enabled shield mode flags @@ -52,8 +51,7 @@ /obj/machinery/power/shield_generator/Initialize(mapload) . = ..() - if(!wires) - wires = new(src) + set_wires(new /datum/wires/shield_generator(src)) default_apply_parts() connect_to_network() diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index cf649615d3..975c6e83b0 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -152,9 +152,6 @@ /obj/machinery/computer/shuttle_control/ex_act() return -/obj/machinery/computer/shuttle_control/emp_act(severity, recursive) - return - /obj/item/paper/dockingcodes name = "Docking Codes" var/codes_from_z = null //So you can put codes from the station other places to give to antags or whatever diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index ca2c60804d..946ddd5683 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -171,7 +171,8 @@ return /obj/vehicle/emp_act(severity, recursive) - if(!mechanical) + . = ..() + if (. & EMP_PROTECT_SELF || !mechanical) return var/was_on = on diff --git a/code/modules/vore/eating/belly_obj.dm b/code/modules/vore/eating/belly_obj.dm index e5573f9c19..cfc7b4ece2 100644 --- a/code/modules/vore/eating/belly_obj.dm +++ b/code/modules/vore/eating/belly_obj.dm @@ -505,6 +505,7 @@ START_PROCESSING(SSbellies, src) create_reagents(300) // So we can have some liquids in bellies + AddElement(/datum/element/empprotection, EMP_PROTECT_ALL) /obj/belly/Destroy() if(mode_flags & DM_FLAG_TURBOMODE) diff --git a/modular_chomp/code/modules/clothing/spacesuits/rig/modules/specific/defib.dm b/modular_chomp/code/modules/clothing/spacesuits/rig/modules/specific/defib.dm index 678281f19e..95d0b7351d 100644 --- a/modular_chomp/code/modules/clothing/spacesuits/rig/modules/specific/defib.dm +++ b/modular_chomp/code/modules/clothing/spacesuits/rig/modules/specific/defib.dm @@ -13,8 +13,9 @@ desc = "Rig mounted defib. How are you seeing this? Stop that." wielded = 1 -/obj/item/shockpaddles/standalone/rig/emp_act(severity) - return +/obj/item/shockpaddles/standalone/rig/Initialize(mapload) + AddElement(/datum/element/empprotection, EMP_PROTECT_SELF) + . = ..() /obj/item/shockpaddles/standalone/rig/checked_use(var/charge_amt) return 1 diff --git a/vorestation.dme b/vorestation.dme index 09ebe9dd0a..ddc4490761 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -90,6 +90,7 @@ #include "code\__defines\dna.dm" #include "code\__defines\do_afters.dm" #include "code\__defines\economy_misc.dm" +#include "code\__defines\emp.dm" #include "code\__defines\equipment_vendor.dm" #include "code\__defines\events.dm" #include "code\__defines\exosuit_fab.dm" @@ -884,6 +885,7 @@ #include "code\datums\elements\conflict_checking.dm" #include "code\datums\elements\connect_loc.dm" #include "code\datums\elements\electrovoreable.dm" +#include "code\datums\elements\empprotection.dm" #include "code\datums\elements\footstep.dm" #include "code\datums\elements\footstep_override.dm" #include "code\datums\elements\godmode.dm" @@ -1045,6 +1047,7 @@ #include "code\datums\wires\mines.dm" #include "code\datums\wires\particle_accelerator.dm" #include "code\datums\wires\protolathe.dm" +#include "code\datums\wires\r_n_d.dm" #include "code\datums\wires\radio.dm" #include "code\datums\wires\robot.dm" #include "code\datums\wires\seedstorage.dm"