From e0ff45725ccce908473eabb0a2cc15e4aeb6c2d4 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 24 Mar 2021 14:00:09 +0100 Subject: [PATCH] [MIRROR] [s] Fixing an infinite loop exception with Move() (#4356) * [s] Fixing an infinite loop exception with Move() (#57895) * [s] Fixing an infinite loop exception with Move() Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> --- code/game/atoms_movable.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 60b96b68e99..6f7cbd1a041 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -472,8 +472,8 @@ stop_pulling() else var/pull_dir = get_dir(src, pulling) - //puller and pullee more than one tile away or in diagonal position - if(get_dist(src, pulling) > 1 || (moving_diagonally != SECOND_DIAG_STEP && ((pull_dir - 1) & pull_dir))) + //puller and pullee more than one tile away or in diagonal position and whatever the pullee is pulling isn't already moving from a pull as it'll most likely result in an infinite loop a la ouroborus. + if(!pulling.pulling?.moving_from_pull && (get_dist(src, pulling) > 1 || (moving_diagonally != SECOND_DIAG_STEP && ((pull_dir - 1) & pull_dir)))) pulling.moving_from_pull = src pulling.Move(T, get_dir(pulling, T), glide_size) //the pullee tries to reach our previous position pulling.moving_from_pull = null