mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 12:29:46 +01:00
@@ -1,15 +1,30 @@
|
||||
// Uncomment this define to check for possible lengthy processing of emp_act()s.
|
||||
// If emp_act() takes more than defined deciseconds (1/10 seconds) an admin message and log is created.
|
||||
// I do not recommend having this uncommented on main server, it probably causes a bit more lag, espicially with larger EMPs.
|
||||
|
||||
// #define EMPDEBUG 10
|
||||
|
||||
/**
|
||||
* Produces an EMP pulse from `epicenter` up to `light_range`
|
||||
*
|
||||
* Calls `emp_act()` with a value of `EMP_HEAVY` up to `heavy_range`, with 50% probability between `EMP_HEAVY` and `EMP_LIGHT` at the exact `heavy_range`,
|
||||
* and with `EMP_LIGHT` up to and including `light_range`
|
||||
*
|
||||
*
|
||||
* * epicenter - A `/turf` where to start the explosion from
|
||||
* * heavy_range - The range in which `EMP_HEAVY` is applied, as a number
|
||||
* * light_range - The range, higher or equal than `heavy_range`, where `EMP_LIGHT` is applied, as a number
|
||||
* * log - Boolean, if you want this call to be logged
|
||||
* * exclude - A `/list` of objects to exclude, and/or paths to exclude
|
||||
*
|
||||
*/
|
||||
/proc/empulse(turf/epicenter, heavy_range, light_range, log = FALSE, list/exclude = null)
|
||||
if(!epicenter) return
|
||||
if(!epicenter)
|
||||
return FALSE
|
||||
|
||||
if(!istype(epicenter, /turf))
|
||||
epicenter = get_turf(epicenter.loc)
|
||||
|
||||
//Ensure we got an actual location, no nullspace or error or other shit
|
||||
if(!(epicenter.x && epicenter.y && epicenter.z))
|
||||
return FALSE
|
||||
|
||||
if(log)
|
||||
message_admins("EMP with size ([heavy_range], [light_range]) in area [epicenter.loc.name] ")
|
||||
log_game("EMP with size ([heavy_range], [light_range]) in area [epicenter.loc.name] ")
|
||||
@@ -20,34 +35,73 @@
|
||||
pulse.icon_state = "emppulse"
|
||||
pulse.name = "emp pulse"
|
||||
pulse.anchored = 1
|
||||
QDEL_IN(pulse, 20)
|
||||
QDEL_IN(pulse, 2 SECONDS)
|
||||
|
||||
if(heavy_range > light_range)
|
||||
light_range = heavy_range
|
||||
|
||||
for(var/mob/M in range(heavy_range, epicenter))
|
||||
sound_to(M, 'sound/effects/EMPulse.ogg')
|
||||
var/list/connected_z_levels = GetConnectedZlevels(epicenter.z) //Get every zlevel that is part of the current location
|
||||
for(var/z in connected_z_levels)
|
||||
|
||||
//We obtain a virtual epicenter for each connected zlevel
|
||||
var/virtual_epicenter = locate(epicenter.x, epicenter.y, z)
|
||||
|
||||
//We assume each zlevel to be 9 meters tall, and apply the pythagorean theorem to obtain the radius of the sphere at that vertical distance from the epicenter
|
||||
var/virtual_heavy_range = abs(epicenter.z - z) ? ( sqrt(((heavy_range*heavy_range)-((9*(epicenter.z - z))*(9*(epicenter.z - z))))) ) : heavy_range
|
||||
var/virtual_light_range = abs(epicenter.z - z) ? ( sqrt(((light_range*light_range)-((9*(epicenter.z - z))*(9*(epicenter.z - z))))) ) : light_range
|
||||
|
||||
for(var/atom/A in range(light_range, epicenter))
|
||||
#ifdef EMPDEBUG
|
||||
var/time = world.timeofday
|
||||
#endif
|
||||
if(exclude && (A in exclude))
|
||||
log_and_message_admins("EMPDEBUG: Heavy range for explosion at Z-level [z] is [virtual_heavy_range]")
|
||||
log_and_message_admins("EMPDEBUG: Light range for explosion at Z-level [z] is [virtual_light_range]")
|
||||
#endif //EMPDEBUG
|
||||
|
||||
if(virtual_light_range < 0 && virtual_heavy_range < 0)
|
||||
continue
|
||||
var/distance = get_dist(epicenter, A)
|
||||
if(distance < 0)
|
||||
distance = 0
|
||||
if(distance < heavy_range)
|
||||
A.emp_act(1)
|
||||
else if(distance == heavy_range)
|
||||
if(prob(50))
|
||||
A.emp_act(1)
|
||||
else
|
||||
A.emp_act(2)
|
||||
else if(distance <= light_range)
|
||||
A.emp_act(2)
|
||||
#ifdef EMPDEBUG
|
||||
if((world.timeofday - time) >= EMPDEBUG)
|
||||
log_and_message_admins("EMPDEBUG: [A.name] - [A.type] - took [world.timeofday - time]ds to process emp_act()!")
|
||||
#endif
|
||||
return 1
|
||||
|
||||
if(virtual_heavy_range > 1)
|
||||
for(var/mob/M in range(virtual_heavy_range, virtual_epicenter))
|
||||
sound_to(M, 'sound/effects/EMPulse.ogg')
|
||||
CHECK_TICK
|
||||
|
||||
loop_apply_emp:
|
||||
for(var/atom/A in spiral_range(max(virtual_light_range, virtual_heavy_range) , virtual_epicenter))
|
||||
|
||||
#ifdef EMPDEBUG
|
||||
var/time = world.timeofday
|
||||
#endif
|
||||
|
||||
if(exclude && length(exclude)) //We have a list with at least one element to exclude
|
||||
|
||||
for(var/element in exclude)
|
||||
if(ispath(element))
|
||||
if(istype(A, element))
|
||||
continue loop_apply_emp
|
||||
else
|
||||
if(A == element)
|
||||
continue loop_apply_emp
|
||||
|
||||
var/distance = get_dist(epicenter, A)
|
||||
if(distance < 0)
|
||||
distance = 0
|
||||
|
||||
|
||||
if(distance < virtual_heavy_range)
|
||||
A.emp_act(EMP_HEAVY)
|
||||
|
||||
else if(distance == virtual_heavy_range)
|
||||
if(prob(50)) //50% probability it's heavy or light, at the exact heavy range
|
||||
A.emp_act(EMP_HEAVY)
|
||||
else
|
||||
A.emp_act(EMP_LIGHT)
|
||||
|
||||
else if(distance <= virtual_light_range)
|
||||
A.emp_act(EMP_LIGHT)
|
||||
|
||||
#ifdef EMPDEBUG
|
||||
if((world.timeofday - time) >= EMPDEBUG)
|
||||
log_and_message_admins("EMPDEBUG: [A.name] - [A.type] - took [world.timeofday - time]ds to process emp_act()!")
|
||||
#endif //EMPDEBUG
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
return TRUE
|
||||
|
||||
@@ -533,6 +533,8 @@
|
||||
return TRUE
|
||||
|
||||
/obj/item/shockpaddles/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
var/new_safety = rand(0, 1)
|
||||
if(safety != new_safety)
|
||||
safety = new_safety
|
||||
@@ -543,7 +545,6 @@
|
||||
make_announcement("beeps, \"Safety protocols disabled!\"", "warning")
|
||||
playsound(get_turf(src), 'sound/machines/defib_safetyoff.ogg', 50, 0)
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/item/shockpaddles/robot
|
||||
name = "defibrillator paddles"
|
||||
@@ -669,13 +670,17 @@
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
|
||||
/obj/item/shockpaddles/standalone/emp_act(severity)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
var/new_fail = 0
|
||||
|
||||
switch(severity)
|
||||
if(3)
|
||||
|
||||
if(EMP_HEAVY)
|
||||
new_fail = max(fail_counter, 20)
|
||||
visible_message("\The [src]'s reactor overloads!")
|
||||
if(2)
|
||||
|
||||
if(EMP_LIGHT)
|
||||
new_fail = max(fail_counter, 8)
|
||||
if(ismob(loc))
|
||||
to_chat(loc, SPAN_WARNING("\The [src] feel pleasantly warm."))
|
||||
|
||||
@@ -252,6 +252,8 @@
|
||||
..()
|
||||
|
||||
/obj/item/auto_cpr/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
epp_off()
|
||||
cpr_mode = FALSE
|
||||
if(battery)
|
||||
|
||||
@@ -152,12 +152,13 @@
|
||||
L.disable_cloaking_device()
|
||||
|
||||
/obj/item/device/flash/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
var/mob/living/L = loc
|
||||
if(!istype(L) || broken || burnout_check(L, intensity = 15 / severity))
|
||||
return
|
||||
to_chat(L, SPAN_WARNING("Your [src] goes off!"))
|
||||
flash(L)
|
||||
..()
|
||||
|
||||
/obj/item/device/flash/synthetic
|
||||
name = "synthetic flash"
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
var/obj/machinery/camera/C = target
|
||||
|
||||
if(prob(25))
|
||||
C.emp_act(28)
|
||||
C.emp_act(EMP_LIGHT)
|
||||
selfmsg = "<span class='notice'>You hit the lens of \the [C] with \the [src], temporarily disabling the camera!</span>"
|
||||
|
||||
admin_attack_log(user, src,"hits the camera with a laser pointer", "EMPd a camera with a laser pointer")
|
||||
|
||||
@@ -215,9 +215,10 @@
|
||||
update_light()
|
||||
|
||||
/obj/item/device/flashlight/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
for(var/obj/O in contents)
|
||||
O.emp_act(severity)
|
||||
..()
|
||||
|
||||
/obj/item/device/flashlight/attack(mob/living/M as mob, mob/living/user as mob)
|
||||
add_fingerprint(user)
|
||||
|
||||
@@ -429,6 +429,8 @@
|
||||
M.show_message(SPAN_NOTICE("\The [src] flashes a message across its screen, \"Additional personalities available for download.\""), 3, SPAN_NOTICE("\The [src] bleeps electronically."), 2)
|
||||
|
||||
/obj/item/device/paicard/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
for(var/mob/M in src)
|
||||
M.emp_act(severity)
|
||||
|
||||
|
||||
@@ -171,10 +171,10 @@
|
||||
else
|
||||
AP.flicker_all()
|
||||
else if (T.master)
|
||||
T.master.emp_act(dist)
|
||||
T.master.emp_act(EMP_LIGHT)
|
||||
|
||||
var/atom/aa = A
|
||||
aa.emp_act(dist)
|
||||
aa.emp_act(EMP_LIGHT)
|
||||
|
||||
if (prob(15 * dist))
|
||||
explosion(aa.loc, 0, 0, 3, 4)
|
||||
|
||||
@@ -66,4 +66,6 @@ var/global/list/teleportbeacons = list()
|
||||
return
|
||||
|
||||
/obj/item/device/radio/beacon/fixed/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
return
|
||||
|
||||
@@ -541,11 +541,12 @@ var/global/list/default_interrogation_channels = list(
|
||||
else return
|
||||
|
||||
/obj/item/device/radio/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
set_broadcasting(FALSE)
|
||||
set_listening(FALSE)
|
||||
for (var/ch_name in channels)
|
||||
channels[ch_name] = 0
|
||||
..()
|
||||
|
||||
//
|
||||
// Vesselbound Synthetic Radio
|
||||
|
||||
@@ -64,7 +64,9 @@ var/list/active_radio_jammers = list()
|
||||
update_icon()
|
||||
. = TRUE
|
||||
|
||||
/obj/item/device/radiojammer/emp_act()
|
||||
/obj/item/device/radiojammer/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
toggle()
|
||||
|
||||
/obj/item/device/radiojammer/proc/toggle(var/mob/user)
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
/obj/item/device/t_scanner/update_icon()
|
||||
icon_state = "t-ray[on]"
|
||||
|
||||
/obj/item/device/t_scanner/emp_act()
|
||||
/obj/item/device/t_scanner/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
audible_message(src, SPAN_NOTICE("\The [src] buzzes oddly."))
|
||||
set_active(FALSE)
|
||||
|
||||
|
||||
@@ -269,6 +269,8 @@
|
||||
fried = TRUE
|
||||
|
||||
/obj/item/nralakktag/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
unclamp()
|
||||
|
||||
/obj/item/nralakktag/emag_act(var/remaining_charges, var/mob/user)
|
||||
|
||||
@@ -92,10 +92,11 @@
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
|
||||
/obj/item/cloaking_device/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
deactivate()
|
||||
if (cell)
|
||||
cell.emp_act(severity)
|
||||
..()
|
||||
|
||||
/obj/item/cloaking_device/proc/register_owner(var/mob/user)
|
||||
if (!owner || owner != user)
|
||||
|
||||
@@ -45,12 +45,14 @@
|
||||
return TRUE
|
||||
|
||||
/obj/item/implant/aggression/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if(malfunction)
|
||||
return
|
||||
malfunction = MALFUNCTION_TEMPORARY
|
||||
|
||||
activate("emp")
|
||||
if(severity == 1)
|
||||
if(severity == EMP_HEAVY)
|
||||
if(prob(50))
|
||||
meltdown()
|
||||
else if(prob(50))
|
||||
|
||||
@@ -23,16 +23,15 @@
|
||||
return TRUE
|
||||
|
||||
/obj/item/implant/anti_augment/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
if(EMP_HEAVY)
|
||||
if (prob(75))
|
||||
qdel(src)
|
||||
if(2.0)
|
||||
if(EMP_LIGHT)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
if(3.0)
|
||||
if (prob(25))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/implantcase/anti_augment
|
||||
|
||||
@@ -62,15 +62,18 @@ the implant may become unstable and either pre-maturely inject the subject or si
|
||||
..()
|
||||
|
||||
/obj/item/implant/chem/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if (malfunction)
|
||||
return
|
||||
|
||||
malfunction = MALFUNCTION_TEMPORARY
|
||||
|
||||
switch(severity)
|
||||
if(1)
|
||||
if(EMP_HEAVY)
|
||||
if(prob(60))
|
||||
activate(20)
|
||||
if(2)
|
||||
if(EMP_LIGHT)
|
||||
if(prob(30))
|
||||
activate(5)
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
return dat
|
||||
|
||||
/obj/item/implant/integrated_circuit/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
IC.emp_act(severity)
|
||||
|
||||
/obj/item/implant/integrated_circuit/examine(mob/user, distance, is_adjacent)
|
||||
|
||||
@@ -55,12 +55,15 @@
|
||||
global_announcer.autosay(death_message, "[mobname]'s Death Alarm", channel)
|
||||
|
||||
/obj/item/implant/death_alarm/emp_act(severity) //for some reason alarms stop going off in case they are emp'd, even without this
|
||||
. = ..()
|
||||
|
||||
if (malfunction) //so I'm just going to add a meltdown chance here
|
||||
return
|
||||
|
||||
malfunction = MALFUNCTION_TEMPORARY
|
||||
|
||||
activate("emp") //let's shout that this dude is dead
|
||||
if(severity == 1)
|
||||
if(severity == EMP_HEAVY)
|
||||
if(prob(40)) //small chance of obvious meltdown
|
||||
meltdown()
|
||||
else if (prob(60)) //but more likely it will just quietly die
|
||||
|
||||
@@ -197,6 +197,8 @@
|
||||
return TRUE
|
||||
|
||||
/obj/item/implant/explosive/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if(malfunction)
|
||||
return
|
||||
malfunction = MALFUNCTION_TEMPORARY
|
||||
@@ -280,21 +282,19 @@
|
||||
return TRUE
|
||||
|
||||
/obj/item/implant/explosive/deadman/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if(malfunction)
|
||||
return
|
||||
|
||||
malfunction = MALFUNCTION_TEMPORARY
|
||||
switch (severity)
|
||||
if(3.0)
|
||||
if(prob(1))
|
||||
small_countdown()
|
||||
else if(prob(5))
|
||||
meltdown()
|
||||
if(2.0)
|
||||
if(EMP_LIGHT)
|
||||
if(prob(5))
|
||||
small_countdown()
|
||||
else if (prob(10))
|
||||
meltdown()
|
||||
if(1.0)
|
||||
if(EMP_HEAVY)
|
||||
if(prob(10))
|
||||
small_countdown()
|
||||
else if (prob(30))
|
||||
|
||||
@@ -39,12 +39,15 @@
|
||||
return TRUE
|
||||
|
||||
/obj/item/implant/mindshield/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if (malfunction)
|
||||
return
|
||||
|
||||
malfunction = MALFUNCTION_TEMPORARY
|
||||
|
||||
activate("emp")
|
||||
if(severity == 1)
|
||||
if(severity == EMP_HEAVY)
|
||||
if(prob(50))
|
||||
meltdown()
|
||||
else if (prob(50))
|
||||
|
||||
@@ -48,16 +48,18 @@ Implant Specifics:<BR>"}
|
||||
return TRUE
|
||||
|
||||
/obj/item/implant/tracking/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if (malfunction) //no, dawg, you can't malfunction while you are malfunctioning
|
||||
return
|
||||
malfunction = MALFUNCTION_TEMPORARY
|
||||
|
||||
var/delay = 20
|
||||
switch(severity)
|
||||
if(1)
|
||||
if(EMP_HEAVY)
|
||||
if(prob(60))
|
||||
meltdown()
|
||||
if(2)
|
||||
if(EMP_LIGHT)
|
||||
delay = rand(5*60*10,15*60*10) //from 5 to 15 minutes of free time
|
||||
|
||||
spawn(delay)
|
||||
|
||||
@@ -749,10 +749,11 @@
|
||||
max_storage_space = max(total_storage_space,max_storage_space) //prevents spawned containers from being too small for their contents
|
||||
|
||||
/obj/item/storage/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if(!istype(src.loc, /mob/living))
|
||||
for(var/obj/O in contents)
|
||||
O.emp_act(severity)
|
||||
..()
|
||||
|
||||
/obj/item/storage/attack_self(mob/user as mob)
|
||||
//Clicking on itself will empty it, if it has the verb to do that.
|
||||
|
||||
@@ -198,9 +198,10 @@
|
||||
return 1
|
||||
|
||||
/obj/item/melee/baton/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if(bcell)
|
||||
bcell.emp_act(severity) //let's not duplicate code everywhere if we don't have to please.
|
||||
..()
|
||||
|
||||
//secborg stun baton module
|
||||
|
||||
|
||||
@@ -52,7 +52,9 @@ var/list/global/all_tethers = list()
|
||||
continue
|
||||
tether(TD)
|
||||
|
||||
/obj/item/tethering_device/emp_act()
|
||||
/obj/item/tethering_device/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
deactivate()
|
||||
|
||||
/obj/item/tethering_device/proc/activate()
|
||||
|
||||
@@ -10,8 +10,11 @@
|
||||
health = 200
|
||||
|
||||
/obj/structure/closet/emp_act(severity)
|
||||
. = ..()
|
||||
|
||||
if(!secure)
|
||||
return
|
||||
|
||||
for(var/obj/O in src)
|
||||
O.emp_act(severity)
|
||||
if(!broken)
|
||||
@@ -24,7 +27,6 @@
|
||||
else
|
||||
req_access = list()
|
||||
req_access += pick(get_all_station_access())
|
||||
..()
|
||||
|
||||
/obj/structure/closet/proc/togglelock(mob/user as mob, silent)
|
||||
if(use_check_and_message(user))
|
||||
|
||||
@@ -258,7 +258,8 @@
|
||||
ripped = TRUE
|
||||
if(rip_linked)
|
||||
var/obj/item/stack/material/cloth/C = new(src.loc, flag_size ? 2 : 1)
|
||||
user.put_in_hands(C)
|
||||
if(user)
|
||||
user.put_in_hands(C)
|
||||
if(rip_linked && linked_flag)
|
||||
linked_flag.rip(user, FALSE) // Prevents an infinite ripping loop.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user