Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(code bounty) refactors all uses of Crossed() and Uncrossed() into signals sent to loc, tracked by connect_loc #58340

Merged
merged 103 commits into from May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
94d1c0c
Remove Uncross(), add create_loc element
Mothblocks Apr 6, 2021
57b0b96
Update on ChangeTurf
Mothblocks Apr 6, 2021
cb5c5a4
it compiles!
Kylerace Apr 6, 2021
b0bdb22
Explicit return
Mothblocks Apr 6, 2021
e60c8d0
replaces the rest of the crossed calls and minor cleanup
Kylerace Apr 6, 2021
4360af0
Merge remote-tracking branch 'upstream/master' into crossedtosignals
Kylerace Apr 6, 2021
e0a4e51
Hold onto elements and remove TEST_FOCUS
Mothblocks Apr 7, 2021
ff2ffbe
Remove UNIT_TESTS compile flag
Mothblocks Apr 7, 2021
fd2bd42
Follow my own advice.
Mothblocks Apr 7, 2021
fcfd38b
Comment about Uncross + CRASH
Mothblocks Apr 7, 2021
ad46686
linters schminters, also docs Crossed so people dont use it
Kylerace Apr 7, 2021
2e735ea
Remove /atom/Exit ..()
Mothblocks Apr 7, 2021
aae4b14
updates docs, adds SHOULD_NOT_OVERRIDE(TRUE) to Crossed
Kylerace Apr 7, 2021
100a90b
Merge remote-tracking branch 'Mothblocks/remove-uncross' into crossed…
Kylerace Apr 7, 2021
6827e97
it compiles but literally does not work :trollface:
Kylerace Apr 7, 2021
38bc3e9
Apply suggestions from code review
Mothblocks Apr 7, 2021
5d6e7d3
Use keyed locs
Mothblocks Apr 7, 2021
573f338
Re-add Bump()
Mothblocks Apr 7, 2021
fa4ada7
Superfluous check
Mothblocks Apr 7, 2021
36bf150
Correct change turf signal, remove old continue check
Mothblocks Apr 8, 2021
1c3d6c3
Fix compile failure
Mothblocks Apr 8, 2021
ed6929f
Fix tests
Mothblocks Apr 8, 2021
1174242
Don't create element for fulltile windows
Mothblocks Apr 8, 2021
d98bec1
Correctly unregister old location
Mothblocks Apr 8, 2021
d191e33
Merge remote-tracking branch 'Mothblocks/remove-uncross' into crossed…
Kylerace Apr 8, 2021
e4e4cbc
moves some components to using connect_loc and deals with UNCROSSED uses
Kylerace Apr 8, 2021
a23ac64
components use the element, converts uses of Uncrossed like with Crossed
Kylerace Apr 9, 2021
9af9a31
Fix connect_loc runtiming for multiple turfs
Mothblocks Apr 9, 2021
b0e7ffa
Merge remote-tracking branch 'mothblocks/connect-loc-null' into cross…
Kylerace Apr 9, 2021
db55cc6
Allows the connect_loc element to have a remote tracked object
ninjanomnom Apr 9, 2021
1397c3a
Makes detach by default use the same object
ninjanomnom Apr 9, 2021
fe36a10
cleanup with proximity_checker code and slippery component
Kylerace Apr 9, 2021
d04ebe7
Merge remote-tracking branch 'ninjanomnom/remote-connect-loc' into cr…
Kylerace Apr 9, 2021
ea05ba7
Puts new Detach behavior behind a flag
ninjanomnom Apr 9, 2021
b8dfd07
updates superbeepsky and monkey controller with new addelement changes
Kylerace Apr 9, 2021
ba45934
Merge remote-tracking branch 'ninjanomnom/remote-connect-loc' into cr…
Kylerace Apr 9, 2021
a345f7f
mass changes to make work, fixes many runtimes. still more to go.
Kylerace Apr 10, 2021
7a8e7e5
elements dont work, but most other things seem to!
Kylerace Apr 10, 2021
f43f967
Allows the connect_loc element to have a remote tracked object
ninjanomnom Apr 9, 2021
ee11a43
Makes detach by default use the same object
ninjanomnom Apr 9, 2021
80bc4de
Puts new Detach behavior behind a flag
ninjanomnom Apr 9, 2021
9dcd4e9
Fixes issue in conflict resolution
ninjanomnom Apr 10, 2021
cd94d11
makes elements work without connect_loc and fixes runtime with transit
Kylerace Apr 11, 2021
a71a682
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace Apr 11, 2021
c25ee6b
cleans up TODOKYLER's, fixes mistake with merging from master
Kylerace Apr 11, 2021
e8d109a
Merge remote-tracking branch 'zz_ninjanomnom/remote-connect-loc' into…
Kylerace Apr 11, 2021
51ac9cf
fixes runtime with slippery component and makes connect_loc override
Kylerace Apr 11, 2021
43a52f1
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace Apr 11, 2021
b024e7c
creates and makes connect_loc use COMSIG_MOVABLE_LOCATION_CHANGE
Kylerace Apr 11, 2021
0d7b325
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace Apr 12, 2021
b20c847
the squashable element is now a component, it wont work otherwise
Kylerace Apr 12, 2021
a213bd0
it compiles!
Kylerace Apr 6, 2021
fafda49
replaces the rest of the crossed calls and minor cleanup
Kylerace Apr 6, 2021
22bbcdd
linters schminters, also docs Crossed so people dont use it
Kylerace Apr 7, 2021
434cde6
updates docs, adds SHOULD_NOT_OVERRIDE(TRUE) to Crossed
Kylerace Apr 7, 2021
bcec7eb
Update on ChangeTurf
Mothblocks Apr 6, 2021
dc6ef2b
Hold onto elements and remove TEST_FOCUS
Mothblocks Apr 7, 2021
5587298
Remove UNIT_TESTS compile flag
Mothblocks Apr 7, 2021
c7f7d4a
Comment about Uncross + CRASH
Mothblocks Apr 7, 2021
9495485
it compiles but literally does not work :trollface:
Kylerace Apr 7, 2021
494cb94
Use keyed locs
Mothblocks Apr 7, 2021
bf31612
Fix tests
Mothblocks Apr 8, 2021
f417753
moves some components to using connect_loc and deals with UNCROSSED uses
Kylerace Apr 8, 2021
4979eeb
components use the element, converts uses of Uncrossed like with Crossed
Kylerace Apr 9, 2021
0c6c7a7
cleanup with proximity_checker code and slippery component
Kylerace Apr 9, 2021
474f078
Allows the connect_loc element to have a remote tracked object
ninjanomnom Apr 9, 2021
e992e8f
updates superbeepsky and monkey controller with new addelement changes
Kylerace Apr 9, 2021
a576e4f
mass changes to make work, fixes many runtimes. still more to go.
Kylerace Apr 10, 2021
a95b13e
elements dont work, but most other things seem to!
Kylerace Apr 10, 2021
90cc58a
makes elements work without connect_loc and fixes runtime with transit
Kylerace Apr 11, 2021
3f2ef53
cleans up TODOKYLER's, fixes mistake with merging from master
Kylerace Apr 11, 2021
ea9d549
fixes runtime with slippery component and makes connect_loc override
Kylerace Apr 11, 2021
7bd522c
creates and makes connect_loc use COMSIG_MOVABLE_LOCATION_CHANGE
Kylerace Apr 11, 2021
8d25ec4
the squashable element is now a component, it wont work otherwise
Kylerace Apr 12, 2021
5393326
Merge remote-tracking branch 'refs/remotes/origin/crossedtoturfsignals'
Kylerace Apr 12, 2021
737e985
connect_loc now uses tracked as a key when its loc is null
Kylerace Apr 14, 2021
351da62
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace Apr 14, 2021
42ce3b3
gets rid of remnant debugging comments
Kylerace Apr 14, 2021
9a3a734
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace Apr 14, 2021
32b48b7
doMove now sends src as an argument when sending the uncrossed signal
Kylerace Apr 14, 2021
fcb1d2b
fix to slippery holder runtime and projectiles impacted list isnt null
Kylerace Apr 15, 2021
bcfa5a6
i just realized that this if else statement was useless
Kylerace Apr 15, 2021
edd0d80
fixes unit test, and fixes all uses of setting loc directly not break…
Kylerace Apr 15, 2021
7019676
Revert "fixes unit test, and fixes all uses of setting loc directly n…
Kylerace Apr 15, 2021
0decf8d
redoes the unit test fix without changes to launch.json
Kylerace Apr 15, 2021
4031e55
no longer uses tracked as a key in connect_loc because it wasnt needed
Kylerace Apr 16, 2021
8f0c796
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace Apr 19, 2021
a903683
creates update_loc() for locatio_change signal and abstract_move()
Kylerace Apr 26, 2021
d7809fd
adds squeaky trait to fix inheritance issue, minor fixes
Kylerace Apr 26, 2021
0758651
moves over imaginary friends to abstract_move
Kylerace Apr 26, 2021
93edfe5
fixes inheritance issue with bikehorns having multiple squeaky component
Kylerace Apr 26, 2021
e0bdf3c
renames slippery component connect_loc signal lists
Kylerace Apr 26, 2021
3286f43
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace Apr 26, 2021
7f4a393
fixes fucking bullshit squeaky component bug that never worked REEEEEEEE
Kylerace Apr 29, 2021
c46a417
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace May 1, 2021
a993c95
fixes & docs, makes caltrop use c_l and makes c_l not override a signal
Kylerace May 1, 2021
c73ae6b
gets rid of squeaky trait, crossed and uncrossed are in entered & exited
Kylerace May 1, 2021
57eb44a
updated doc comment
Kylerace May 2, 2021
d2a5eeb
removes the crossed and uncrossed signals and mass replaces them
Kylerace May 2, 2021
6029814
Merge remote-tracking branch 'upstream/master' into crossedtoturfsignals
Kylerace May 4, 2021
e459433
fixes merge conflict and a mistake made when mass replacing
Kylerace May 4, 2021
bb59ce2
semi-fixes portals not working. still have to deal with weird bug
Kylerace May 6, 2021
3badaf3
renames argument in portal/on_entered and fixes weird if statement
Kylerace May 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 4 additions & 10 deletions code/__DEFINES/dcs/signals.dm
Expand Up @@ -379,18 +379,12 @@
#define COMPONENT_MOVABLE_BLOCK_PRE_MOVE (1<<0)
///from base of atom/movable/Moved(): (/atom, dir)
#define COMSIG_MOVABLE_MOVED "movable_moved"
///from base of atom/movable/update_loc(): (/atom/oldloc)
#define COMSIG_MOVABLE_LOCATION_CHANGE "location_changed"
///from base of atom/movable/Cross(): (/atom/movable)
#define COMSIG_MOVABLE_CROSS "movable_cross"
///from base of atom/movable/Crossed(): (/atom/movable)
#define COMSIG_MOVABLE_CROSSED "movable_crossed"
///from base of atom/movable/Uncrossed(): (/atom/movable)
#define COMSIG_MOVABLE_UNCROSSED "movable_uncrossed"
///from base of atom/movable/Cross(): (/atom/movable)
///from base of atom/movable/Move(): (/atom/movable)
#define COMSIG_MOVABLE_CROSS_OVER "movable_cross_am"
///from base of atom/movable/Crossed(): (/atom/movable)
#define COMSIG_MOVABLE_CROSSED_OVER "movable_crossed_am"
///from base of atom/movable/Uncrossed(): (/atom/movable)
#define COMSIG_MOVABLE_UNCROSSED_OVER "movable_uncross_am"
///from base of atom/movable/Bump(): (/atom)
#define COMSIG_MOVABLE_BUMP "movable_bump"
///from base of atom/movable/throw_impact(): (/atom/hit_atom, /datum/thrownthing/throwingdatum)
Expand Down Expand Up @@ -958,7 +952,7 @@

