PORT: Makes diagonal movement euclidean (#63058)

This commit is contained in:
Gandalf
2021-11-26 12:06:21 -08:00
committed by GitHub
parent 925e4a428e
commit 73a4acad95
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -4,6 +4,8 @@
#define NUM_E 2.71828183
#define SQRT_2 1.414214 //CLOSE ENOUGH!
#define PI 3.1416
#define INFINITY 1e31 //closer then enough
+2 -2
View File
@@ -122,7 +122,7 @@
//We are now going to move
var/add_delay = mob.cached_multiplicative_slowdown
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay * ( (NSCOMPONENT(direct) && EWCOMPONENT(direct)) ? 2 : 1 ) )) // set it now in case of pulled objects
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay * ( (NSCOMPONENT(direct) && EWCOMPONENT(direct)) ? SQRT_2 : 1 ) )) // set it now in case of pulled objects
if(old_move_delay + (add_delay*MOVEMENT_DELAY_BUFFER_DELTA) + MOVEMENT_DELAY_BUFFER > world.time)
move_delay = old_move_delay
else
@@ -144,7 +144,7 @@
. = ..()
if((direct & (direct - 1)) && mob.loc == new_loc) //moved diagonally successfully
add_delay *= 2
add_delay *= SQRT_2
mob.set_glide_size(DELAY_TO_GLIDE_SIZE(add_delay))
move_delay += add_delay
if(.) // If mob is null here, we deserve the runtime