Makes GetComponent() faster using typecache magic (#29523)

Added /proc/type2parent which takes a type (string, or type) and returns it's parent type (initial(x.parent_type) doesn't work)

Instead of being a raw list of components, /datum/var/datum_components is now associated list keyed by type with some bells and whistles to make GetComponent() calls faster
This commit is contained in:
Jordan Brown
2017-08-02 09:58:53 +12:00
committed by oranges
parent 1aa23ee3d9
commit 452c5ce360
3 changed files with 92 additions and 15 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ Stands have a lot of procs which mimic mob procs. Rather than inserting hooks fo
### Vars
1. `/datum/var/list/datum_components` (private)
* Lazy list of all components a datum has (TODO: Make this a typecache with longer paths overwriting shorter ones maybe? It'd be weird)
* 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