///from Edible component: (mob/living/eater, mob/feeder, bitecount, bitesize)
#define COMSIG_FOOD_EATEN "food_eaten"
///from base of datum/component/edible/oncrossed: (mob/crosser, bitecount)
///from base of datum/component/edible/on_entered: (mob/crosser, bitecount)
#define COMSIG_FOOD_CROSSED "food_crossed"

///from base of Component/edible/On_Consume: (mob/living/eater, mob/living/feeder)
Expand Down
10 changes: 5 additions & 5 deletions code/__HELPERS/unsorted.dm
Expand Up @@ -332,12 +332,12 @@ Turf and target are separate in case you want to teleport some distance from a t
//For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf.
//Optional arg 'type' to stop once it reaches a specific type instead of a turf.
/proc/get_atom_on_turf(atom/movable/M, stop_type)
var/atom/loc = M
while(loc?.loc && !isturf(loc.loc))
loc = loc.loc
if(stop_type && istype(loc, stop_type))
var/atom/turf_to_check = M
while(turf_to_check?.loc && !isturf(turf_to_check.loc))
turf_to_check = turf_to_check.loc
if(stop_type && istype(turf_to_check, stop_type))
break
return loc
return turf_to_check

//Returns a list of all locations (except the area) the movable is within.
/proc/get_nested_locs(atom/movable/AM, include_turf = FALSE)
Expand Down
11 changes: 8 additions & 3 deletions code/datums/ai/monkey/monkey_controller.dm
Expand Up @@ -41,19 +41,24 @@ have ways of interacting with a specific mob and control it.
RegisterSignal(new_pawn, COMSIG_ATOM_ATTACK_PAW, .proc/on_attack_paw)
RegisterSignal(new_pawn, COMSIG_ATOM_BULLET_ACT, .proc/on_bullet_act)
RegisterSignal(new_pawn, COMSIG_ATOM_HITBY, .proc/on_hitby)
RegisterSignal(new_pawn, COMSIG_MOVABLE_CROSSED, .proc/on_Crossed)
RegisterSignal(new_pawn, COMSIG_LIVING_START_PULL, .proc/on_startpulling)
RegisterSignal(new_pawn, COMSIG_LIVING_TRY_SYRINGE, .proc/on_try_syringe)
RegisterSignal(new_pawn, COMSIG_ATOM_HULK_ATTACK, .proc/on_attack_hulk)
RegisterSignal(new_pawn, COMSIG_CARBON_CUFF_ATTEMPTED, .proc/on_attempt_cuff)
RegisterSignal(new_pawn, COMSIG_MOB_MOVESPEED_UPDATED, .proc/update_movespeed)
RegisterSignal(new_pawn, COMSIG_FOOD_EATEN, .proc/on_eat)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, 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_MOVABLE_CROSSED, COMSIG_LIVING_START_PULL,\
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)

