mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Adds EMP monitoring for future EMP debugging
- Adds possibility to enable EMP debugging, that monitors how long emp_act() took on object. If it took too long (configurable) it generates a message. It is disabled by default due to possible performance loss with large EMPs.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
// 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, heavy_range, light_range, log=0)
|
proc/empulse(turf/epicenter, heavy_range, light_range, log=0)
|
||||||
if(!epicenter) return
|
if(!epicenter) return
|
||||||
|
|
||||||
@@ -24,6 +30,9 @@ proc/empulse(turf/epicenter, heavy_range, light_range, log=0)
|
|||||||
M << 'sound/effects/EMPulse.ogg'
|
M << 'sound/effects/EMPulse.ogg'
|
||||||
|
|
||||||
for(var/atom/T in range(light_range, epicenter))
|
for(var/atom/T in range(light_range, epicenter))
|
||||||
|
#ifdef EMPDEBUG
|
||||||
|
var/time = world.timeofday
|
||||||
|
#endif
|
||||||
var/distance = get_dist(epicenter, T)
|
var/distance = get_dist(epicenter, T)
|
||||||
if(distance < 0)
|
if(distance < 0)
|
||||||
distance = 0
|
distance = 0
|
||||||
@@ -36,4 +45,8 @@ proc/empulse(turf/epicenter, heavy_range, light_range, log=0)
|
|||||||
T.emp_act(2)
|
T.emp_act(2)
|
||||||
else if(distance <= light_range)
|
else if(distance <= light_range)
|
||||||
T.emp_act(2)
|
T.emp_act(2)
|
||||||
|
#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 1
|
||||||
Reference in New Issue
Block a user