mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-14 03:12:30 +00:00
Unified most of the procs into one definition, so there are no duplicate around the codebase. Marked some of the above as overridable if a good enough case can be made for them (eg. external dependency or unlikely to be used).
23 lines
800 B
Plaintext
23 lines
800 B
Plaintext
// Observer Pattern Implementation: Direction Set
|
|
// Registration type: /atom
|
|
//
|
|
// Raised when: An /atom changes dir using the set_dir() proc.
|
|
//
|
|
// Arguments that the called proc should expect:
|
|
// /atom/dir_changer: The instance that changed direction
|
|
// /old_dir: The dir before the change.
|
|
// /new_dir: The dir after the change.
|
|
|
|
GLOBAL_DATUM_INIT(dir_set_event, /singleton/observ/dir_set, new)
|
|
|
|
/singleton/observ/dir_set
|
|
name = "Direction Set"
|
|
expected_type = /atom
|
|
|
|
/singleton/observ/dir_set/register(var/atom/dir_changer, var/datum/listener, var/proc_call)
|
|
. = ..()
|
|
|
|
// Listen to the parent if possible.
|
|
if(. && istype(dir_changer.loc, /atom/movable)) // We don't care about registering to turfs.
|
|
register(dir_changer.loc, dir_changer, TYPE_PROC_REF(/atom, recursive_dir_set))
|