return ..() //Run parent at end

/datum/ai_controller/monkey/able_to_run()
Expand Down Expand Up @@ -304,7 +309,7 @@ have ways of interacting with a specific mob and control it.
var/mob/living/carbon/human/H = I.thrownby
retaliate(H)

/datum/ai_controller/monkey/proc/on_Crossed(datum/source, atom/movable/AM)
/datum/ai_controller/monkey/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
var/mob/living/living_pawn = pawn
if(!IS_DEAD_OR_INCAP(living_pawn) && ismob(AM))
Expand Down
9 changes: 4 additions & 5 deletions code/datums/brain_damage/imaginary_friend.dm
Expand Up @@ -186,18 +186,17 @@
recall()
move_delay = world.time + 10
return FALSE
forceMove(NewLoc)
abstract_move(NewLoc)
move_delay = world.time + 1

/mob/camera/imaginary_friend/forceMove(atom/destination)
dir = get_dir(get_turf(src), destination)
loc = destination
/mob/camera/imaginary_friend/abstract_move(atom/destination)
. = ..()
Show()

/mob/camera/imaginary_friend/proc/recall()
if(!owner || loc == owner)
return FALSE
forceMove(owner)
abstract_move(owner)

/datum/action/innate/imaginary_join
name = "Join"
Expand Down
6 changes: 3 additions & 3 deletions code/datums/components/acid.dm
Expand Up @@ -71,7 +71,7 @@
RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, .proc/on_attack_hand)
RegisterSignal(parent, COMSIG_ATOM_EXPOSE_REAGENT, .proc/on_expose_reagent)
if(isturf(parent))
RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/on_crossed)
RegisterSignal(parent, COMSIG_ATOM_ENTERED, .proc/on_entered)

