From f1ff4848df76909f2e296fd36718cf3a7f3d4989 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 24 Jan 2023 21:25:19 +0100 Subject: [PATCH] [MIRROR] Removes SQRT_2 and its usages [MDB IGNORE] (#18940) * Removes SQRT_2 and its usages (#72913) Signed-off-by: GitHub ## About The Pull Request ## Why It's Good For The Game Resolves #72534 ## Changelog Signed-off-by: GitHub * Update mod_pai.dm Signed-off-by: GitHub Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> --- code/__DEFINES/maths.dm | 1 - code/modules/mob/mob_movement.dm | 4 ++-- code/modules/mod/mod_ai.dm | 2 +- modular_skyrat/modules/modsuit_pai/code/mod_pai.dm | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm index 5adb1a5f6ec..f5b44b0f00f 100644 --- a/code/__DEFINES/maths.dm +++ b/code/__DEFINES/maths.dm @@ -16,7 +16,6 @@ #define NUM_E 2.71828183 -#define SQRT_2 1.414214 //CLOSE ENOUGH! #define PI 3.1416 #define INFINITY 1e31 //closer then enough diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index a07a241db13..ff0705fd867 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -125,7 +125,7 @@ //We are now going to move var/add_delay = mob.cached_multiplicative_slowdown - var/new_glide_size = DELAY_TO_GLIDE_SIZE(add_delay * ( (NSCOMPONENT(direct) && EWCOMPONENT(direct)) ? SQRT_2 : 1 ) ) + var/new_glide_size = DELAY_TO_GLIDE_SIZE(add_delay * ( (NSCOMPONENT(direct) && EWCOMPONENT(direct)) ? sqrt(2) : 1 ) ) mob.set_glide_size(new_glide_size) // set it now in case of pulled objects //If the move was recent, count using old_move_delay //We want fractional behavior and all @@ -143,7 +143,7 @@ . = ..() if((direct & (direct - 1)) && mob.loc == new_loc) //moved diagonally successfully - add_delay *= SQRT_2 + add_delay *= sqrt(2) var/after_glide = 0 if(visual_delay) diff --git a/code/modules/mod/mod_ai.dm b/code/modules/mod/mod_ai.dm index c0f2aabc683..2312f048740 100644 --- a/code/modules/mod/mod_ai.dm +++ b/code/modules/mod/mod_ai.dm @@ -77,7 +77,7 @@ /obj/item/mod/control/relaymove(mob/user, direction) if((!active && wearer) || get_charge() < CHARGE_PER_STEP || user != ai || !COOLDOWN_FINISHED(src, cooldown_mod_move) || (wearer?.pulledby?.grab_state > GRAB_PASSIVE)) return FALSE - var/timemodifier = MOVE_DELAY * (ISDIAGONALDIR(direction) ? SQRT_2 : 1) * (wearer ? WEARER_DELAY : LONE_DELAY) + var/timemodifier = MOVE_DELAY * (ISDIAGONALDIR(direction) ? sqrt(2) : 1) * (wearer ? WEARER_DELAY : LONE_DELAY) if(wearer && !wearer.Process_Spacemove(direction)) return FALSE else if(!wearer && (!has_gravity() || !isturf(loc))) diff --git a/modular_skyrat/modules/modsuit_pai/code/mod_pai.dm b/modular_skyrat/modules/modsuit_pai/code/mod_pai.dm index 0f61322b3bd..0732d1dd459 100644 --- a/modular_skyrat/modules/modsuit_pai/code/mod_pai.dm +++ b/modular_skyrat/modules/modsuit_pai/code/mod_pai.dm @@ -91,7 +91,7 @@ return FALSE if(wearer && (wearer.pulledby?.grab_state || wearer.incapacitated() || wearer.stat)) return FALSE - var/timemodifier = MOVE_DELAY * (ISDIAGONALDIR(direction) ? SQRT_2 : 1) * (wearer ? WEARER_DELAY : LONE_DELAY) + var/timemodifier = MOVE_DELAY * (ISDIAGONALDIR(direction) ? sqrt(2) : 1) * (wearer ? WEARER_DELAY : LONE_DELAY) COOLDOWN_START(src, cooldown_mod_move, movedelay * timemodifier + slowdown) playsound(src, 'sound/mecha/mechmove01.ogg', 25, TRUE) core.subtract_charge(CELL_PER_STEP)