[MIRROR] Refactors move procs to support multitle objects (#6423)

* Refactors move procs to support multitle objects

* Update _blob.dm

Co-authored-by: Rohesie <rohesie@gmail.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-06-22 22:40:04 +01:00
committed by GitHub
co-authored by Rohesie Gandalf
parent 3d784d4c1e
commit d85a02babd
82 changed files with 349 additions and 300 deletions
+3 -2
View File
@@ -201,11 +201,12 @@
/// Handles searing the feet of whoever walks over this without protection. Only active if the parent is a turf.
/datum/component/acid/proc/on_entered(atom/parent_atom, mob/living/crosser)
/datum/component/acid/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
if(!isliving(crosser))
if(!isliving(arrived))
return
var/mob/living/crosser = arrived
if(crosser.movement_type & FLYING)
return
if(crosser.m_intent & MOVE_INTENT_WALK)
+2 -2
View File
@@ -247,9 +247,9 @@
base_layer = current_aquarium.request_layer(properties.layer_mode)
vc_obj.layer = base_layer
/datum/component/aquarium_content/proc/on_removed(datum/source, atom/movable/mover)
/datum/component/aquarium_content/proc/on_removed(datum/source, atom/movable/gone, direction)
SIGNAL_HANDLER
if(mover != parent)
if(parent != gone)
return
remove_from_aquarium()
+5 -4
View File
@@ -148,13 +148,14 @@
)
AddElement(/datum/element/connect_loc, parent, loc_connections)
/datum/component/butchering/recycler/proc/on_entered(datum/source, mob/living/L)
/datum/component/butchering/recycler/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
if(!istype(L))
if(!isliving(arrived))
return
var/mob/living/victim = arrived
var/obj/machinery/recycler/eater = parent
if(eater.safety_mode || (eater.machine_stat & (BROKEN|NOPOWER))) //I'm so sorry.
return
if(L.stat == DEAD && (L.butcher_results || L.guaranteed_butcher_results))
Butcher(parent, L)
if(victim.stat == DEAD && (victim.butcher_results || victim.guaranteed_butcher_results))
Butcher(parent, victim)
+2 -2
View File
@@ -31,11 +31,11 @@
target_turf = target
START_PROCESSING(SSobj, src) // process on create, in case stuff is still there
/datum/component/chasm/proc/Entered(datum/source, atom/movable/AM)
/datum/component/chasm/proc/Entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
START_PROCESSING(SSobj, src)
drop_stuff(AM)
drop_stuff(arrived)
/datum/component/chasm/process()
if (!drop_stuff())
+1 -1
View File
@@ -104,7 +104,7 @@
if(parent)
REMOVE_TRAIT(parent_as_movable, TRAIT_ELECTRIFIED_BUCKLE, INNATE_TRAIT)
UnregisterSignal(parent, list(COMSIG_MOVABLE_BUCKLE, COMSIG_MOVABLE_UNBUCKLE, COMSIG_ATOM_EXIT, COMSIG_ATOM_TOOL_ACT(TOOL_SCREWDRIVER)))
UnregisterSignal(parent, list(COMSIG_MOVABLE_BUCKLE, COMSIG_ATOM_TOOL_ACT(TOOL_SCREWDRIVER)))
if(requested_signal_parent_emits)
UnregisterSignal(parent, requested_signal_parent_emits)
+2 -2
View File
@@ -435,9 +435,9 @@ Behavior that's still missing from this component that original food items had t
///Ability to feed food to puppers
/datum/component/edible/proc/on_entered(datum/source, mob/user)
/datum/component/edible/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
SEND_SIGNAL(parent, COMSIG_FOOD_CROSSED, user, bitecount)
SEND_SIGNAL(parent, COMSIG_FOOD_CROSSED, arrived, bitecount)
///Response to being used to customize something
/datum/component/edible/proc/used_to_customize(datum/source, atom/customized)
+3 -3
View File
@@ -109,11 +109,11 @@
var/obj/item/I = parent
I.permeability_coefficient = old_permeability
/datum/component/infective/proc/try_infect_crossed(datum/source, atom/movable/M)
/datum/component/infective/proc/try_infect_crossed(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
if(isliving(M))
try_infect(M, BODY_ZONE_PRECISE_L_FOOT)
if(isliving(arrived))
try_infect(arrived, BODY_ZONE_PRECISE_L_FOOT)
/datum/component/infective/proc/try_infect_streak(datum/source, list/directions, list/output_diseases)
SIGNAL_HANDLER
+2 -2
View File
@@ -358,10 +358,10 @@
bodies += L
/// Someone who was originally "under" the grenade has moved off the tile and is now eligible for being a martyr and "covering" it
/datum/component/pellet_cloud/proc/grenade_uncrossed(datum/source, atom/movable/AM)
/datum/component/pellet_cloud/proc/grenade_uncrossed(datum/source, atom/movable/gone, direction)
SIGNAL_HANDLER
bodies -= AM
bodies -= gone
/// Our grenade or landmine or caseless shell or whatever tried deleting itself, so we intervene and nullspace it until we're done here
/datum/component/pellet_cloud/proc/nullspace_parent()
+6 -1
View File
@@ -18,7 +18,7 @@
var/blockers = NONE
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/rot_react,
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
/datum/component/rot/Initialize(delay, scaling, severity)
@@ -113,6 +113,11 @@
SIGNAL_HANDLER
rot_react(source, react_to, pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM))
/// Triggered when something enters the component's parent.
/datum/component/rot/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
rot_react(source, arrived)
///The main bit of logic for the rot component, does a temperature check and has a chance to infect react_to
/datum/component/rot/proc/rot_react(source, mob/living/react_to, target_zone = null)
SIGNAL_HANDLER
+7 -1
View File
@@ -83,7 +83,7 @@
RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, .proc/moved)
RegisterSignal(parent, COMSIG_ATOM_BUMPED, .proc/consume)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/consume,
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, parent, loc_connections)
@@ -129,7 +129,13 @@
return COMPONENT_CANCEL_BLOB_ACT
/// Triggered when something enters the component's parent.
/datum/component/singularity/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
consume(source, arrived)
/datum/component/singularity/proc/consume(datum/source, atom/thing)
SIGNAL_HANDLER
if (thing == parent)
stack_trace("Singularity tried to consume itself.")
return
+7 -6
View File
@@ -47,11 +47,12 @@
* source - the source of the signal
* AM - the atom/movable that is being slipped.
*/
/datum/component/slippery/proc/Slip(datum/source, atom/movable/AM)
/datum/component/slippery/proc/Slip(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
var/mob/victim = AM
if(istype(victim) && !(victim.movement_type & FLYING) && victim.slip(knockdown_time, parent, lube_flags, paralyze_time, force_drop_items) && callback)
if(!isliving(arrived))
return
var/mob/living/victim = arrived
if(!(victim.movement_type & FLYING) && victim.slip(knockdown_time, parent, lube_flags, paralyze_time, force_drop_items) && callback)
callback.Invoke(victim)
/*
@@ -105,11 +106,11 @@
* source - the source of the signal
* AM - the atom/movable that slipped on us.
*/
/datum/component/slippery/proc/Slip_on_wearer(datum/source, atom/movable/AM)
/datum/component/slippery/proc/Slip_on_wearer(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
if(holder.body_position == LYING_DOWN && !holder.buckled)
Slip(source, AM)
Slip(source, arrived)
/datum/component/slippery/UnregisterFromParent()
. = ..()
+4 -4
View File
@@ -87,14 +87,14 @@
else
steps++
/datum/component/squeak/proc/play_squeak_crossed(datum/source, atom/movable/AM)
/datum/component/squeak/proc/play_squeak_crossed(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
if(isitem(AM))
var/obj/item/I = AM
if(isitem(arrived))
var/obj/item/I = arrived
if(I.item_flags & ABSTRACT)
return
if(AM.movement_type & (FLYING|FLOATING) || !AM.has_gravity())
if(arrived.movement_type & (FLYING|FLOATING) || !arrived.has_gravity())
return
var/atom/current_parent = parent
if(isturf(current_parent?.loc))
+2 -2
View File
@@ -467,10 +467,10 @@
return FALSE
return master._removal_reset(thing)
/datum/component/storage/proc/_remove_and_refresh(datum/source, atom/movable/thing)
/datum/component/storage/proc/_remove_and_refresh(datum/source, atom/movable/gone, direction)
SIGNAL_HANDLER
_removal_reset(thing)
_removal_reset(gone)
refresh_mob_views()
//Call this proc to handle the removal of an item from the storage item. The item will be moved to the new_location target, if that is null it's being deleted
+4 -4
View File
@@ -26,10 +26,10 @@
swarm_members = null
return ..()
/datum/component/swarming/proc/join_swarm(datum/source, atom/movable/AM)
/datum/component/swarming/proc/join_swarm(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
var/datum/component/swarming/other_swarm = AM.GetComponent(/datum/component/swarming)
var/datum/component/swarming/other_swarm = arrived.GetComponent(/datum/component/swarming)
if(!other_swarm)
return
swarm()
@@ -37,10 +37,10 @@
other_swarm.swarm()
other_swarm.swarm_members |= src
/datum/component/swarming/proc/leave_swarm(datum/source, atom/movable/AM)
/datum/component/swarming/proc/leave_swarm(datum/source, atom/movable/gone, direction)
SIGNAL_HANDLER
var/datum/component/swarming/other_swarm = AM.GetComponent(/datum/component/swarming)
var/datum/component/swarming/other_swarm = gone.GetComponent(/datum/component/swarming)
if(!other_swarm || !(other_swarm in swarm_members))
return
swarm_members -= other_swarm