/datum/component/acid/UnregisterFromParent()
UnregisterSignal(parent, list(
Expand All @@ -81,7 +81,7 @@
COMSIG_ATOM_EXPOSE_REAGENT))

if(isturf(parent))
UnregisterSignal(parent, COMSIG_MOVABLE_CROSSED)
UnregisterSignal(parent, COMSIG_ATOM_ENTERED)

/// Averages corrosive power and sums volume.
/datum/component/acid/InheritComponent(datum/component/C, i_am_original, _acid_power, _acid_volume)
Expand Down Expand Up @@ -202,7 +202,7 @@


/// Handles searing the feet of whoever walks over this without protection. Only active if the parent is a turf.
/datum/component/acid/proc/on_crossed(atom/parent_atom, mob/living/crosser)
/datum/component/acid/proc/on_entered(atom/parent_atom, mob/living/crosser)
SIGNAL_HANDLER

if(!isliving(crosser))
Expand Down
8 changes: 6 additions & 2 deletions code/datums/components/butchering.dm
Expand Up @@ -142,9 +142,13 @@
. = ..()
if(. == COMPONENT_INCOMPATIBLE)
return
RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/onCrossed)

/datum/component/butchering/recycler/proc/onCrossed(datum/source, mob/living/L)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, parent, loc_connections)

