SendSignal optimization (#33220)

* SendSignal optimization

* Update component README

* Readd required null checks
This commit is contained in:
Jordan Brown
2017-12-04 06:29:39 -05:00
committed by Emmett Gaines
parent 5a9bd88817
commit 4e01bba3b5
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ Stands have a lot of procs which mimic mob procs. Rather than inserting hooks fo
* Lazy associated list of type -> component/list of components.
1. `/datum/component/var/enabled` (protected, boolean)
* If the component is enabled. If not, it will not react to signals
* `TRUE` by default
* `FALSE` by default, set to `TRUE` when a signal is registered
1. `/datum/component/var/dupe_mode` (protected, enum)
* How duplicate component types are handled when added to the datum.
* `COMPONENT_DUPE_HIGHLANDER` (default): Old component will be deleted, new component will first have `/datum/component/proc/InheritComponent(datum/component/old, FALSE)` on it
+5 -5
View File
@@ -1,5 +1,5 @@
/datum/component
var/enabled = TRUE
var/enabled = FALSE
var/dupe_mode = COMPONENT_DUPE_HIGHLANDER
var/dupe_type
var/list/signal_procs
@@ -133,6 +133,8 @@
if(!istype(proc_or_callback, /datum/callback)) //if it wasnt a callback before, it is now
proc_or_callback = CALLBACK(src, proc_or_callback)
procs[sig_type] = proc_or_callback
enabled = TRUE
/datum/component/proc/InheritComponent(datum/component/C, i_am_original)
return
@@ -172,8 +174,7 @@
var/datum/component/C = target
if(!C.enabled)
return NONE
var/list/sps = C.signal_procs
var/datum/callback/CB = LAZYACCESS(sps, sigtype)
var/datum/callback/CB = C.signal_procs[sigtype]
if(!CB)
return NONE
. = CB.InvokeAsync(arglist(arguments))
@@ -186,8 +187,7 @@
var/datum/component/C = I
if(!C.enabled)
continue
var/list/sps = C.signal_procs
var/datum/callback/CB = LAZYACCESS(sps, sigtype)
var/datum/callback/CB = C.signal_procs[sigtype]
if(!CB)
continue
var/retval = CB.InvokeAsync(arglist(arguments))