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 23:12:34 -04:00
committed by GitHub
parent b5b4497b59
commit 6fcbce39cd
81 changed files with 182 additions and 146 deletions
+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