mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-24 14:36:46 +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
900 B
Plaintext
24 lines
900 B
Plaintext
/**
|
|
* Abstract-ness is a meta-property of a class that is used to indicate
|
|
* that the class is intended to be used as a base class for others, and
|
|
* should not (or cannot) be instantiated.
|
|
* We have no such language concept in DM, and so we provide a datum member
|
|
* that can be used to hint at abstractness for circumstances where we would
|
|
* like that to be the case, such as base behavior providers.
|
|
*/
|
|
|
|
/// If set, a path at/above this one that expects not to be instantiated.
|
|
/datum/var/abstract_type
|
|
|
|
/// If true, this datum is an instance of an abstract type. Oops.
|
|
/datum/proc/is_datum_abstract()
|
|
SHOULD_NOT_OVERRIDE(TRUE)
|
|
return type == abstract_type
|
|
|
|
/// Passed a path or instance, returns whether it is abstract. Otherwise null.
|
|
/proc/is_abstract(datum/thing)
|
|
if (ispath(thing))
|
|
return thing == initial(thing.abstract_type)
|
|
if (istype(thing))
|
|
return thing.is_datum_abstract()
|