about summary refs log tree commit diff
path: root/users/grfn/xanthous/src
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-11-20T21·39-0500
committergrfn <grfn@gws.fyi>2021-11-20T21·49+0000
commit21c218542c4e602fb22b6b6fd529307ff3e8f457 (patch)
tree0e3a545014717d36f623eea56c96c99e3de16f8e /users/grfn/xanthous/src
parented0447ea0d246c576b66dc38910106831300ed82 (diff)
fix(gs/xanthous): Check for reaching destination in AI r/3077
Because floating points, it's possible that a creature has reached their
destination even if the *progress* to that destination is at 0 - if that
happens, they should pick a new destination regardless. This fixes the
issue where creatures would occasionally get "stuck" and never move
after wandering around for a bit.

Change-Id: I01a11ce4bd448c25a818c886825e4fad56dffe03
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3885
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/grfn/xanthous/src')
-rw-r--r--users/grfn/xanthous/src/Xanthous/AI/Gormlak.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/users/grfn/xanthous/src/Xanthous/AI/Gormlak.hs b/users/grfn/xanthous/src/Xanthous/AI/Gormlak.hs
index 59be5383de55..629798da3c52 100644
--- a/users/grfn/xanthous/src/Xanthous/AI/Gormlak.hs
+++ b/users/grfn/xanthous/src/Xanthous/AI/Gormlak.hs
@@ -87,6 +87,7 @@ stepGormlak ticks pe@(Positioned pos creature) = do
         else pure pe
 
   dest <- maybe (selectDestination pos creature) pure
+         . mfilter (\(Destination p _) -> p /= pos)
          $ creature ^. field @"_hippocampus" . destination
   let progress' =
         dest ^. destinationProgress