diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 6c4720f3b5..6e48bc503d 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -157,36 +157,47 @@ . = ..() else //Diagonal move, split it into cardinal moves moving_diagonally = FIRST_DIAG_STEP - if (direct & 1) - if (direct & 4) + var/first_step_dir + if (direct & NORTH) + if (direct & EAST) if (step(src, NORTH)) + first_step_dir = NORTH moving_diagonally = SECOND_DIAG_STEP . = step(src, EAST) else if (step(src, EAST)) + first_step_dir = EAST moving_diagonally = SECOND_DIAG_STEP . = step(src, NORTH) - else if (direct & 8) + else if (direct & WEST) if (step(src, NORTH)) + first_step_dir = NORTH moving_diagonally = SECOND_DIAG_STEP . = step(src, WEST) else if (step(src, WEST)) + first_step_dir = WEST moving_diagonally = SECOND_DIAG_STEP . = step(src, NORTH) - else if (direct & 2) - if (direct & 4) + else if (direct & SOUTH) + if (direct & EAST) if (step(src, SOUTH)) + first_step_dir = SOUTH moving_diagonally = SECOND_DIAG_STEP . = step(src, EAST) else if (step(src, EAST)) + first_step_dir = EAST moving_diagonally = SECOND_DIAG_STEP . = step(src, SOUTH) - else if (direct & 8) + else if (direct & WEST) if (step(src, SOUTH)) + first_step_dir = SOUTH moving_diagonally = SECOND_DIAG_STEP . = step(src, WEST) else if (step(src, WEST)) + first_step_dir = WEST moving_diagonally = SECOND_DIAG_STEP . = step(src, SOUTH) + if(!. && moving_diagonally == SECOND_DIAG_STEP) + setDir(first_step_dir) moving_diagonally = 0 return