Skip to content

Commit

Permalink
[s] Fixing an infinite loop exception with Move() (#57895)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghommie committed Mar 24, 2021
1 parent 1fe83be commit e165969
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e165969

Please sign in to comment.