Remove newly-introduced jank with diagonal movement (#17883)

This commit is contained in:
moxian
2022-05-28 12:21:23 +01:00
committed by GitHub
parent 7dfb9f15b6
commit 8b9f7c0bd7
+19 -18
View File
@@ -172,7 +172,8 @@
var/atom/oldloc = loc
if(loc != newloc)
glide_for(movetime)
if(movetime > 0)
glide_for(movetime)
if(!(direct & (direct - 1))) //Cardinal move
. = ..(newloc, direct) // don't pass up movetime
else //Diagonal move, split it into cardinal moves
@@ -181,45 +182,45 @@
// The `&& moving_diagonally` checks are so that a forceMove taking
// place due to a Crossed, Bumped, etc. call will interrupt
// the second half of the diagonal movement, or the second attempt
// at a first half if ..() fails because we hit something.
// at a first half if the cardinal Move() fails because we hit something.
if(direct & NORTH)
if(direct & EAST)
if(..(get_step(src, NORTH), NORTH) && moving_diagonally)
if(Move(get_step(src, NORTH), NORTH) && moving_diagonally)
first_step_dir = NORTH
moving_diagonally = SECOND_DIAG_STEP
. = ..(get_step(src, EAST), EAST)
else if(moving_diagonally && ..(get_step(src, EAST), EAST))
. = Move(get_step(src, EAST), EAST)
else if(moving_diagonally && Move(get_step(src, EAST), EAST))
first_step_dir = EAST
moving_diagonally = SECOND_DIAG_STEP
. = ..(get_step(src, NORTH), NORTH)
. = Move(get_step(src, NORTH), NORTH)
else if(direct & WEST)
if(..(get_step(src, NORTH), NORTH) && moving_diagonally)
if(Move(get_step(src, NORTH), NORTH) && moving_diagonally)
first_step_dir = NORTH
moving_diagonally = SECOND_DIAG_STEP
. = ..(get_step(src, WEST), WEST)
else if(moving_diagonally && ..(get_step(src, WEST), WEST))
. = Move(get_step(src, WEST), WEST)
else if(moving_diagonally && Move(get_step(src, WEST), WEST))
first_step_dir = WEST
moving_diagonally = SECOND_DIAG_STEP
. = ..(get_step(src, NORTH), NORTH)
. = Move(get_step(src, NORTH), NORTH)
else if(direct & SOUTH)
if(direct & EAST)
if(..(get_step(src, SOUTH), SOUTH) && moving_diagonally)
if(Move(get_step(src, SOUTH), SOUTH) && moving_diagonally)
first_step_dir = SOUTH
moving_diagonally = SECOND_DIAG_STEP
. = ..(get_step(src, EAST), EAST)
else if(moving_diagonally && ..(get_step(src, EAST), EAST))
. = Move(get_step(src, EAST), EAST)
else if(moving_diagonally && Move(get_step(src, EAST), EAST))
first_step_dir = EAST
moving_diagonally = SECOND_DIAG_STEP
. = ..(get_step(src, SOUTH), SOUTH)
. = Move(get_step(src, SOUTH), SOUTH)
else if(direct & WEST)
if(..(get_step(src, SOUTH), SOUTH) && moving_diagonally)
if(Move(get_step(src, SOUTH), SOUTH) && moving_diagonally)
first_step_dir = SOUTH
moving_diagonally = SECOND_DIAG_STEP
. = ..(get_step(src, WEST), WEST)
else if(moving_diagonally && ..(get_step(src, WEST), WEST))
. = Move(get_step(src, WEST), WEST)
else if(moving_diagonally && Move(get_step(src, WEST), WEST))
first_step_dir = WEST
moving_diagonally = SECOND_DIAG_STEP
. = ..(get_step(src, SOUTH), SOUTH)
. = Move(get_step(src, SOUTH), SOUTH)
if(moving_diagonally == SECOND_DIAG_STEP)
if(!.)
setDir(first_step_dir)