[MIRROR] multiz movement refactor redux [MDB IGNORE] (#9925)

* multiz movement refactor redux (#62132)

* multiz movement refactor redux

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-12-07 08:27:12 -05:00
committed by GitHub
co-authored by Ghom
parent 736de4147d
commit 463c2fc71d
38 changed files with 497 additions and 260 deletions
+14 -16
View File
@@ -64,9 +64,10 @@
SIGNAL_HANDLER
if(leaving == src)
return // Let's not block ourselves.
return //Let's not block ourselves.
if(!isobserver(leaving) && isTerminator() && direction == dir)
leaving.set_currently_z_moving(CURRENTLY_Z_ASCENDING)
INVOKE_ASYNC(src, .proc/stair_ascend, leaving)
leaving.Bump(src)
return COMPONENT_ATOM_BLOCK_EXIT
@@ -80,23 +81,20 @@
icon_state = "stairs[isTerminator() ? "_t" : null]"
return ..()
/obj/structure/stairs/proc/stair_ascend(atom/movable/AM)
/obj/structure/stairs/proc/stair_ascend(atom/movable/climber)
var/turf/checking = get_step_multiz(get_turf(src), UP)
if(!istype(checking))
return
if(!checking.zPassIn(AM, UP, get_turf(src)))
if(!checking.zPassIn(climber, UP, get_turf(src)))
return
var/turf/target = get_step_multiz(get_turf(src), (dir|UP))
if(istype(target) && !target.can_zFall(AM, null, get_step_multiz(target, DOWN))) //Don't throw them into a tile that will just dump them back down.
if(isliving(AM))
var/mob/living/L = AM
var/pulling = L.pulling
if(pulling)
L.pulling.forceMove(target)
L.forceMove(target)
L.start_pulling(pulling)
else
AM.forceMove(target)
if(istype(target) && !climber.can_z_move(DOWN, target, z_move_flags = ZMOVE_FALL_FLAGS)) //Don't throw them into a tile that will just dump them back down.
climber.zMove(target = target, z_move_flags = ZMOVE_STAIRS_FLAGS)
/// Moves anything that's being dragged by src or anything buckled to it to the stairs turf.
climber.pulling?.move_from_pull(climber, loc, climber.glide_size)
for(var/mob/living/buckled as anything in climber.buckled_mobs)
buckled.pulling?.move_from_pull(buckled, loc, buckled.glide_size)
/obj/structure/stairs/vv_edit_var(var_name, var_value)
. = ..()
@@ -132,10 +130,10 @@
if(T && !istype(T))
T.ChangeTurf(/turf/open/openspace, flags = CHANGETURF_INHERIT_AIR)
/obj/structure/stairs/intercept_zImpact(atom/movable/AM, levels = 1)
/obj/structure/stairs/intercept_zImpact(list/falling_movables, levels = 1)
. = ..()
if(isTerminator())
. |= FALL_INTERCEPTED | FALL_NO_MESSAGE
if(levels == 1 && isTerminator()) // Stairs won't save you from a steep fall.
. |= FALL_INTERCEPTED | FALL_NO_MESSAGE | FALL_RETAIN_PULL
/obj/structure/stairs/proc/isTerminator() //If this is the last stair in a chain and should move mobs up
if(terminator_mode != STAIR_TERMINATOR_AUTOMATIC)