Timers sanity checks Port from TG. (#6125)

This adds timers sanity checks with stack tracing of where it was called. Check are:

If timer had no callback(crashes timer)

If timer was called with negative wait time. Converts time to 0 and gives call stack.

If timer was called on deleted or about to be deleted object. Still runs, but gives call stack

If timer had infinite or more wait time. Crashes timer

Adds sanity check to beams for timer wait time.
This commit is contained in:
Mykhailo Bykhovtsev
2019-03-24 13:21:04 +02:00
committed by Erki
parent 03bff09f6e
commit f38cd3c70b
3 changed files with 55 additions and 1 deletions
+3
View File
@@ -149,6 +149,9 @@
return ..()
/atom/proc/Beam(atom/BeamTarget,icon_state="b_beam",icon='icons/effects/beam.dmi',time=50, maxdistance=10,beam_type=/obj/effect/ebeam,beam_sleep_time = 3)
if(time >= INFINITY)
crash_with("Tried to create beam with infinite time!")
return null
var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type,beam_sleep_time)
INVOKE_ASYNC(newbeam, /datum/beam/.proc/Start)
return newbeam