-
Notifications
You must be signed in to change notification settings - Fork 516
Global Listeners
Global Listeners are a simple way to maintain global lists of datums grouped by a global ID string. They replace the old Wireless system; new code should use listeners instead of wireless.
To add a datum to a global listener ID, the target object must create a /listener
instance. The object will remain in the list until the listener is qdeleted - delete the listener object to remove the datum from the list. All listener instances associated with an object must be deleted when that object is deleted, or else they may block it from GCing.
Basic Usage:
/obj/mything
var/listener/listener
/obj/mything/Initialize()
. = ..()
listener = new(src, "mythings")
/obj/mything/Destroy()
QDEL_NULL(listener)
return ..()
To iterate through all objects belonging to a specific ID, use /proc/get_listeners_by_type(id, type)
. ID must be a string, and type must be /datum
or a datum subtype.
Iteration Example:
for (var/thing in get_listeners_by_type("mythings", /obj/mything)
var/obj/mything/object = thing
object.do_the_thing()
List Ref Example:
var/list/mythings = get_listeners_by_type("mythings", /obj/mything)
This list is safe to mutate or reuse elsewhere.
A collection of standards and guidelines applied to the codebase.
Documentation regarding common APIs which speed up feature implementation and should be known by all coders.
- Atom Initialization
- Garbage, Queued Deletion, and Destroy
- Callbacks
- Timers
- Lazy Lists
- Overlays
- Processing APIs
- Common Helpers
- Global Listeners
- Singletons
Documentation for less used APIs that are not often needed.
Documentation regarding our implementation of StonedMC (SMC).
Decrepit or unused systems.
- Dynamic Maps (Not to be confused with the newer away mission implementation.)