From f6b92eeed037fa035b1a5ded2618cf1dc5d40173 Mon Sep 17 00:00:00 2001 From: BeeLover <78232749+BeeLover66@users.noreply.github.com> Date: Sat, 21 Oct 2023 16:04:32 -0400 Subject: [PATCH] Replaces inconsistent implementations of the square root of 2 --- code/__DEFINES/maths.dm | 2 -- code/datums/components/riding.dm | 2 +- code/modules/mob/mob_movement.dm | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm index f3d432443c1d1..08b2b394468b3 100644 --- a/code/__DEFINES/maths.dm +++ b/code/__DEFINES/maths.dm @@ -8,8 +8,6 @@ #define INFINITY 1e31 //closer then enough #define SYSTEM_TYPE_INFINITY 1.#INF //only for isinf check -#define SQRT_TWO 1.414214 - #define SHORT_REAL_LIMIT 16777216 /// A 32 bit single-precision floating point number's mantissa gives us 7 significant digits diff --git a/code/datums/components/riding.dm b/code/datums/components/riding.dm index 207ce050c812d..242abbd32dea9 100644 --- a/code/datums/components/riding.dm +++ b/code/datums/components/riding.dm @@ -163,7 +163,7 @@ Unbuckle(user) return - if(world.time < last_vehicle_move + ((last_move_diagonal? SQRT_TWO : 1) * vehicle_move_delay * vehicle_move_multiplier)) + if(world.time < last_vehicle_move + ((last_move_diagonal? sqrt(2) : 1) * vehicle_move_delay * vehicle_move_multiplier)) return last_vehicle_move = world.time diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index a6da7b3262de3..431773a32edc7 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -140,7 +140,7 @@ . = ..() if((direct & (direct - 1)) && mob.loc == n) //moved diagonally successfully - add_delay *= 1.414214 // sqrt(2) + add_delay *= sqrt(2) // Record any time that we gained due to sub-tick slowdown var/move_delta = move_delay - floored_move_delay add_delay += move_delta