mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-24 09:56:52 +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. -->
32 lines
893 B
Plaintext
32 lines
893 B
Plaintext
/singleton/hierarchy
|
|
var/name = "Hierarchy"
|
|
var/hierarchy_type
|
|
var/singleton/hierarchy/parent
|
|
var/list/singleton/hierarchy/children
|
|
|
|
/singleton/hierarchy/New(var/full_init = TRUE)
|
|
children = list()
|
|
if(!full_init)
|
|
return
|
|
|
|
var/list/all_subtypes = list()
|
|
all_subtypes[type] = src
|
|
for(var/subtype in subtypesof(type))
|
|
all_subtypes[subtype] = new subtype(FALSE)
|
|
|
|
for(var/subtype in (all_subtypes - type))
|
|
var/singleton/hierarchy/subtype_instance = all_subtypes[subtype]
|
|
var/singleton/hierarchy/subtype_parent = all_subtypes[subtype_instance.parent_type]
|
|
subtype_instance.parent = subtype_parent
|
|
|
|
dd_insertObjectList(subtype_parent.children, subtype_instance)
|
|
|
|
/singleton/hierarchy/proc/is_category()
|
|
return hierarchy_type == type || children.len
|
|
|
|
/singleton/hierarchy/proc/is_hidden_category()
|
|
return hierarchy_type == type
|
|
|
|
/singleton/hierarchy/dd_SortValue()
|
|
return name
|