From 74e5327e97d592e56b257dff64c4bb29bc7f347a Mon Sep 17 00:00:00 2001 From: AnturK Date: Thu, 18 Jan 2018 09:33:27 +0100 Subject: [PATCH] Fixes the diagonal sliding --- code/game/atoms_movable.dm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 6c4720f3b53..6e48bc503de 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