diff --git a/code/__DEFINES/math.dm b/code/__DEFINES/math.dm index b255027d60d..c638e5ad8e0 100644 --- a/code/__DEFINES/math.dm +++ b/code/__DEFINES/math.dm @@ -1,6 +1,6 @@ #define NUM_E 2.71828183 - #define PI 3.1415 +#define SQRT_2 1.41421356237 #define INFINITY 1e31 //closer than enough #define SHORT_REAL_LIMIT 16777216 diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 7fbdfcab2df..76cb23938e3 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -182,14 +182,15 @@ if(!(direct & (direct - 1))) // cardinal direction . = mob.SelfMove(n, direct, delay) - else // diagonal movements take twice as long - . = mob.SelfMove(n, direct, delay * 2) + else // diagonal movements take longer + var/diag_delay = delay * SQRT_2 + . = mob.SelfMove(n, direct, diag_delay) if(mob.loc == n) // only incur the extra delay if the move was *actually* diagonal // There would be a bit of visual jank if we try to walk diagonally next to a wall // and the move ends up being cardinal, rather than diagonal, // but that's better than it being jank on every *successful* diagonal move. - delay *= 2 + delay = diag_delay move_delay += delay if(prev_pulling_loc && mob.pulling?.face_while_pulling && (mob.pulling.loc != prev_pulling_loc))