mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-27 18:06:32 +01:00
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request I finally have the pleasure of killing decl by giving it a new name and updated handling. Also abstract_types now have universal support! Based on: Baystation12/Baystation12/pull/32114 Baystation12/Baystation12/pull/32687 ## Changelog 🆑 code: /decl/ is now /singleton/ code: abstract_type is now on the /datum/ level /🆑 <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. -->
24 lines
1.3 KiB
Plaintext
24 lines
1.3 KiB
Plaintext
/*
|
|
* Performance behaviors for avoiding calling procs unecessarily on the Singletons global.
|
|
*/
|
|
|
|
/// Get a singleton instance according to path P. Creates it if necessary. Null if abstract or not a singleton.
|
|
#define GET_SINGLETON(P)\
|
|
(ispath(P, /singleton) ? (Singletons.resolved_instances[P] ? Singletons.instances[P] : Singletons.GetInstance(P)) : null)
|
|
|
|
/// Get a (path = instance) map of valid singletons according to typesof(P).
|
|
#define GET_SINGLETON_TYPE_MAP(P)\
|
|
(ispath(P, /singleton) ? (Singletons.resolved_type_maps[P] ? Singletons.type_maps[P] : Singletons.GetTypeMap(P)) : list())
|
|
|
|
/// Get a (path = instance) map of valid singletons according to subtypesof(P).
|
|
#define GET_SINGLETON_SUBTYPE_MAP(P)\
|
|
(ispath(P, /singleton) ? (Singletons.resolved_subtype_maps[P] ? Singletons.subtype_maps[P] : Singletons.GetSubtypeMap(P)) : list())
|
|
|
|
/// Get a list of valid singletons according to typesof(path).
|
|
#define GET_SINGLETON_TYPE_LIST(P)\
|
|
(ispath(P, /singleton) ? (Singletons.resolved_type_lists[P] ? Singletons.type_lists[P] : Singletons.GetTypeList(P)) : list())
|
|
|
|
/// Get a list of valid singletons according to subtypesof(path).
|
|
#define GET_SINGLETON_SUBTYPE_LIST(P)\
|
|
(ispath(P, /singleton) ? (Singletons.resolved_subtype_lists[P] ? Singletons.subtype_lists[P] : Singletons.GetSubtypeList(P)) : list())
|