/datum/component/butchering/recycler/proc/on_entered(datum/source, mob/living/L)
SIGNAL_HANDLER

if(!istype(L))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/chasm.dm
Expand Up @@ -27,7 +27,7 @@
))

/datum/component/chasm/Initialize(turf/target)
RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED), .proc/Entered)
RegisterSignal(parent, COMSIG_ATOM_ENTERED, .proc/Entered)
target_turf = target
START_PROCESSING(SSobj, src) // process on create, in case stuff is still there

Expand Down
8 changes: 6 additions & 2 deletions code/datums/components/food/edible.dm
Expand Up @@ -67,9 +67,13 @@ Behavior that's still missing from this component that original food items had t
RegisterSignal(parent, COMSIG_ATOM_CHECKPARTS, .proc/OnCraft)
RegisterSignal(parent, COMSIG_ATOM_CREATEDBY_PROCESSING, .proc/OnProcessed)
RegisterSignal(parent, COMSIG_ITEM_MICROWAVE_COOKED, .proc/OnMicrowaveCooked)
RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/onCrossed)
RegisterSignal(parent, COMSIG_EDIBLE_INGREDIENT_ADDED, .proc/edible_ingredient_added)

var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, parent, loc_connections)

if(isitem(parent))
RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/UseFromHand)
RegisterSignal(parent, COMSIG_ITEM_FRIED, .proc/OnFried)
Expand Down Expand Up @@ -431,7 +435,7 @@ Behavior that's still missing from this component that original food items had t


///Ability to feed food to puppers
/datum/component/edible/proc/onCrossed(datum/source, mob/user)
/datum/component/edible/proc/on_entered(datum/source, mob/user)
SIGNAL_HANDLER
SEND_SIGNAL(parent, COMSIG_FOOD_CROSSED, user, bitecount)

Expand Down
7 changes: 6 additions & 1 deletion code/datums/components/infective.dm
Expand Up @@ -14,10 +14,15 @@

if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE

var/static/list/disease_connections = list(
COMSIG_ATOM_ENTERED = .proc/try_infect_crossed,
)
AddElement(/datum/element/connect_loc, parent, disease_connections)

RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, .proc/clean)
RegisterSignal(parent, COMSIG_MOVABLE_BUCKLE, .proc/try_infect_buckle)
RegisterSignal(parent, COMSIG_MOVABLE_BUMP, .proc/try_infect_collide)
RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/try_infect_crossed)
RegisterSignal(parent, COMSIG_MOVABLE_IMPACT_ZONE, .proc/try_infect_impact_zone)
if(isitem(parent))
RegisterSignal(parent, COMSIG_ITEM_ATTACK_ZONE, .proc/try_infect_attack_zone)
Expand Down
7 changes: 5 additions & 2 deletions code/datums/components/pellet_cloud.dm
Expand Up @@ -89,7 +89,7 @@
RegisterSignal(parent, COMSIG_SUPPLYPOD_LANDED, .proc/create_blast_pellets)

/datum/component/pellet_cloud/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_PELLET_CLOUD_INIT, COMSIG_GRENADE_DETONATE, COMSIG_GRENADE_ARMED, COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_UNCROSSED, COMSIG_MINE_TRIGGERED, COMSIG_ITEM_DROPPED))
UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_PELLET_CLOUD_INIT, COMSIG_GRENADE_DETONATE, COMSIG_GRENADE_ARMED, COMSIG_MOVABLE_MOVED, COMSIG_MINE_TRIGGERED, COMSIG_ITEM_DROPPED))

