Refactors move procs to support multitle objects (#59658)

Enter(), Entered(), Exit() and Exited() all passed the old loc forward, but everything except a single a case cared about the direction of the movement more than about the specific source.
Since moving multi-tile objects will have multiple sources of movement but a single direction, this change makes it easier to track their movement.

Cleaned up a lot of code around and made proc inputs compatible.

I'll add opacity support for multi-tile objects in a different PR after this is merged, as this has grown large enough and I don't want to compromise the reviewability.

Tested this locally and as expected it didn't impair movement nor produced any runtimes.
This commit is contained in:
Rohesie
2021-06-20 14:55:37 -07:00
committed by GitHub
parent 3f244b211d
commit e03cd1aada
83 changed files with 350 additions and 301 deletions
@@ -140,11 +140,11 @@
M.emote("cough")
return TRUE
/obj/effect/particle_effect/smoke/bad/proc/on_entered(datum/source, atom/movable/AM, oldloc)
/obj/effect/particle_effect/smoke/bad/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
if(istype(AM, /obj/projectile/beam))
var/obj/projectile/beam/B = AM
B.damage = (B.damage/2)
if(istype(arrived, /obj/projectile/beam))
var/obj/projectile/beam/beam = arrived
beam.damage *= 0.5
/datum/effect_system/smoke_spread/bad
effect_type = /obj/effect/particle_effect/smoke/bad
+4 -4
View File
@@ -52,13 +52,13 @@
/obj/effect/portal/attack_tk(mob/user)
return
/obj/effect/portal/proc/on_entered(atom/newloc, atom/movable/entering_movable, atom/oldloc)
/obj/effect/portal/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
if(isobserver(entering_movable))
if(isobserver(arrived))
return
if(linked && (get_turf(oldloc) == get_turf(linked)))
if(linked && (get_step(source, REVERSE_DIR(direction)) == get_turf(linked)))
return
teleport(entering_movable)
teleport(arrived)
/obj/effect/portal/attack_hand(mob/user, list/modifiers)
. = ..()
+1 -1
View File
@@ -113,7 +113,7 @@
)
AddElement(/datum/element/connect_loc, src, loc_connections)
/obj/effect/abstract/proximity_checker/proc/on_uncrossed(datum/source, atom/movable/AM)
/obj/effect/abstract/proximity_checker/proc/on_uncrossed(datum/source, atom/movable/gone, direction)
SIGNAL_HANDLER
return