Makes turfs persist their signals, uses this to optimize connect_loc (#59608)

* Makes turfs persist signals

* Splits connect_loc up into two elements, one for stuff that wishes to connect on behalf of something, and one for stuff that just wants to connect normally. Connecting on behalf of someone has a significant amount of overhead, so let's do this to keep things clear

* Converts all uses of connect_loc over to the new patterns

* Adds some comments, actually makes turfs persist signals

* There's no need to detach connect loc anymore, since all it does is unregister signals. Unregisters a signal from formorly decal'd turfs, and makes the changeturf signal persistance stuff actually work

* bro fuck documentation

* Changes from a var to a proc, prevents admemems and idiots

* Extra detail on why we do the copy post qdel
This commit is contained in:
LemonInTheDark
2021-06-22 20:12:34 -07:00
committed by GitHub
parent b5b4497b59
commit 6fcbce39cd
81 changed files with 182 additions and 146 deletions
+2 -2
View File
@@ -50,14 +50,14 @@ have ways of interacting with a specific mob and control it.
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, new_pawn, loc_connections)
AddElement(/datum/element/connect_loc_behalf, new_pawn, loc_connections)
movement_delay = living_pawn.cached_multiplicative_slowdown
return ..() //Run parent at end
/datum/ai_controller/monkey/UnpossessPawn(destroy)
UnregisterSignal(pawn, list(COMSIG_PARENT_ATTACKBY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_ATTACK_PAW, COMSIG_ATOM_BULLET_ACT, COMSIG_ATOM_HITBY, COMSIG_LIVING_START_PULL,\
COMSIG_LIVING_TRY_SYRINGE, COMSIG_ATOM_HULK_ATTACK, COMSIG_CARBON_CUFF_ATTEMPTED, COMSIG_MOB_MOVESPEED_UPDATED))
pawn.RemoveElement(/datum/element/connect_loc)
pawn.RemoveElement(/datum/element/connect_loc_behalf)
return ..() //Run parent at end
+1 -1
View File
@@ -146,7 +146,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, parent, loc_connections)
AddElement(/datum/element/connect_loc_behalf, parent, loc_connections)
/datum/component/butchering/recycler/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
+1 -1
View File
@@ -72,7 +72,7 @@ Behavior that's still missing from this component that original food items had t
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, parent, loc_connections)
AddElement(/datum/element/connect_loc_behalf, parent, loc_connections)
if(isitem(parent))
RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/UseFromHand)
+1 -1
View File
@@ -18,7 +18,7 @@
var/static/list/disease_connections = list(
COMSIG_ATOM_ENTERED = .proc/try_infect_crossed,
)
AddElement(/datum/element/connect_loc, parent, disease_connections)
AddElement(/datum/element/connect_loc_behalf, parent, disease_connections)
RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, .proc/clean)
RegisterSignal(parent, COMSIG_MOVABLE_BUCKLE, .proc/try_infect_buckle)
+1 -1
View File
@@ -335,7 +335,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_EXITED =.proc/grenade_uncrossed,
)
AddElement(/datum/element/connect_loc, parent, loc_connections)
AddElement(/datum/element/connect_loc_behalf, parent, loc_connections)
/// Someone dropped the grenade, so set them to the shooter in case they're on top of it when it goes off
/datum/component/pellet_cloud/proc/grenade_dropped(obj/item/nade, mob/living/slick_willy)
+2 -2
View File
@@ -37,7 +37,7 @@
RegisterSignal(parent, list(COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_ANIMAL, COMSIG_ATOM_ATTACK_HAND), .proc/rot_react_touch)
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/rot_hit_react)
if(ismovable(parent))
AddElement(/datum/element/connect_loc, parent, loc_connections)
AddElement(/datum/element/connect_loc_behalf, parent, loc_connections)
RegisterSignal(parent, COMSIG_MOVABLE_BUMP, .proc/rot_react)
if(isliving(parent))
RegisterSignal(parent, COMSIG_LIVING_REVIVE, .proc/react_to_revive) //mobs stop this when they come to life
@@ -60,7 +60,7 @@
/datum/component/rot/UnregisterFromParent()
. = ..()
if(ismovable(parent))
RemoveElement(/datum/element/connect_loc, parent, loc_connections)
RemoveElement(/datum/element/connect_loc_behalf, parent, loc_connections)
///One of two procs that modifies blockers, this one handles removing a blocker and potentially restarting the rot
/datum/component/rot/proc/start_up(blocker_type)
+1 -1
View File
@@ -85,7 +85,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, parent, loc_connections)
AddElement(/datum/element/connect_loc_behalf, parent, loc_connections)
RegisterSignal(parent, COMSIG_ATOM_BULLET_ACT, .proc/consume_bullets)
+5 -5
View File
@@ -33,7 +33,7 @@
if(slot_whitelist)
src.slot_whitelist = slot_whitelist
if(ismovable(parent))
AddElement(/datum/element/connect_loc, parent, default_connections)
AddElement(/datum/element/connect_loc_behalf, parent, default_connections)
if(isitem(parent))
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_equip)
@@ -69,7 +69,7 @@
if((!LAZYLEN(slot_whitelist) || (slot in slot_whitelist)) && isliving(equipper))
holder = equipper
AddElement(/datum/element/connect_loc, holder, holder_connections)
AddElement(/datum/element/connect_loc_behalf, holder, holder_connections)
RegisterSignal(holder, COMSIG_PARENT_PREQDELETED, .proc/holder_deleted)
/*
@@ -96,7 +96,7 @@
SIGNAL_HANDLER
UnregisterSignal(user, COMSIG_PARENT_PREQDELETED)
RemoveElement(/datum/element/connect_loc, holder, holder_connections)
RemoveElement(/datum/element/connect_loc_behalf, holder, holder_connections)
holder = null
/*
@@ -115,8 +115,8 @@
/datum/component/slippery/UnregisterFromParent()
. = ..()
if(holder)
RemoveElement(/datum/element/connect_loc, holder, holder_connections)
RemoveElement(/datum/element/connect_loc, parent, default_connections)
RemoveElement(/datum/element/connect_loc_behalf, holder, holder_connections)
RemoveElement(/datum/element/connect_loc_behalf, parent, default_connections)
/// Used for making the clown PDA only slip if the clown is wearing his shoes and the elusive banana-skin belt
/datum/component/slippery/clowning
+2 -2
View File
@@ -33,7 +33,7 @@
if(ismovable(parent))
RegisterSignal(parent, list(COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_IMPACT, COMSIG_PROJECTILE_BEFORE_FIRE), .proc/play_squeak)
AddElement(/datum/element/connect_loc, parent, item_connections)
AddElement(/datum/element/connect_loc_behalf, parent, item_connections)
RegisterSignal(parent, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react)
if(isitem(parent))
RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_HIT_REACT), .proc/play_squeak)
@@ -67,7 +67,7 @@
/datum/component/squeak/UnregisterFromParent()
. = ..()
RemoveElement(/datum/element/connect_loc, parent, item_connections)
RemoveElement(/datum/element/connect_loc_behalf, parent, item_connections)
/datum/component/squeak/proc/play_squeak()
SIGNAL_HANDLER
+1 -2
View File
@@ -14,8 +14,7 @@
offset_x = rand(-max_x, max_x)
offset_y = rand(-max_y, max_y)
AddElement(/datum/element/connect_loc, parent, swarming_loc_connections)
AddElement(/datum/element/connect_loc_behalf, parent, swarming_loc_connections)
/datum/component/swarming/Destroy()
for(var/other in swarm_members)
+8 -3
View File
@@ -117,6 +117,14 @@
qdel(C, FALSE, TRUE)
dc.Cut()
clear_signal_refs()
//END: ECS SHIT
return QDEL_HINT_QUEUE
///Only override this if you know what you're doing. You do not know what you're doing
///This is a threat
/datum/proc/clear_signal_refs()
var/list/lookup = comp_lookup
if(lookup)
for(var/sig in lookup)
@@ -132,9 +140,6 @@
for(var/target in signal_procs)
UnregisterSignal(target, signal_procs[target])
//END: ECS SHIT
return QDEL_HINT_QUEUE
#ifdef DATUMVAR_DEBUGGING_MODE
/datum/proc/save_vars()
+1 -1
View File
@@ -10,7 +10,7 @@
if(!isatom(target)) //How
return ELEMENT_INCOMPATIBLE
var/atom/to_track = target
to_track.AddElement(/datum/element/connect_loc, to_track, pass_on)
to_track.AddElement(/datum/element/connect_loc, pass_on)
RegisterSignal(to_track, COMSIG_MOVABLE_MOVED, .proc/react_to_move)
if(!mapload && isopenturf(to_track.loc))
+2 -2
View File
@@ -35,7 +35,7 @@
src.flags = flags
if(ismovable(target))
AddElement(/datum/element/connect_loc, target, crossed_connections)
AddElement(/datum/element/connect_loc_behalf, target, crossed_connections)
else
RegisterSignal(get_turf(target), COMSIG_ATOM_ENTERED, .proc/on_entered)
@@ -95,4 +95,4 @@
/datum/element/caltrop/Detach(datum/target)
. = ..()
if(ismovable(target))
RemoveElement(/datum/element/connect_loc, target, crossed_connections)
RemoveElement(/datum/element/connect_loc_behalf, target, crossed_connections)
+53 -41
View File
@@ -1,6 +1,53 @@
/// This element hooks a signal onto the loc the current object is on.
/// When the object moves, it will unhook the signal and rehook it to the new object.
/datum/element/connect_loc
element_flags = ELEMENT_BESPOKE
id_arg_index = 2
/// An assoc list of signal -> procpath to register to the loc this object is on.
var/list/connections
/datum/element/connect_loc/Attach(atom/movable/listener, list/connections)
. = ..()
if (!istype(listener))
return ELEMENT_INCOMPATIBLE
src.connections = connections
RegisterSignal(listener, COMSIG_MOVABLE_MOVED, .proc/on_moved, override = TRUE)
update_signals(listener)
/datum/element/connect_loc/Detach(atom/movable/listener)
. = ..()
unregister_signals(listener, listener.loc)
UnregisterSignal(listener, COMSIG_MOVABLE_MOVED)
/datum/element/connect_loc/proc/update_signals(atom/movable/listener)
var/atom/listener_loc = listener.loc
if(isnull(listener_loc))
return
for (var/signal in connections)
//override=TRUE because more than one connect_loc element instance tracked object can be on the same loc
listener.RegisterSignal(listener_loc, signal, connections[signal], override=TRUE)
/datum/element/connect_loc/proc/unregister_signals(datum/listener, atom/old_loc)
if(isnull(old_loc))
return
for (var/signal in connections)
listener.UnregisterSignal(old_loc, signal)
/datum/element/connect_loc/proc/on_moved(atom/movable/listener, atom/old_loc)
SIGNAL_HANDLER
unregister_signals(listener, old_loc)
update_signals(listener)
/// This element behaves the same as connect_loc, hooking into a signal on a tracked object's turf
/// It has the ability to react to that signal on behalf of a seperate listener however
/// This has great use, primarially for components, but it carries with it some overhead
/// So we do it seperately rather then intigrating the behavior with the main element
/datum/element/connect_loc_behalf
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH | ELEMENT_COMPLEX_DETACH
id_arg_index = 3
@@ -10,14 +57,7 @@
/// An assoc list of locs that are being occupied and a list of targets that occupy them.
var/list/targets = list()
/// The callback used when the turf under the tracked object changes
var/datum/callback/changeturf_callback
/datum/element/connect_loc/New()
. = ..()
changeturf_callback = CALLBACK(src, .proc/post_turf_change)
/datum/element/connect_loc/Attach(datum/listener, atom/movable/tracked, list/connections)
/datum/element/connect_loc_behalf/Attach(datum/listener, atom/movable/tracked, list/connections)
. = ..()
if (!istype(tracked))
return ELEMENT_INCOMPATIBLE
@@ -27,7 +67,7 @@
RegisterSignal(tracked, COMSIG_MOVABLE_MOVED, .proc/on_moved, override = TRUE)
update_signals(listener, tracked)
/datum/element/connect_loc/Detach(datum/listener, atom/movable/tracked, list/connections)
/datum/element/connect_loc_behalf/Detach(datum/listener, atom/movable/tracked, list/connections)
. = ..()
if(!tracked)
@@ -36,7 +76,7 @@
unregister_signals(listener, tracked, tracked.loc)
UnregisterSignal(tracked, COMSIG_MOVABLE_MOVED)
/datum/element/connect_loc/proc/update_signals(datum/listener, atom/movable/tracked)
/datum/element/connect_loc_behalf/proc/update_signals(datum/listener, atom/movable/tracked)
var/existing = length(targets[tracked.loc])
if(!existing)
targets[tracked.loc] = list()
@@ -49,10 +89,7 @@
listener.RegisterSignal(tracked.loc, signal, connections[signal], override=TRUE)
//override=TRUE because more than one connect_loc element instance tracked object can be on the same loc
if (!existing && isturf(tracked.loc))
RegisterSignal(tracked.loc, COMSIG_TURF_CHANGE, .proc/on_turf_change)
/datum/element/connect_loc/proc/unregister_all(datum/listener)
/datum/element/connect_loc_behalf/proc/unregister_all(datum/listener)
for(var/atom/location as anything in targets)
var/list/loc_targets = targets[location]
for(var/atom/movable/tracked as anything in loc_targets)
@@ -64,7 +101,7 @@
continue
UnregisterSignal(tracked, COMSIG_MOVABLE_MOVED)
/datum/element/connect_loc/proc/unregister_signals(datum/listener, atom/movable/tracked, atom/old_loc)
/datum/element/connect_loc_behalf/proc/unregister_signals(datum/listener, atom/movable/tracked, atom/old_loc)
if (length(targets[old_loc]) <= 1)
targets -= old_loc
else
@@ -77,34 +114,9 @@
for (var/signal in connections)
listener.UnregisterSignal(old_loc, signal)
if (!targets[old_loc] && isturf(old_loc))
UnregisterSignal(old_loc, COMSIG_TURF_CHANGE)
/datum/element/connect_loc/proc/on_moved(atom/movable/tracked, atom/old_loc)
/datum/element/connect_loc_behalf/proc/on_moved(atom/movable/tracked, atom/old_loc)
SIGNAL_HANDLER
var/datum/listener = targets[old_loc][tracked]
unregister_signals(listener, tracked, old_loc)
update_signals(listener, tracked)
/datum/element/connect_loc/proc/on_turf_change(
turf/source,
path,
new_baseturfs,
flags,
list/post_change_callbacks,
)
SIGNAL_HANDLER
post_change_callbacks += changeturf_callback
/datum/element/connect_loc/proc/post_turf_change(turf/new_turf)
// If we don't cut the targets list before iterating,
// then we won't re-register the change turf signal.
var/list/turf_targets = targets[new_turf]
var/list/targets_copy = turf_targets.Copy()
turf_targets.Cut()
for (var/atom/movable/tracked as anything in targets_copy)
var/datum/listener = targets_copy[tracked]
update_signals(listener, tracked)
+1
View File
@@ -118,6 +118,7 @@
/datum/element/decal/Detach(atom/source)
UnregisterSignal(source, list(COMSIG_ATOM_DIR_CHANGE, COMSIG_COMPONENT_CLEAN_ACT, COMSIG_PARENT_EXAMINE, COMSIG_ATOM_UPDATE_OVERLAYS, COMSIG_TURF_ON_SHUTTLE_MOVE, COMSIG_ATOM_SMOOTHED_ICON))
SSdcs.UnregisterSignal(source, COMSIG_ATOM_DIR_CHANGE)
source.update_appearance(UPDATE_OVERLAYS)
if(isitem(source))
INVOKE_ASYNC(source, /obj/item/.proc/update_slot_icon)
+2 -2
View File
@@ -27,7 +27,7 @@
if(!src.on_squash_callback && squash_callback)
on_squash_callback = CALLBACK(parent, squash_callback)
AddElement(/datum/element/connect_loc, parent, loc_connections)
AddElement(/datum/element/connect_loc_behalf, parent, loc_connections)
///Handles the squashing of the mob
/datum/component/squashable/proc/on_entered(turf/source_turf, atom/movable/crossing_movable)
@@ -72,4 +72,4 @@
/datum/component/squashable/UnregisterFromParent()
. = ..()
RemoveElement(/datum/element/connect_loc, parent, loc_connections)
RemoveElement(/datum/element/connect_loc_behalf, parent, loc_connections)
+1 -1
View File
@@ -173,7 +173,7 @@
var/static/list/connections = list(
COMSIG_ATOM_ATTACK_HAND = .proc/on_attack_hand
)
AddElement(/datum/element/connect_loc, src, connections)
AddElement(/datum/element/connect_loc, connections)
return INITIALIZE_HINT_LATELOAD
+1 -1
View File
@@ -270,7 +270,7 @@
COMSIG_ATOM_EXIT = .proc/on_exit,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/door/firedoor/border_only/CanAllowThrough(atom/movable/mover, turf/target)
. = ..()
+1 -1
View File
@@ -46,7 +46,7 @@
COMSIG_ATOM_EXIT = .proc/on_exit,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/machinery/door/window/ComponentInitialize()
+1 -1
View File
@@ -43,7 +43,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/recycler/RefreshParts()
var/amt_made = 0
+1 -1
View File
@@ -59,7 +59,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/scanner_gate/Destroy()
qdel(wires)
+1 -1
View File
@@ -20,7 +20,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/teambuilder/examine_more(mob/user)
. = ..()
+2 -2
View File
@@ -107,7 +107,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/anomaly/grav/anomalyEffect()
..()
@@ -178,7 +178,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/anomaly/flux/anomalyEffect()
..()
@@ -36,7 +36,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/decal/cleanable/Destroy()
var/turf/T = get_turf(src)
@@ -130,7 +130,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/particle_effect/smoke/bad/smoke_mob(mob/living/carbon/M)
. = ..()
+1 -1
View File
@@ -21,7 +21,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/mine/examine(mob/user)
. = ..()
+1 -1
View File
@@ -86,7 +86,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/portal/singularity_pull()
return
+1 -1
View File
@@ -22,7 +22,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/powerup/proc/on_entered(datum/source, atom/movable/movable_atom)
SIGNAL_HANDLER
+1 -1
View File
@@ -111,7 +111,7 @@
COMSIG_ATOM_ENTERED = .proc/on_entered,
COMSIG_ATOM_EXITED =.proc/on_uncrossed,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/abstract/proximity_checker/proc/on_uncrossed(datum/source, atom/movable/gone, direction)
SIGNAL_HANDLER
+1 -1
View File
@@ -12,7 +12,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/step_trigger/proc/Trigger(atom/movable/A)
return 0
@@ -35,7 +35,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/pressure_plate/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
+1 -1
View File
@@ -323,7 +323,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/spring_trap,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/restraints/legcuffs/beartrap/update_icon_state()
icon_state = "[initial(icon_state)][armed]"
@@ -295,7 +295,7 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/shard/Destroy()
. = ..()
+1 -1
View File
@@ -83,7 +83,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/** Sets the amount of materials per unit for this stack.
*
+1 -1
View File
@@ -539,7 +539,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/toy/snappop/proc/on_entered(datum/source, H as mob|obj)
SIGNAL_HANDLER
@@ -166,7 +166,7 @@ GLOBAL_LIST_EMPTY(lifts)
COMSIG_ATOM_ENTERED = .proc/AddItemOnLift,
COMSIG_ATOM_CREATED = .proc/AddItemOnLift,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
RegisterSignal(src, COMSIG_MOVABLE_BUMP, .proc/GracefullyBreak)
if(!lift_master_datum)
+1 -1
View File
@@ -82,7 +82,7 @@
COMSIG_ATOM_EXIT = .proc/on_exit,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/railing/proc/on_exit(datum/source, atom/movable/leaving, direction)
SIGNAL_HANDLER
+1 -1
View File
@@ -43,7 +43,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/shower/examine(mob/user)
. = ..()
+1 -1
View File
@@ -38,7 +38,7 @@
COMSIG_ATOM_EXIT = .proc/on_exit,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
return ..()
+1 -1
View File
@@ -327,7 +327,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/table/glass/Destroy()
QDEL_LIST(debris)
+1 -1
View File
@@ -28,7 +28,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
if(!ignore_typecache)
ignore_typecache = typecacheof(list(
@@ -39,7 +39,7 @@
COMSIG_ATOM_EXIT = .proc/on_exit,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/windoor_assembly/Destroy()
set_density(FALSE)
+1 -1
View File
@@ -74,7 +74,7 @@
)
if (flags_1 & ON_BORDER_1)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/window/ComponentInitialize()
. = ..()
+11
View File
@@ -97,8 +97,19 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
changing_turf = TRUE
qdel(src) //Just get the side effects and call Destroy
//We do this here so anything that doesn't want to persist can clear itself
var/list/old_comp_lookup = comp_lookup?.Copy()
var/list/old_signal_procs = signal_procs?.Copy()
var/turf/W = new path(src)
// WARNING WARNING
// Turfs DO NOT lose their signals when they get replaced, REMEMBER THIS
// It's possible because turfs are fucked, and if you have one in a list and it's replaced with another one, the list ref points to the new turf
if(old_comp_lookup)
LAZYOR(W.comp_lookup, old_comp_lookup)
if(old_signal_procs)
LAZYOR(W.signal_procs, old_signal_procs)
for(var/datum/callback/callback as anything in post_change_callbacks)
callback.InvokeAsync(W)
+8
View File
@@ -5,6 +5,7 @@ GLOBAL_LIST_EMPTY(station_turfs)
icon = 'icons/turf/floors.dmi'
vis_flags = VIS_INHERIT_ID | VIS_INHERIT_PLANE// Important for interaction with and visualization of openspace.
luminosity = 1
/// Turf bitflags, see code/__DEFINES/flags.dm
var/turf_flags = NONE
var/intact = 1
@@ -163,6 +164,13 @@ GLOBAL_LIST_EMPTY(station_turfs)
vis_contents.Cut()
/// WARNING WARNING
/// Turfs DO NOT lose their signals when they get replaced, REMEMBER THIS
/// It's possible because turfs are fucked, and if you have one in a list and it's replaced with another one, the list ref points to the new turf
/// We do it because moving signals over was needlessly expensive, and bloated a very commonly used bit of code
/turf/clear_signal_refs()
return
/turf/attack_hand(mob/user, list/modifiers)
. = ..()
if(.)
@@ -845,7 +845,7 @@ Congratulations! You are now trained for invasive xenobiology research!"}
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/table/optable/abductor/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
+1 -1
View File
@@ -234,7 +234,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/beam/i_beam/proc/on_entered(datum/source, atom/movable/AM as mob|obj)
SIGNAL_HANDLER
+3 -3
View File
@@ -19,7 +19,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/assembly/mousetrap/examine(mob/user)
. = ..()
@@ -47,11 +47,11 @@
/obj/item/assembly/mousetrap/on_attach()
. = ..()
AddElement(/datum/element/connect_loc, holder, holder_connections)
AddElement(/datum/element/connect_loc_behalf, holder, holder_connections)
/obj/item/assembly/mousetrap/on_detach()
. = ..()
RemoveElement(/datum/element/connect_loc, holder, holder_connections)
RemoveElement(/datum/element/connect_loc_behalf, holder, holder_connections)
/obj/item/assembly/mousetrap/proc/triggered(mob/target, type = "feet")
if(!armed)
@@ -8,9 +8,9 @@
/turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
return
/**
* Handles the creation of hotspots and initial activation of turfs.
* Setting the conditions for the reaction to actually happen for gasmixtures
/**
* Handles the creation of hotspots and initial activation of turfs.
* Setting the conditions for the reaction to actually happen for gasmixtures
* is handled by the hotspot itself, specifically perform_exposure().
*/
/turf/open/hotspot_expose(exposed_temperature, exposed_volume, soh)
@@ -48,7 +48,7 @@
/**
* Hotspot objects interfaces with the temperature of turf gasmixtures while also providing visual effects.
* Hotspot objects interfaces with the temperature of turf gasmixtures while also providing visual effects.
* One important thing to note about hotspots are that they can roughly be divided into two categories based on the bypassing variable.
*/
/obj/effect/hotspot
@@ -64,7 +64,7 @@
light_color = LIGHT_COLOR_FIRE
/**
* Volume is the representation of how big and healthy a fire is.
* Volume is the representation of how big and healthy a fire is.
* Hotspot volume will be divided by turf volume to get the ratio for temperature setting on non bypassing mode.
* Also some visual stuffs for fainter fires.
*/
@@ -91,17 +91,17 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/**
* Perform interactions between the hotspot and the gasmixture.
*
* For the first tick, hotspots will take a sample of the air in the turf,
* set the temperature equal to a certain amount, and then reacts it.
* set the temperature equal to a certain amount, and then reacts it.
* In some implementations the ratio comes out to around 1, so all of the air in the turf.
*
* Afterwards if the reaction is big enough it mostly just tags along the fire,
* copying the temperature and handling the colouring.
* Afterwards if the reaction is big enough it mostly just tags along the fire,
* copying the temperature and handling the colouring.
* If the reaction is too small it will perform like the first tick.
*
* Also calls fire_act() which handles burning.
@@ -197,8 +197,8 @@
#define INSUFFICIENT(path) (!location.air.gases[path] || location.air.gases[path][MOLES] < 0.5)
/**
* Regular process proc for hotspots governed by the controller.
/**
* Regular process proc for hotspots governed by the controller.
* Handles the calling of perform_exposure() which handles the bulk of temperature processing.
* Burning or fire_act() are also called by perform_exposure().
* Also handles the dying and qdeletion of the hotspot and hotspot creations on adjacent cardinal turfs.
@@ -131,7 +131,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/meatgrinder/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
@@ -131,7 +131,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/rupee/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
+1 -1
View File
@@ -208,7 +208,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/clothing/glasses/regular/proc/on_entered(datum/source, atom/movable/movable)
+1 -1
View File
@@ -336,7 +336,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/structure/spacevine/examine(mob/user)
+3 -3
View File
@@ -1329,7 +1329,7 @@ GLOBAL_LIST_INIT(hallucination_list, list(
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/hallucination/danger/lava/show_icon()
image = image('icons/turf/floors/lava.dmi', src, "lava-0", TURF_LAYER)
@@ -1350,7 +1350,7 @@ GLOBAL_LIST_INIT(hallucination_list, list(
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/hallucination/danger/chasm/show_icon()
var/turf/target_loc = get_turf(target)
@@ -1377,7 +1377,7 @@ GLOBAL_LIST_INIT(hallucination_list, list(
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/hallucination/danger/anomaly/process(delta_time)
if(DT_PROB(45, delta_time))
+1 -1
View File
@@ -179,7 +179,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/bonfire/attackby(obj/item/W, mob/living/user, params)
if(istype(W, /obj/item/stack/rods) && !can_buckle && !grill)
+1 -1
View File
@@ -421,7 +421,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/cultivator/rake/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
+1 -1
View File
@@ -69,7 +69,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/burst,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
. = ..()
creator = set_creator
res = set_resonator
@@ -37,7 +37,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/item/clothing/mask/facehugger/lamarr
@@ -28,7 +28,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/mob/living/carbon/human/proc/setup_human_dna()
//initialize dna. for spawned humans; overwritten by other code
@@ -116,7 +116,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/mob/living/simple_animal/bot/cleanbot/Destroy()
if(weapon)
@@ -49,7 +49,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/mob/living/simple_animal/bot/honkbot/proc/limiting_spam_false() //used for addtimer
limiting_spam = FALSE
@@ -49,7 +49,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/mob/living/simple_animal/bot/hygienebot/explode()
walk_to(src,0)
@@ -90,7 +90,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/mob/living/simple_animal/bot/secbot/Destroy()
QDEL_NULL(weapon)
@@ -41,7 +41,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/mob/living/simple_animal/mouse/add_cell_sample()
AddElement(/datum/element/swabable, CELL_LINE_TABLE_MOUSE, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 10)
@@ -19,7 +19,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/mob/living/simple_animal/hostile/guardian/fire/Life(delta_time = SSMOBS_DT, times_fired)
. = ..()
@@ -115,7 +115,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/snare/proc/on_entered(datum/source, AM as mob|obj)
SIGNAL_HANDLER
@@ -85,7 +85,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/leaper_bubble/ComponentInitialize()
. = ..()
@@ -659,7 +659,7 @@ Difficulty: Hard
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/temp_visual/hierophant/blast/damaging/proc/blast()
var/turf/T = get_turf(src)
@@ -284,7 +284,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/legionnaire_bonfire/proc/on_entered(datum/source, atom/movable/mover)
SIGNAL_HANDLER
@@ -46,7 +46,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/mob/living/simple_animal/hostile/retaliate/frog/proc/on_entered(datum/source, AM as mob|obj)
SIGNAL_HANDLER
@@ -77,7 +77,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/ebeam/vine/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
+1 -1
View File
@@ -16,7 +16,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type)
if(anchored)
@@ -15,7 +15,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type)
if(anchored)
+1 -1
View File
@@ -924,7 +924,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/item/light/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
@@ -24,7 +24,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/field/containment/Destroy()
FG1.fields -= src
+1 -1
View File
@@ -177,7 +177,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/projectile/proc/Range()
range--
@@ -50,7 +50,7 @@
COMSIG_ATOM_EXIT = .proc/on_exit,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/necropolis_gate/Destroy(force)
if(force)
@@ -264,7 +264,7 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/stone_tile/Destroy(force)
if(force || fallen)
+1 -1
View File
@@ -200,7 +200,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/table/wood/bar/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
@@ -87,7 +87,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/cross_action/spacetime_dist/proc/walk_link(atom/movable/AM)
if(ismob(AM))
+1 -1
View File
@@ -135,7 +135,7 @@
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/swarmer/trap/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
+1 -1
View File
@@ -66,7 +66,7 @@
COMSIG_MOCK_SIGNAL = .proc/on_receive_mock_signal,
)
AddElement(/datum/element/connect_loc, src, connections)
AddElement(/datum/element/connect_loc, connections)
/obj/item/watches_mock_calls/proc/on_receive_mock_signal(datum/source)
SIGNAL_HANDLER