Files
VOREStation/code/game/objects/empulse.dm
T
Guti 8e357dd556 EMP & Wires refactor (#19401)
* EMP Refactor

* EVERYBODY gets wires

* Shield gen

* fix

* Fix those

* Changes

* ,

* kill

---------

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
2026-04-11 15:05:41 -04:00

70 lines
2.2 KiB
Plaintext

// 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
/proc/empulse(turf/epicenter, first_range, second_range, third_range, fourth_range, log=0)
if(!epicenter)
return
if(!istype(epicenter, /turf))
epicenter = get_turf(epicenter.loc)
if(log)
message_admins("EMP with size ([first_range], [second_range], [third_range], [fourth_range]) in area [epicenter.loc.name] ")
log_game("EMP with size ([first_range], [second_range], [third_range], [fourth_range]) in area [epicenter.loc.name] ")
if(first_range > 1)
new /obj/effect/temp_visual/emp/pulse(epicenter)
if(first_range > second_range)
second_range = first_range
if(second_range > third_range)
third_range = second_range
if(third_range > fourth_range)
fourth_range = third_range
for(var/mob/M in range(first_range, epicenter))
playsound(epicenter, 'sound/effects/EMPulse.ogg', 100, TRUE)
for(var/atom/T in spiral_range_turfs(fourth_range, epicenter))
#ifdef EMPDEBUG
var/time = world.timeofday
#endif
var/distance = get_dist(epicenter, T)
if(distance < 0)
distance = 0
//Worst effects, really hurts
if(distance < first_range)
T.emp_act(EMP_HEAVY)
else if(distance == first_range)
if(prob(50))
T.emp_act(EMP_HEAVY)
else
T.emp_act(EMP_MEDIUM)
//Slightly less painful
else if(distance <= second_range)
T.emp_act(EMP_MEDIUM)
else if(distance == second_range)
if(prob(50))
T.emp_act(EMP_MEDIUM)
else
T.emp_act(EMP_LIGHT)
//Even less slightly less painful
else if(distance <= third_range)
T.emp_act(EMP_LIGHT)
else if(distance == third_range)
if(prob(50))
T.emp_act(EMP_MEDIUM)
else
T.emp_act(EMP_LIGHT)
//This should be more or less harmless
else if(distance <= fourth_range)
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 TRUE