mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-07-09 23:31:14 +01:00
The 515 MegaPR early downport (#7783)
Co-authored-by: Selis <selis@xynolabs.com> Co-authored-by: Selis <sirlionfur@hotmail.de> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com> Co-authored-by: SatinIsle <thesatinisle@gmail.com> Co-authored-by: Heroman <alesha3000@list.ru> Co-authored-by: Casey <a.roaming.shadow@gmail.com> Co-authored-by: Raeschen <rycoop29@gmail.com>
This commit is contained in:
@@ -142,14 +142,14 @@ var/list/runechat_image_cache = list()
|
||||
|
||||
// Append prefixes
|
||||
if(extra_classes.Find("virtual-speaker"))
|
||||
LAZYADD(prefixes, "\icon[runechat_image_cache["radio"]]")
|
||||
LAZYADD(prefixes, "[icon2html(runechat_image_cache["radio"],owner.client)]")
|
||||
if(extra_classes.Find("emote"))
|
||||
// Icon on both ends?
|
||||
//var/image/I = runechat_image_cache["emote"]
|
||||
//text = "\icon[I][text]\icon[I]"
|
||||
//text = "icon2html(I)[text]icon2html(I)"
|
||||
|
||||
// Icon on one end?
|
||||
//LAZYADD(prefixes, "\icon[runechat_image_cache["emote"]]")
|
||||
//LAZYADD(prefixes, "icon2html(runechat_image_cache["emote")]")
|
||||
|
||||
// Asterisks instead?
|
||||
text = "* [text] *"
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
/****************
|
||||
* Debug Support *
|
||||
****************/
|
||||
|
||||
/datum/all_observable_events
|
||||
var/list/events
|
||||
|
||||
/datum/all_observable_events/New()
|
||||
events = list()
|
||||
..()
|
||||
@@ -1 +0,0 @@
|
||||
#define CANCEL_MOVE_EVENT -55
|
||||
@@ -5,11 +5,12 @@
|
||||
//
|
||||
// Arguments that the called proc should expect:
|
||||
// /datum/destroyed_instance: The instance that was destroyed.
|
||||
|
||||
/*
|
||||
/decl/observ/destroyed
|
||||
name = "Destroyed"
|
||||
*/
|
||||
//Deprecated in favor of Comsigs
|
||||
|
||||
/datum/Destroy()
|
||||
if(GLOB.destroyed_event)
|
||||
GLOB.destroyed_event.raise_event(src)
|
||||
SEND_SIGNAL(src,COMSIG_OBSERVER_DESTROYED)
|
||||
. = ..()
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// 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, /decl/observ/dir_set, new)
|
||||
|
||||
/decl/observ/dir_set
|
||||
name = "Direction Set"
|
||||
expected_type = /atom
|
||||
|
||||
/decl/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, /atom/proc/recursive_dir_set)
|
||||
|
||||
/*********************
|
||||
* Direction Handling *
|
||||
*********************/
|
||||
|
||||
/atom/movable/Entered(var/atom/movable/am, atom/old_loc)
|
||||
. = ..()
|
||||
if(. != CANCEL_MOVE_EVENT && GLOB.dir_set_event.has_listeners(am))
|
||||
GLOB.dir_set_event.register(src, am, /atom/proc/recursive_dir_set)
|
||||
|
||||
/atom/movable/Exited(var/atom/movable/am, atom/old_loc)
|
||||
. = ..()
|
||||
GLOB.dir_set_event.unregister(src, am, /atom/proc/recursive_dir_set)
|
||||
@@ -7,6 +7,7 @@
|
||||
// /mob/equipper: The mob that equipped the item.
|
||||
// /obj/item/item: The equipped item.
|
||||
// slot: The slot equipped to.
|
||||
/*
|
||||
GLOBAL_DATUM_INIT(mob_equipped_event, /decl/observ/mob_equipped, new)
|
||||
|
||||
/decl/observ/mob_equipped
|
||||
@@ -27,12 +28,13 @@ GLOBAL_DATUM_INIT(item_equipped_event, /decl/observ/item_equipped, new)
|
||||
/decl/observ/item_equipped
|
||||
name = "Item Equipped"
|
||||
expected_type = /obj/item
|
||||
|
||||
*/
|
||||
//Deprecated in favor of comsigs
|
||||
/********************
|
||||
* Equipped Handling *
|
||||
********************/
|
||||
|
||||
/obj/item/equipped(var/mob/user, var/slot)
|
||||
. = ..()
|
||||
GLOB.mob_equipped_event.raise_event(user, src, slot)
|
||||
GLOB.item_equipped_event.raise_event(src, user, slot)
|
||||
SEND_SIGNAL(user, COMSIG_OBSERVER_MOB_EQUIPPED, src, slot)
|
||||
SEND_SIGNAL(src, COMSIG_OBSERVER_ITEM_EQUIPPED, user, slot)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/atom/movable/proc/recursive_move(var/atom/movable/am, var/old_loc, var/new_loc)
|
||||
GLOB.moved_event.raise_event(src, old_loc, new_loc)
|
||||
SEND_SIGNAL(src,COMSIG_OBSERVER_MOVED, old_loc, new_loc)
|
||||
|
||||
/atom/movable/proc/move_to_destination(var/atom/movable/am, var/old_loc, var/new_loc)
|
||||
var/turf/T = get_turf(new_loc)
|
||||
@@ -12,10 +12,10 @@
|
||||
/datum/proc/qdel_self()
|
||||
qdel(src)
|
||||
|
||||
/proc/register_all_movement(var/event_source, var/listener)
|
||||
GLOB.moved_event.register(event_source, listener, /atom/movable/proc/recursive_move)
|
||||
GLOB.dir_set_event.register(event_source, listener, /atom/proc/recursive_dir_set)
|
||||
/proc/register_all_movement(var/event_source, var/datum/listener)
|
||||
listener.RegisterSignal(event_source,COMSIG_OBSERVER_MOVED, /atom/movable/proc/recursive_move)
|
||||
//GLOB.dir_set_event.register(event_source, listener, /atom/proc/recursive_dir_set)
|
||||
|
||||
/proc/unregister_all_movement(var/event_source, var/listener)
|
||||
GLOB.moved_event.unregister(event_source, listener, /atom/movable/proc/recursive_move)
|
||||
GLOB.dir_set_event.unregister(event_source, listener, /atom/proc/recursive_dir_set)
|
||||
/proc/unregister_all_movement(var/event_source, var/datum/listener)
|
||||
listener.UnregisterSignal(event_source,COMSIG_OBSERVER_MOVED)
|
||||
//GLOB.dir_set_event.unregister(event_source, listener, /atom/proc/recursive_dir_set)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
// Observer Pattern Implementation: Logged in
|
||||
// Registration type: /mob
|
||||
//
|
||||
// Raised when: A mob logs in (not client)
|
||||
//
|
||||
// Arguments that the called proc should expect:
|
||||
// /mob/joiner: The mob that has logged in
|
||||
|
||||
GLOBAL_DATUM_INIT(logged_in_event, /decl/observ/logged_in, new)
|
||||
|
||||
/decl/observ/logged_in
|
||||
name = "Logged In"
|
||||
expected_type = /mob
|
||||
|
||||
/*****************
|
||||
* Login Handling *
|
||||
*****************/
|
||||
|
||||
/mob/Login()
|
||||
..()
|
||||
GLOB.logged_in_event.raise_event(src)
|
||||
@@ -8,9 +8,10 @@
|
||||
// /atom/old_loc: The loc before the move.
|
||||
// /atom/new_loc: The loc after the move.
|
||||
|
||||
|
||||
/*
|
||||
GLOBAL_DATUM_INIT(moved_event, /decl/observ/moved, new)
|
||||
|
||||
|
||||
/decl/observ/moved
|
||||
name = "Moved"
|
||||
expected_type = /atom/movable
|
||||
@@ -21,28 +22,29 @@ GLOBAL_DATUM_INIT(moved_event, /decl/observ/moved, new)
|
||||
// Listen to the parent if possible.
|
||||
if(. && istype(mover.loc, expected_type))
|
||||
register(mover.loc, mover, /atom/movable/proc/recursive_move)
|
||||
*/
|
||||
//Deprecated in favor of comsigs
|
||||
|
||||
/********************
|
||||
* Movement Handling *
|
||||
********************/
|
||||
/atom/movable/Entered(var/atom/movable/am, atom/old_loc)
|
||||
. = ..()
|
||||
if(GLOB.moved_event.has_listeners(am))
|
||||
GLOB.moved_event.register(src, am, /atom/movable/proc/recursive_move)
|
||||
am.RegisterSignal(src,COMSIG_OBSERVER_MOVED, /atom/movable/proc/recursive_move, override = TRUE)
|
||||
|
||||
/atom/movable/Exited(var/atom/movable/am, atom/old_loc)
|
||||
. = ..()
|
||||
GLOB.moved_event.unregister(src, am, /atom/movable/proc/recursive_move)
|
||||
am.UnregisterSignal(src,COMSIG_OBSERVER_MOVED)
|
||||
|
||||
// Entered() typically lifts the moved event, but in the case of null-space we'll have to handle it.
|
||||
/atom/movable/Move()
|
||||
var/old_loc = loc
|
||||
. = ..()
|
||||
if(. && !loc)
|
||||
GLOB.moved_event.raise_event(src, old_loc, null)
|
||||
SEND_SIGNAL(src,COMSIG_OBSERVER_MOVED, old_loc, null)
|
||||
|
||||
/atom/movable/forceMove(atom/destination)
|
||||
var/old_loc = loc
|
||||
. = ..()
|
||||
if(. && !loc)
|
||||
GLOB.moved_event.raise_event(src, old_loc, null)
|
||||
SEND_SIGNAL(src,COMSIG_OBSERVER_MOVED, old_loc, null)
|
||||
|
||||
@@ -1,238 +0,0 @@
|
||||
//
|
||||
// Observer Pattern Implementation
|
||||
//
|
||||
// Implements a basic observer pattern with the following main procs:
|
||||
//
|
||||
// /decl/observ/proc/is_listening(var/event_source, var/datum/listener, var/proc_call)
|
||||
// event_source: The instance which is generating events.
|
||||
// listener: The instance which may be listening to events by event_source
|
||||
// proc_call: Optional. The specific proc to call when the event is raised.
|
||||
//
|
||||
// Returns true if listener is listening for events by event_source, and proc_call supplied is either null or one of the proc that will be called when an event is raised.
|
||||
//
|
||||
// /decl/observ/proc/has_listeners(var/event_source)
|
||||
// event_source: The instance which is generating events.
|
||||
//
|
||||
// Returns true if the given event_source has any listeners at all, globally or to specific event sources.
|
||||
//
|
||||
// /decl/observ/proc/register(var/event_source, var/datum/listener, var/proc_call)
|
||||
// event_source: The instance you wish to receive events from.
|
||||
// listener: The instance/owner of the proc to call when an event is raised by the event_source.
|
||||
// proc_call: The proc to call when an event is raised.
|
||||
//
|
||||
// It is possible to register the same listener to the same event_source multiple times as long as it is using different proc_calls.
|
||||
// Registering again using the same event_source, listener, and proc_call that has been registered previously will have no additional effect.
|
||||
// I.e.: The proc_call will still only be called once per raised event. That particular proc_call will only have to be unregistered once.
|
||||
//
|
||||
// When proc_call is called the first argument is always the source of the event (event_source).
|
||||
// Additional arguments may or may not be supplied, see individual event definition files (destroyed.dm, moved.dm, etc.) for details.
|
||||
//
|
||||
// The instance making the register() call is also responsible for calling unregister(), see below for additonal details, including when event_source is destroyed.
|
||||
// This can be handled by listening to the event_source's destroyed event, unregistering in the listener's Destroy() proc, etc.
|
||||
//
|
||||
// /decl/observ/proc/unregister(var/event_source, var/datum/listener, var/proc_call)
|
||||
// event_source: The instance you wish to stop receiving events from.
|
||||
// listener: The instance which will no longer receive the events.
|
||||
// proc_call: Optional: The proc_call to unregister.
|
||||
//
|
||||
// Unregisters the listener from the event_source.
|
||||
// If a proc_call has been supplied only that particular proc_call will be unregistered. If the proc_call isn't currently registered there will be no effect.
|
||||
// If no proc_call has been supplied, the listener will have all registrations made to the given event_source undone.
|
||||
//
|
||||
// /decl/observ/proc/register_global(var/datum/listener, var/proc_call)
|
||||
// listener: The instance/owner of the proc to call when an event is raised by any and all sources.
|
||||
// proc_call: The proc to call when an event is raised.
|
||||
//
|
||||
// Works very much the same as register(), only the listener/proc_call will receive all relevant events from all event sources.
|
||||
// Global registrations can overlap with registrations made to specific event sources and these will not affect each other.
|
||||
//
|
||||
// /decl/observ/proc/unregister_global(var/datum/listener, var/proc_call)
|
||||
// listener: The instance/owner of the proc which will no longer receive the events.
|
||||
// proc_call: Optional: The proc_call to unregister.
|
||||
//
|
||||
// Works very much the same as unregister(), only it undoes global registrations instead.
|
||||
//
|
||||
// /decl/observ/proc/raise_event(src, ...)
|
||||
// Should never be called unless implementing a new event type.
|
||||
// The first argument shall always be the event_source belonging to the event. Beyond that there are no restrictions.
|
||||
|
||||
/decl/observ
|
||||
var/name = "Unnamed Event" // The name of this event, used mainly for debug/VV purposes. The list of event managers can be reached through the "Debug Controller" verb, selecting the "Observation" entry.
|
||||
var/expected_type = /datum // The expected event source for this event. register() will CRASH() if it receives an unexpected type.
|
||||
var/list/event_sources = list() // Associative list of event sources, each with their own associative list. This associative list contains an instance/list of procs to call when the event is raised.
|
||||
var/list/global_listeners = list() // Associative list of instances that listen to all events of this type (as opposed to events belonging to a specific source) and the proc to call.
|
||||
|
||||
/decl/observ/New()
|
||||
GLOB.all_observable_events.events += src
|
||||
. = ..()
|
||||
|
||||
/decl/observ/proc/is_listening(var/event_source, var/datum/listener, var/proc_call)
|
||||
// Return whether there are global listeners unless the event source is given.
|
||||
if (!event_source)
|
||||
return !!global_listeners.len
|
||||
|
||||
// Return whether anything is listening to a source, if no listener is given.
|
||||
if (!listener)
|
||||
return global_listeners.len || (event_source in event_sources)
|
||||
|
||||
// Return false if nothing is associated with that source.
|
||||
if (!(event_source in event_sources))
|
||||
return FALSE
|
||||
|
||||
// Get and check the listeners for the reuqested event.
|
||||
var/listeners = event_sources[event_source]
|
||||
if (!(listener in listeners))
|
||||
return FALSE
|
||||
|
||||
// Return true unless a specific callback needs checked.
|
||||
if (!proc_call)
|
||||
return TRUE
|
||||
|
||||
// Check if the specific callback exists.
|
||||
var/list/callback = listeners[listener]
|
||||
if (!callback)
|
||||
return FALSE
|
||||
|
||||
return (proc_call in callback)
|
||||
|
||||
/decl/observ/proc/has_listeners(var/event_source)
|
||||
return is_listening(event_source)
|
||||
|
||||
/decl/observ/proc/register(var/datum/event_source, var/datum/listener, var/proc_call)
|
||||
// Sanity checking.
|
||||
if (!(event_source && listener && proc_call))
|
||||
return FALSE
|
||||
if (istype(event_source, /decl/observ))
|
||||
return FALSE
|
||||
|
||||
// Crash if the event source is the wrong type.
|
||||
if (!istype(event_source, expected_type))
|
||||
CRASH("Unexpected type. Expected [expected_type], was [event_source.type]")
|
||||
|
||||
// Setup the listeners for this source if needed.
|
||||
var/list/listeners = event_sources[event_source]
|
||||
if (!listeners)
|
||||
listeners = list()
|
||||
event_sources[event_source] = listeners
|
||||
|
||||
// Make sure the callbacks are a list.
|
||||
var/list/callbacks = listeners[listener]
|
||||
if (!callbacks)
|
||||
callbacks = list()
|
||||
listeners[listener] = callbacks
|
||||
|
||||
// If the proc_call is already registered skip
|
||||
if(proc_call in callbacks)
|
||||
return FALSE
|
||||
|
||||
// Add the callback, and return true.
|
||||
callbacks += proc_call
|
||||
return TRUE
|
||||
|
||||
/decl/observ/proc/unregister(var/event_source, var/datum/listener, var/proc_call)
|
||||
// Sanity.
|
||||
if (!(event_source && listener && (event_source in event_sources)))
|
||||
return FALSE
|
||||
|
||||
// Return false if nothing is listening for this event.
|
||||
var/list/listeners = event_sources[event_source]
|
||||
if (!listeners)
|
||||
return FALSE
|
||||
|
||||
// Remove all callbacks if no specific one is given.
|
||||
if (!proc_call)
|
||||
if(listeners.Remove(listener))
|
||||
// Perform some cleanup and return true.
|
||||
if (!listeners.len)
|
||||
event_sources -= event_source
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
// See if the listener is registered.
|
||||
var/list/callbacks = listeners[listener]
|
||||
if (!callbacks)
|
||||
return FALSE
|
||||
|
||||
// See if the callback exists.
|
||||
if(!callbacks.Remove(proc_call))
|
||||
return FALSE
|
||||
|
||||
if (!callbacks.len)
|
||||
listeners -= listener
|
||||
if (!listeners.len)
|
||||
event_sources -= event_source
|
||||
return TRUE
|
||||
|
||||
/decl/observ/proc/register_global(var/datum/listener, var/proc_call)
|
||||
// Sanity.
|
||||
if (!(listener && proc_call))
|
||||
return FALSE
|
||||
|
||||
// Make sure the callbacks are setup.
|
||||
var/list/callbacks = global_listeners[listener]
|
||||
if (!callbacks)
|
||||
callbacks = list()
|
||||
global_listeners[listener] = callbacks
|
||||
|
||||
// Add the callback and return true.
|
||||
callbacks |= proc_call
|
||||
return TRUE
|
||||
|
||||
/decl/observ/proc/unregister_global(var/datum/listener, var/proc_call)
|
||||
// Return false unless the listener is set as a global listener.
|
||||
if (!(listener && (listener in global_listeners)))
|
||||
return FALSE
|
||||
|
||||
// Remove all callbacks if no specific one is given.
|
||||
if (!proc_call)
|
||||
global_listeners -= listener
|
||||
return TRUE
|
||||
|
||||
// See if the listener is registered.
|
||||
var/list/callbacks = global_listeners[listener]
|
||||
if (!callbacks)
|
||||
return FALSE
|
||||
|
||||
// See if the callback exists.
|
||||
if(!callbacks.Remove(proc_call))
|
||||
return FALSE
|
||||
|
||||
if (!callbacks.len)
|
||||
global_listeners -= listener
|
||||
return TRUE
|
||||
|
||||
/decl/observ/proc/raise_event()
|
||||
// Sanity
|
||||
if (!args.len)
|
||||
return FALSE
|
||||
|
||||
// Call the global listeners.
|
||||
for (var/datum/listener in global_listeners)
|
||||
var/list/callbacks = global_listeners[listener]
|
||||
for (var/proc_call in callbacks)
|
||||
|
||||
// If the callback crashes, record the error and remove it.
|
||||
try
|
||||
call(listener, proc_call)(arglist(args))
|
||||
catch (var/exception/e)
|
||||
error("[e.name] - [e.file] - [e.line]")
|
||||
error(e.desc)
|
||||
unregister_global(listener, proc_call)
|
||||
|
||||
// Call the listeners for this specific event source, if they exist.
|
||||
var/source = args[1]
|
||||
if (source in event_sources)
|
||||
var/list/listeners = event_sources[source]
|
||||
for (var/datum/listener in listeners)
|
||||
var/list/callbacks = listeners[listener]
|
||||
for (var/proc_call in callbacks)
|
||||
|
||||
// If the callback crashes, record the error and remove it.
|
||||
try
|
||||
call(listener, proc_call)(arglist(args))
|
||||
catch (var/exception/e)
|
||||
error("[e.name] - [e.file] - [e.line]")
|
||||
error(e.desc)
|
||||
unregister(source, listener, proc_call)
|
||||
|
||||
return TRUE
|
||||
@@ -5,7 +5,7 @@
|
||||
//
|
||||
// Arguments that the called proc should expect:
|
||||
// /area: The area experiencing the power change
|
||||
|
||||
/*
|
||||
GLOBAL_DATUM_INIT(apc_event, /decl/observ/area_power_change, new)
|
||||
|
||||
/decl/observ/area_power_change
|
||||
@@ -15,7 +15,9 @@ GLOBAL_DATUM_INIT(apc_event, /decl/observ/area_power_change, new)
|
||||
/********************
|
||||
* Movement Handling *
|
||||
********************/
|
||||
*/
|
||||
//Deprecated in favor of comsigs
|
||||
|
||||
/area/power_change()
|
||||
. = ..()
|
||||
GLOB.apc_event.raise_event(src)
|
||||
SEND_SIGNAL(src,COMSIG_OBSERVER_APC)
|
||||
|
||||
@@ -5,12 +5,14 @@
|
||||
//
|
||||
// Arguments that the called proc should expect:
|
||||
// /datum/shuttle/shuttle: the new shuttle
|
||||
|
||||
/*
|
||||
GLOBAL_DATUM_INIT(shuttle_added, /decl/observ/shuttle_added, new)
|
||||
|
||||
/decl/observ/shuttle_added
|
||||
name = "Shuttle Added"
|
||||
expected_type = /datum/shuttle
|
||||
*/
|
||||
//Deprecated in favor of comsigs
|
||||
|
||||
/*****************************
|
||||
* Shuttle Added Handling *
|
||||
@@ -19,4 +21,4 @@ GLOBAL_DATUM_INIT(shuttle_added, /decl/observ/shuttle_added, new)
|
||||
/datum/controller/subsystem/shuttles/initialize_shuttle()
|
||||
. = ..()
|
||||
if(.)
|
||||
GLOB.shuttle_added.raise_event(.)
|
||||
SEND_SIGNAL(SSshuttles,COMSIG_OBSERVER_SHUTTLE_ADDED,.)
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// Observer Pattern Implementation: Shuttle Moved
|
||||
// Registration type: /datum/shuttle/autodock
|
||||
//
|
||||
// Raised when: A shuttle has moved to a new landmark.
|
||||
//
|
||||
// Arguments that the called proc should expect:
|
||||
// /datum/shuttle/shuttle: the shuttle moving
|
||||
// /obj/effect/shuttle_landmark/old_location: the old location's shuttle landmark
|
||||
// /obj/effect/shuttle_landmark/new_location: the new location's shuttle landmark
|
||||
|
||||
// Observer Pattern Implementation: Shuttle Pre Move
|
||||
// Registration type: /datum/shuttle/autodock
|
||||
//
|
||||
// Raised when: A shuttle is about to move to a new landmark.
|
||||
//
|
||||
// Arguments that the called proc should expect:
|
||||
// /datum/shuttle/shuttle: the shuttle moving
|
||||
// /obj/effect/shuttle_landmark/old_location: the old location's shuttle landmark
|
||||
// /obj/effect/shuttle_landmark/new_location: the new location's shuttle landmark
|
||||
|
||||
GLOBAL_DATUM_INIT(shuttle_moved_event, /decl/observ/shuttle_moved, new)
|
||||
|
||||
/decl/observ/shuttle_moved
|
||||
name = "Shuttle Moved"
|
||||
expected_type = /datum/shuttle
|
||||
|
||||
GLOBAL_DATUM_INIT(shuttle_pre_move_event, /decl/observ/shuttle_pre_move, new)
|
||||
|
||||
/decl/observ/shuttle_pre_move
|
||||
name = "Shuttle Pre Move"
|
||||
expected_type = /datum/shuttle
|
||||
|
||||
/*****************
|
||||
* Shuttle Moved/Pre Move Handling *
|
||||
*****************/
|
||||
|
||||
// Located in modules/shuttle/shuttle.dm
|
||||
// Proc: /datum/shuttle/proc/attempt_move()
|
||||
@@ -7,12 +7,14 @@
|
||||
// /mob/living/stat_mob: The mob whose stat changed
|
||||
// /old_stat: Status before the change.
|
||||
// /new_stat: Status after the change.
|
||||
|
||||
GLOBAL_DATUM_INIT(stat_set_event, /decl/observ/stat_set, new)
|
||||
/*
|
||||
stat_set_event, /decl/observ/stat_set, new)
|
||||
|
||||
/decl/observ/stat_set
|
||||
name = "Stat Set"
|
||||
expected_type = /mob/living
|
||||
*/
|
||||
//Deprecated in favor of Comsigs
|
||||
|
||||
/****************
|
||||
* Stat Handling *
|
||||
@@ -21,7 +23,7 @@ GLOBAL_DATUM_INIT(stat_set_event, /decl/observ/stat_set, new)
|
||||
var/old_stat = stat
|
||||
. = ..()
|
||||
if(stat != old_stat)
|
||||
GLOB.stat_set_event.raise_event(src, old_stat, new_stat)
|
||||
SEND_SIGNAL(src, COMSIG_MOB_STATCHANGE, old_stat, new_stat)
|
||||
|
||||
if(isbelly(src.loc))
|
||||
var/obj/belly/ourbelly = src.loc
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// Observer Pattern Implementation: Turf Changed
|
||||
// Registration type: /turf
|
||||
//
|
||||
// Raised when: A turf has been changed using the ChangeTurf proc.
|
||||
//
|
||||
// Arguments that the called proc should expect:
|
||||
// /turf/affected: The turf that has changed
|
||||
// /old_density: Density before the change
|
||||
// /new_density: Density after the change
|
||||
// /old_opacity: Opacity before the change
|
||||
// /new_opacity: Opacity after the change
|
||||
|
||||
var/decl/observ/turf_changed/turf_changed_event = new()
|
||||
|
||||
/decl/observ/turf_changed
|
||||
name = "Turf Changed"
|
||||
expected_type = /turf
|
||||
|
||||
/************************
|
||||
* Turf Changed Handling *
|
||||
************************/
|
||||
|
||||
/turf/ChangeTurf(var/turf/N, var/tell_universe, var/force_lighting_update, var/preserve_outdoors)
|
||||
var/old_density = density
|
||||
var/old_opacity = opacity
|
||||
. = ..(N, tell_universe, force_lighting_update, preserve_outdoors)
|
||||
if(.)
|
||||
turf_changed_event.raise_event(src, old_density, density, old_opacity, opacity)
|
||||
@@ -8,7 +8,7 @@
|
||||
// /atom/movable/moving_instance: The instance that entered/exited
|
||||
// /atom/old_loc / /atom/new_loc: The previous/new loc of the mover
|
||||
|
||||
|
||||
/*
|
||||
GLOBAL_DATUM_INIT(turf_entered_event, /decl/observ/turf_entered, new)
|
||||
GLOBAL_DATUM_INIT(turf_exited_event, /decl/observ/turf_exited, new)
|
||||
|
||||
@@ -20,14 +20,18 @@ GLOBAL_DATUM_INIT(turf_exited_event, /decl/observ/turf_exited, new)
|
||||
name = "Turf Exited"
|
||||
expected_type = /turf
|
||||
|
||||
*/
|
||||
//Deprecated in favor of Comsigs
|
||||
|
||||
/********************
|
||||
* Movement Handling *
|
||||
********************/
|
||||
|
||||
|
||||
/turf/Entered(var/atom/movable/am, var/atom/old_loc)
|
||||
. = ..()
|
||||
GLOB.turf_entered_event.raise_event(src, am, old_loc)
|
||||
SEND_SIGNAL(src, COMSIG_OBSERVER_TURF_ENTERED, am, old_loc)
|
||||
|
||||
/turf/Exited(var/atom/movable/am, var/atom/new_loc)
|
||||
. = ..()
|
||||
GLOB.turf_exited_event.raise_event(src, am, new_loc)
|
||||
SEND_SIGNAL(src, COMSIG_OBSERVER_TURF_EXITED, am, new_loc)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// Arguments that the called proc should expect:
|
||||
// /mob/equipped: The mob that unequipped/dropped the item.
|
||||
// /obj/item/item: The unequipped item.
|
||||
|
||||
/*
|
||||
GLOBAL_DATUM_INIT(mob_unequipped_event, /decl/observ/mob_unequipped, new)
|
||||
|
||||
/decl/observ/mob_unequipped
|
||||
@@ -27,6 +27,8 @@ GLOBAL_DATUM_INIT(item_unequipped_event, /decl/observ/item_unequipped, new)
|
||||
/decl/observ/item_unequipped
|
||||
name = "Item Unequipped"
|
||||
expected_type = /obj/item
|
||||
*/
|
||||
//Deprecated in favor of comsigs
|
||||
|
||||
/**********************
|
||||
* Unequipped Handling *
|
||||
@@ -34,5 +36,10 @@ GLOBAL_DATUM_INIT(item_unequipped_event, /decl/observ/item_unequipped, new)
|
||||
|
||||
/obj/item/dropped(var/mob/user)
|
||||
..()
|
||||
GLOB.mob_unequipped_event.raise_event(user, src)
|
||||
GLOB.item_unequipped_event.raise_event(src, user)
|
||||
//SEND_SIGNAL(user, COMSIG_OBSERVER_MOB_UNEQUIPPED, src)
|
||||
//SEND_SIGNAL(src, COMSIG_OBSERVER_ITEM_UNEQUIPPED, user)
|
||||
if(user) // Cannot always guarantee that user won't be null
|
||||
SEND_SIGNAL(user, COMSIG_OBSERVER_MOB_UNEQUIPPED, src)
|
||||
SEND_SIGNAL(src, COMSIG_OBSERVER_ITEM_UNEQUIPPED, user)
|
||||
else
|
||||
SEND_SIGNAL(src, COMSIG_OBSERVER_ITEM_UNEQUIPPED)
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Observer Pattern Implementation: Z_Moved
|
||||
// Registration type: /atom/movable
|
||||
//
|
||||
// Raised when: An /atom/movable instance has changed z-levels by any means.
|
||||
//
|
||||
// Arguments that the called proc should expect:
|
||||
// /atom/movable/moving_instance: The instance that moved
|
||||
// old_z: The z number before the move.
|
||||
// new_z: The z number after the move.
|
||||
|
||||
|
||||
GLOBAL_DATUM_INIT(z_moved_event, /decl/observ/z_moved, new)
|
||||
|
||||
/decl/observ/z_moved
|
||||
name = "Z_Moved"
|
||||
expected_type = /atom/movable
|
||||
@@ -1,67 +0,0 @@
|
||||
GLOBAL_LIST_EMPTY(global_listen_count)
|
||||
GLOBAL_LIST_EMPTY(event_sources_count)
|
||||
GLOBAL_LIST_EMPTY(event_listen_count)
|
||||
|
||||
/decl/observ/destroyed/raise_event()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
var/source = args[1]
|
||||
|
||||
if(GLOB.global_listen_count[source])
|
||||
cleanup_global_listener(source, GLOB.global_listen_count[source])
|
||||
if(GLOB.event_sources_count[source])
|
||||
cleanup_source_listeners(source, GLOB.event_sources_count[source])
|
||||
if(GLOB.event_listen_count[source])
|
||||
cleanup_event_listener(source, GLOB.event_listen_count[source])
|
||||
|
||||
|
||||
/decl/observ/register(var/datum/event_source, var/datum/listener, var/proc_call)
|
||||
. = ..()
|
||||
if(.)
|
||||
GLOB.event_sources_count[event_source] += 1
|
||||
GLOB.event_listen_count[listener] += 1
|
||||
|
||||
/decl/observ/unregister(var/datum/event_source, var/datum/listener, var/proc_call)
|
||||
. = ..()
|
||||
if(.)
|
||||
GLOB.event_sources_count[event_source] -= 1
|
||||
GLOB.event_listen_count[listener] -= 1
|
||||
|
||||
/decl/observ/register_global(var/datum/listener, var/proc_call)
|
||||
. = ..()
|
||||
if(.)
|
||||
GLOB.global_listen_count[listener] += 1
|
||||
|
||||
/decl/observ/unregister_global(var/datum/listener, var/proc_call)
|
||||
. = ..()
|
||||
if(.)
|
||||
GLOB.global_listen_count[listener] -= 1
|
||||
|
||||
/decl/observ/destroyed/proc/cleanup_global_listener(listener, listen_count)
|
||||
GLOB.global_listen_count -= listener
|
||||
for(var/decl/observ/event as anything in GLOB.all_observable_events.events)
|
||||
if(event.unregister_global(listener))
|
||||
// log_debug("[event] - [listener] was deleted while still registered to global events.") // TODO: Apply axe, reimplement with datum component listeners
|
||||
if(!(--listen_count))
|
||||
return
|
||||
|
||||
/decl/observ/destroyed/proc/cleanup_source_listeners(event_source, source_listener_count)
|
||||
GLOB.event_sources_count -= event_source
|
||||
for(var/decl/observ/event as anything in GLOB.all_observable_events.events)
|
||||
var/proc_owners = event.event_sources[event_source]
|
||||
if(proc_owners)
|
||||
for(var/proc_owner in proc_owners)
|
||||
if(event.unregister(event_source, proc_owner))
|
||||
// log_debug("[event] - [event_source] was deleted while still being listened to by [proc_owner].") // TODO: Apply axe, reimplement with datum component listeners
|
||||
if(!(--source_listener_count))
|
||||
return
|
||||
|
||||
/decl/observ/destroyed/proc/cleanup_event_listener(listener, listener_count)
|
||||
GLOB.event_listen_count -= listener
|
||||
for(var/decl/observ/event as anything in GLOB.all_observable_events.events)
|
||||
for(var/event_source in event.event_sources)
|
||||
if(event.unregister(event_source, listener))
|
||||
// log_debug("[event] - [listener] was deleted while still listening to [event_source].") // TODO: Apply axe, reimplement with datum component listeners
|
||||
if(!(--listener_count))
|
||||
return
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
/atom/movable/proc/stop_orbit()
|
||||
SpinAnimation(0,0)
|
||||
qdel(orbiting)
|
||||
QDEL_NULL(orbiting)
|
||||
|
||||
/atom/Destroy(force = FALSE)
|
||||
. = ..()
|
||||
|
||||
@@ -91,4 +91,4 @@
|
||||
var/obj/structure/largecrate/C = /obj/structure/largecrate
|
||||
icon = image(initial(C.icon), initial(C.icon_state))
|
||||
|
||||
return "\icon[icon][bicon(icon)]"
|
||||
return "[bicon(icon)]"
|
||||
|
||||
@@ -130,7 +130,7 @@ var/datum/uplink/uplink = new()
|
||||
|
||||
/datum/uplink_item/item/log_icon()
|
||||
var/obj/I = path
|
||||
return "\icon[I][bicon(I)]"
|
||||
return "[bicon(I)]"
|
||||
|
||||
/********************************
|
||||
* *
|
||||
@@ -144,7 +144,7 @@ var/datum/uplink/uplink = new()
|
||||
if(!default_abstract_uplink_icon)
|
||||
default_abstract_uplink_icon = image('icons/obj/pda.dmi', "pda-syn")
|
||||
|
||||
return "\icon[default_abstract_uplink_icon][bicon(default_abstract_uplink_icon)]"
|
||||
return "[bicon(default_abstract_uplink_icon)]"
|
||||
|
||||
/*
|
||||
* Crated goods.
|
||||
@@ -174,7 +174,7 @@ var/datum/uplink/uplink = new()
|
||||
|
||||
/datum/uplink_item/crated/log_icon()
|
||||
var/obj/I = crate_path
|
||||
return "\icon[I]"
|
||||
return "[bicon(I)]"
|
||||
|
||||
/****************
|
||||
* Support procs *
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
C.light_disabled = !C.light_disabled
|
||||
|
||||
if(WIRE_CAM_ALARM)
|
||||
C.visible_message("\icon[C][bicon(C)] *beep*", "\icon[C][bicon(C)] *beep*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *beep*", "[icon2html(C,viewers(holder))] *beep*")
|
||||
..()
|
||||
|
||||
/datum/wires/camera/proc/CanDeconstruct()
|
||||
|
||||
@@ -31,16 +31,16 @@
|
||||
var/obj/machinery/media/jukebox/A = holder
|
||||
switch(wire)
|
||||
if(WIRE_MAIN_POWER1)
|
||||
holder.visible_message("<span class='notice'>\icon[holder][bicon(holder)] The power light flickers.</span>")
|
||||
holder.visible_message("<span class='notice'>[icon2html(A,viewers(holder))] The power light flickers.</span>")
|
||||
A.shock(usr, 90)
|
||||
if(WIRE_JUKEBOX_HACK)
|
||||
holder.visible_message("<span class='notice'>\icon[holder][bicon(holder)] The parental guidance light flickers.</span>")
|
||||
holder.visible_message("<span class='notice'>[icon2html(A,viewers(holder))] The parental guidance light flickers.</span>")
|
||||
if(WIRE_REVERSE)
|
||||
holder.visible_message("<span class='notice'>\icon[holder][bicon(holder)] The data light blinks ominously.</span>")
|
||||
holder.visible_message("<span class='notice'>[icon2html(A,viewers(holder))] The data light blinks ominously.</span>")
|
||||
if(WIRE_SPEEDUP)
|
||||
holder.visible_message("<span class='notice'>\icon[holder][bicon(holder)] The speakers squeaks.</span>")
|
||||
holder.visible_message("<span class='notice'>[icon2html(A,viewers(holder))] The speakers squeaks.</span>")
|
||||
if(WIRE_SPEEDDOWN)
|
||||
holder.visible_message("<span class='notice'>\icon[holder][bicon(holder)] The speakers rumble.</span>")
|
||||
holder.visible_message("<span class='notice'>[icon2html(A,viewers(holder))] The speakers rumble.</span>")
|
||||
if(WIRE_START)
|
||||
A.StartPlaying()
|
||||
if(WIRE_STOP)
|
||||
|
||||
+11
-11
@@ -21,15 +21,15 @@
|
||||
|
||||
switch(wire)
|
||||
if(WIRE_EXPLODE)
|
||||
C.visible_message("\icon[C][bicon(C)] *BEEE-*", "\icon[C][bicon(C)] *BEEE-*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *BEEE-*", "[icon2html(C,viewers(holder))] *BEEE-*")
|
||||
C.explode()
|
||||
|
||||
if(WIRE_EXPLODE_DELAY)
|
||||
C.visible_message("\icon[C][bicon(C)] *BEEE-*", "\icon[C][bicon(C)] *BEEE-*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *BEEE-*", "[icon2html(C,viewers(holder))] *BEEE-*")
|
||||
C.explode()
|
||||
|
||||
if(WIRE_DISARM)
|
||||
C.visible_message("\icon[C][bicon(C)] *click!*", "\icon[C][bicon(C)] *click!*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *click!*", "[icon2html(C,viewers(holder))] *click!*")
|
||||
var/obj/effect/mine/MI = new C.mineitemtype(get_turf(C))
|
||||
|
||||
if(C.trap)
|
||||
@@ -41,15 +41,15 @@
|
||||
qdel(C)
|
||||
|
||||
if(WIRE_BADDISARM)
|
||||
C.visible_message("\icon[C][bicon(C)] *BEEPBEEPBEEP*", "\icon[C][bicon(C)] *BEEPBEEPBEEP*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *BEEPBEEPBEEP*", "[icon2html(C,viewers(holder))] *BEEPBEEPBEEP*")
|
||||
spawn(20)
|
||||
C.explode()
|
||||
|
||||
if(WIRE_TRAP)
|
||||
C.visible_message("\icon[C][bicon(C)] *click!*", "\icon[C][bicon(C)] *click!*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *click!*", "[icon2html(C,viewers(holder))] *click!*")
|
||||
|
||||
if(mend)
|
||||
C.visible_message("\icon[C][bicon(C)] - The mine recalibrates[C.camo_net ? ", revealing \the [C.trap] inside." : "."]")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] - The mine recalibrates[C.camo_net ? ", revealing \the [C.trap] inside." : "."]")
|
||||
|
||||
C.alpha = 255
|
||||
|
||||
@@ -61,21 +61,21 @@
|
||||
return
|
||||
switch(wire)
|
||||
if(WIRE_EXPLODE)
|
||||
C.visible_message("\icon[C][bicon(C)] *beep*", "\icon[C][bicon(C)] *beep*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *beep*", "[icon2html(C,viewers(holder))] *beep*")
|
||||
|
||||
if(WIRE_EXPLODE_DELAY)
|
||||
C.visible_message("\icon[C][bicon(C)] *BEEPBEEPBEEP*", "\icon[C][bicon(C)] *BEEPBEEPBEEP*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *BEEPBEEPBEEP*", "[icon2html(C,viewers(holder))] *BEEPBEEPBEEP*")
|
||||
spawn(20)
|
||||
C.explode()
|
||||
|
||||
if(WIRE_DISARM)
|
||||
C.visible_message("\icon[C][bicon(C)] *ping*", "\icon[C][bicon(C)] *ping*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *ping*", "[icon2html(C,viewers(holder))] *ping*")
|
||||
|
||||
if(WIRE_BADDISARM)
|
||||
C.visible_message("\icon[C][bicon(C)] *ping*", "\icon[C][bicon(C)] *ping*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *ping*", "[icon2html(C,viewers(holder))] *ping*")
|
||||
|
||||
if(WIRE_TRAP)
|
||||
C.visible_message("\icon[C][bicon(C)] *ping*", "\icon[C][bicon(C)] *ping*")
|
||||
C.visible_message("[icon2html(C,viewers(holder))] *ping*", "[icon2html(C,viewers(holder))] *ping*")
|
||||
|
||||
..()
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
C.interface_control = !C.interface_control
|
||||
|
||||
if(WIRE_PARTICLE_POWER_LIMIT)
|
||||
C.visible_message("\icon[C][bicon(C)]<b>[C]</b> makes a large whirring noise.")
|
||||
C.visible_message("[icon2html(C,viewers(holder))]<b>[C]</b> makes a large whirring noise.")
|
||||
|
||||
/datum/wires/particle_acc/control_box/on_cut(wire, mend)
|
||||
var/obj/machinery/particle_accelerator/control_box/C = holder
|
||||
|
||||
Reference in New Issue
Block a user