Goonstation 13 - Modules - TypesDefine Details

_std/types.dm

/proc/concrete_typesof typesof() but only for concrete (not abstract) types, it caches the result so you don't need to worry about doing that manually so subsequent calls on the same type will be very fast.
/proc/filtered_concrete_typesof The same thing but now you can filter the types using a proc. Also cached. The filter proc takes a type and should return 1 if we want to include it and 0 otherwise. That proc should also be pure (always return the same thing for the same arguments) because of the caching. If you want to use non-pure proc do the filtering manually yourself and don't use this. Note that the first call to filtered_concrete_typesof with a given type and filter will be (possibly a lot) slower than doing it manually. The benefit of this proc only shows itself for future calls which are very fast due to caching.
/proc/get_singleton Gets the instance of a singleton type (or a non-singleton type if you decide to use it on one).
/proc/predecessor_path_in_list Find predecessor of a type
/proc/maximal_subtype Returns the maximal subtype (i.e. the most subby) in a list of given types
/var/by_type contains lists of objects indexed by their type based on START_TRACKING / STOP_TRACKING
for_by_tclPerforms a typecheckless for loop with var/iterator over by_type[_type]
/var/by_cat contains lists of objects indexed by a category string based on START_TRACKING_CAT / STOP_TRACKING_CAT
/typeinfotype-level information type
TYPEINFODeclares typeinfo for some type.
/proc/get_type_typeinfo Retrieves the typeinfo datum for a given type.

Define Details

TYPEINFO

Declares typeinfo for some type.

Example:

TYPEINFO(/atom)
	var/monkeys_hate = FALSE

TYPEINFO(/obj/item/clothing/glasses/blindfold)
	monkeys_hate = TRUE

Treat this as if you were defining a type. You can add vars and procs, override vars and procs etc. There might be minor issues if you define TYPEINFO of one type multiple times. Consider using /typeinfo/THE_TYPE for subsequent additions to the object's typeinfo if you know it has already been declared once using TYPEINFO.

for_by_tcl

Performs a typecheckless for loop with var/iterator over by_type[_type]