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 18:55:37 -03:00
committed by GitHub
parent 3f244b211d
commit e03cd1aada
83 changed files with 350 additions and 301 deletions
@@ -261,10 +261,10 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999))
icon_state = base_icon_state
return ..()
/turf/open/space/bluespace/Entered(atom/movable/A)
/turf/open/space/bluespace/Entered(atom/movable/arrived, direction)
. = ..()
if(parentSphere && A.forceMove(get_turf(parentSphere)))
do_sparks(3, FALSE, get_turf(A))
if(parentSphere && arrived.forceMove(get_turf(parentSphere)))
do_sparks(3, FALSE, get_turf(arrived))
/turf/closed/indestructible/hoteldoor
name = "Hotel Door"
@@ -358,11 +358,11 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999))
var/datum/turf_reservation/reservation
var/turf/storageTurf
/area/hilbertshotel/Entered(atom/movable/AM)
/area/hilbertshotel/Entered(atom/movable/arrived, direction)
. = ..()
if(istype(AM, /obj/item/hilbertshotel))
relocate(AM)
var/list/obj/item/hilbertshotel/hotels = AM.get_all_contents_type(/obj/item/hilbertshotel)
if(istype(arrived, /obj/item/hilbertshotel))
relocate(arrived)
var/list/obj/item/hilbertshotel/hotels = arrived.get_all_contents_type(/obj/item/hilbertshotel)
for(var/obj/item/hilbertshotel/H in hotels)
if(parentSphere == H)
relocate(H)
@@ -395,10 +395,10 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999))
to_chat(M, span_danger("[H] almost implodes in upon itself, but quickly rebounds, shooting off into a random point in space!"))
H.forceMove(targetturf)
/area/hilbertshotel/Exited(atom/movable/AM)
/area/hilbertshotel/Exited(atom/movable/gone, direction)
. = ..()
if(ismob(AM))
var/mob/M = AM
if(ismob(gone))
var/mob/M = gone
if(M.mind)
var/stillPopulated = FALSE
var/list/currentLivingMobs = get_all_contents_type(/mob/living) //Got to catch anyone hiding in anything
@@ -446,16 +446,16 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999))
var/roomNumber
var/obj/item/hilbertshotel/parentSphere
/obj/item/abstracthotelstorage/Entered(atom/movable/AM, atom/oldLoc)
/obj/item/abstracthotelstorage/Entered(atom/movable/arrived, direction)
. = ..()
if(ismob(AM))
var/mob/M = AM
if(ismob(arrived))
var/mob/M = arrived
M.notransform = TRUE
/obj/item/abstracthotelstorage/Exited(atom/movable/AM, atom/newLoc)
/obj/item/abstracthotelstorage/Exited(atom/movable/gone, direction)
. = ..()
if(ismob(AM))
var/mob/M = AM
if(ismob(gone))
var/mob/M = gone
M.notransform = FALSE
//Space Ruin stuff