mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
[MIRROR] Makes turfs persist their signals, uses this to optimize connect_loc (#6465)
* 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 * Makes turfs persist their signals, uses this to optimize connect_loc Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
co-authored by
LemonInTheDark
parent
8dc7776979
commit
5326760cb3
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -339,7 +339,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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user