mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-30 16:38:22 +01:00
Scheduler, observation, and New() tweaks.
Corrects a number of places where New() did not call ..(), and implements similar changes to attempt to ensure New()/initialize() complete running before qdel() runs. Cuts down on the number of created items during server start.
This commit is contained in:
@@ -28,7 +28,6 @@ var/global/datum/getrev/revdata = new()
|
||||
world.log << branch
|
||||
world.log << date
|
||||
world.log << revision
|
||||
return
|
||||
|
||||
client/verb/showrevinfo()
|
||||
set category = "OOC"
|
||||
@@ -43,4 +42,3 @@ client/verb/showrevinfo()
|
||||
src << revdata.revision
|
||||
else
|
||||
src << "Revision unknown"
|
||||
return
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@
|
||||
|
||||
/datum/mind/New(var/key)
|
||||
src.key = key
|
||||
|
||||
..()
|
||||
|
||||
/datum/mind/proc/transfer_to(mob/living/new_character)
|
||||
if(!istype(new_character))
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
return ..()
|
||||
|
||||
/datum/observ/proc/register(var/datum/procOwner, var/proc_call)
|
||||
if(!(procOwner && procOwner.destruction))
|
||||
return
|
||||
if(!listeners)
|
||||
listeners = list()
|
||||
listeners[procOwner] = proc_call
|
||||
procOwner.destruction.register(src, /datum/observ/proc/unregister)
|
||||
|
||||
/datum/observ/proc/unregister(var/datum/procOwner)
|
||||
if(!listeners)
|
||||
if(!(listeners && procOwner && procOwner.destruction))
|
||||
return
|
||||
listeners -= procOwner
|
||||
procOwner.destruction.unregister(src)
|
||||
@@ -37,7 +39,6 @@
|
||||
..()
|
||||
|
||||
/datum/Destroy()
|
||||
destruction.raise_event(list(src))
|
||||
destroy_observers()
|
||||
return ..()
|
||||
|
||||
@@ -45,12 +46,18 @@
|
||||
destruction = new()
|
||||
|
||||
/datum/proc/destroy_observers()
|
||||
if(!destruction)
|
||||
return FALSE
|
||||
|
||||
destruction.raise_event(list(src))
|
||||
qdel(destruction)
|
||||
destruction = null
|
||||
return TRUE
|
||||
|
||||
// This ensures that observer handlers don't create their own observer handlers, which create their own handlers, which create...
|
||||
/datum/observ/init_observers()
|
||||
return
|
||||
|
||||
// And this ensures that observer handlers don't attempt to notify others about their own death while being unable to.
|
||||
/datum/observ/destroy_observers()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user