Makes GetComponent() faster using typecache magic

This commit is contained in:
CitadelStationBot
2017-08-01 16:59:50 -05:00
parent bbcad2fa58
commit a2e487c86e
2 changed files with 33 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
diff a/code/datums/components/component.dm b/code/datums/components/component.dm (rejected hunks)
@@ -22,8 +22,7 @@
//lazy init the parent's dc list
var/list/dc = P.datum_components
if(!dc)
- dc = list()
- P.datum_components = dc
+ P.datum_components = dc = list()
//set up the typecache
var/our_type = type
@@ -179,4 +178,4 @@
helicopter.SendSignal(COMSIG_COMPONENT_REMOVING, C)
C.OnTransfer(src)
C.parent = src
- SendSignal(COMSIG_COMPONENT_ADDED, C)
\ No newline at end of file
+ SendSignal(COMSIG_COMPONENT_ADDED, C)