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:
PsiOmegaDelta
2015-12-27 17:44:53 +01:00
parent 1a8fc50f1e
commit a4545f8ded
28 changed files with 107 additions and 88 deletions
-2
View File
@@ -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
View File
@@ -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 -2
View File
@@ -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