/**
* create_casing_pellets() is for directed pellet clouds for ammo casings that have multiple pellets (buckshot and scatter lasers for instance)
Expand Down Expand Up @@ -324,7 +324,10 @@
LAZYINITLIST(bodies)
RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/grenade_dropped)
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/grenade_moved)
RegisterSignal(parent, COMSIG_MOVABLE_UNCROSSED, .proc/grenade_uncrossed)
var/static/list/loc_connections = list(
COMSIG_ATOM_EXITED =.proc/grenade_uncrossed,
)
AddElement(/datum/element/connect_loc, 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)
Expand Down
12 changes: 11 additions & 1 deletion code/datums/components/rot.dm
Expand Up @@ -17,6 +17,10 @@
///Bitfield of sources preventing the component from rotting
var/blockers = NONE

var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/rot_react,
)

/datum/component/rot/Initialize(delay, scaling, severity)
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE
Expand All @@ -33,7 +37,8 @@
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))
RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_MOVABLE_BUMP), .proc/rot_react)
AddElement(/datum/element/connect_loc, 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
RegisterSignal(parent, COMSIG_LIVING_GET_PULLED, .proc/rot_react_touch)
Expand All @@ -52,6 +57,11 @@

start_up(NONE) //If nothing's blocking it, start

/datum/component/rot/UnregisterFromParent()
. = ..()
if(ismovable(parent))
RemoveElement(/datum/element/connect_loc, 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)
blockers &= ~blocker_type //Yeet the type
Expand Down
7 changes: 5 additions & 2 deletions code/datums/components/singularity.dm
Expand Up @@ -81,7 +81,11 @@
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/consume_attackby)

RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, .proc/moved)
RegisterSignal(parent, list(COMSIG_ATOM_BUMPED, COMSIG_MOVABLE_CROSSED), .proc/consume)
RegisterSignal(parent, COMSIG_ATOM_BUMPED, .proc/consume)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/consume,
)
AddElement(/datum/element/connect_loc, parent, loc_connections)

RegisterSignal(parent, COMSIG_ATOM_BULLET_ACT, .proc/consume_bullets)

Expand Down Expand Up @@ -111,7 +115,6 @@
COMSIG_ATOM_BSA_BEAM,
COMSIG_ATOM_BULLET_ACT,
COMSIG_ATOM_BUMPED,
COMSIG_MOVABLE_CROSSED,
COMSIG_MOVABLE_PRE_MOVE,
COMSIG_PARENT_ATTACKBY,
))
Expand Down
25 changes: 21 additions & 4 deletions code/datums/components/slippery.dm
Expand Up @@ -14,6 +14,15 @@
var/mob/living/holder
/// Whitelist of item slots the parent can be equipped in that make the holder slippery. If null or empty, it will always make the holder slippery.
var/list/slot_whitelist = list(ITEM_SLOT_OCLOTHING, ITEM_SLOT_ICLOTHING, ITEM_SLOT_GLOVES, ITEM_SLOT_FEET, ITEM_SLOT_HEAD, ITEM_SLOT_MASK, ITEM_SLOT_BELT, ITEM_SLOT_NECK)
///what we give to connect_loc by default, makes slippable mobs moving over us slip
var/static/list/default_connections = list(
COMSIG_ATOM_ENTERED = .proc/Slip,
)

///what we give to connect_loc if we're an item and get equipped by a mob. makes slippable mobs moving over our holder slip
var/static/list/holder_connections = list(
COMSIG_ATOM_ENTERED = .proc/Slip_on_wearer,
)

/datum/component/slippery/Initialize(knockdown, lube_flags = NONE, datum/callback/callback, paralyze, force_drop = FALSE, slot_whitelist)
src.knockdown_time = max(knockdown, 0)
Expand All @@ -23,9 +32,10 @@
src.callback = callback
if(slot_whitelist)
src.slot_whitelist = slot_whitelist
RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/Slip)
if(ismovable(parent))
AddElement(/datum/element/connect_loc, parent, default_connections)

if(isitem(parent))
holder = parent
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_equip)
RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/on_drop)
else
Expand Down Expand Up @@ -58,7 +68,7 @@

if((!LAZYLEN(slot_whitelist) || (slot in slot_whitelist)) && isliving(equipper))
holder = equipper
RegisterSignal(holder, COMSIG_MOVABLE_CROSSED, .proc/Slip_on_wearer)
AddElement(/datum/element/connect_loc, holder, holder_connections)
RegisterSignal(holder, COMSIG_PARENT_PREQDELETED, .proc/holder_deleted)

/*
Expand All @@ -84,8 +94,9 @@
/datum/component/slippery/proc/on_drop(datum/source, mob/user)
SIGNAL_HANDLER

UnregisterSignal(user, COMSIG_PARENT_PREQDELETED)
RemoveElement(/datum/element/connect_loc, holder, holder_connections)
holder = null
UnregisterSignal(user, COMSIG_MOVABLE_CROSSED)

/*
* The slip proc, but for equipped items.
Expand All @@ -100,6 +111,12 @@
if(holder.body_position == LYING_DOWN && !holder.buckled)
Slip(source, AM)

/datum/component/slippery/UnregisterFromParent()
. = ..()
if(holder)
RemoveElement(/datum/element/connect_loc, holder, holder_connections)
RemoveElement(/datum/element/connect_loc, 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

Expand Down