[MIRROR] Timer subsystem update (#9320)

Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2024-10-26 16:00:51 -07:00
committed by GitHub
parent 71ba4d06d0
commit 0533702085
9 changed files with 112 additions and 96 deletions

View File

@@ -22,7 +22,7 @@
var/list/open_tguis // CHOMPEdit: FIXME: open_uis
/// Active timers with this datum as the target
var/list/_active_timers // CHOMPEdit
var/list/_active_timers
/// Status traits attached to this datum. associative list of the form: list(trait name (string) = list(source1, source2, source3,...))
var/list/_status_traits
@@ -71,9 +71,22 @@
// Create and destroy is weird and I wanna cover my bases
var/harddel_deets_dumped = FALSE
// Default implementation of clean-up code.
// This should be overridden to remove all references pointing to the object being destroyed.
// Return the appropriate QDEL_HINT; in most cases this is QDEL_HINT_QUEUE.
/**
* Default implementation of clean-up code.
*
* This should be overridden to remove all references pointing to the object being destroyed, if
* you do override it, make sure to call the parent and return its return value by default
*
* Return an appropriate [QDEL_HINT][QDEL_HINT_QUEUE] to modify handling of your deletion;
* in most cases this is [QDEL_HINT_QUEUE].
*
* The base case is responsible for doing the following
* * Erasing timers pointing to this datum
* * Erasing compenents on this datum
* * Notifying datums listening to signals from this datum that we are going away
*
* Returns [QDEL_HINT_QUEUE]
*/
/datum/proc/Destroy(force=FALSE)
SHOULD_CALL_PARENT(TRUE)
// SHOULD_NOT_SLEEP(TRUE) FIXME: Causing some big issues still
@@ -81,12 +94,13 @@
weak_reference = null //ensure prompt GCing of weakref.
//clear timers
var/list/timers = _active_timers // CHOMPEdit
_active_timers = null // CHOMPEdit
for(var/datum/timedevent/timer as anything in timers)
if (timer.spent)
continue
qdel(timer)
if(_active_timers)
var/list/timers = _active_timers
_active_timers = null
for(var/datum/timedevent/timer as anything in timers)
if (timer.spent && !(timer.flags & TIMER_DELETE_ME))
continue
qdel(timer)
#ifdef REFERENCE_TRACKING
#ifdef REFERENCE_TRACKING_DEBUG
@@ -110,7 +124,6 @@
_clear_signal_refs()
//END: ECS SHIT
tag = null
SStgui.close_uis(src)
#ifdef REFERENCE_TRACKING