From 21c218542c4e602fb22b6b6fd529307ff3e8f457 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 20 Nov 2021 16:39:35 -0500 Subject: fix(gs/xanthous): Check for reaching destination in AI 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 Tested-by: BuildkiteCI --- users/grfn/xanthous/src/Xanthous/AI/Gormlak.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'users') diff --git a/users/grfn/xanthous/src/Xanthous/AI/Gormlak.hs b/users/grfn/xanthous/src/Xanthous/AI/Gormlak.hs index 59be5383de..629798da3c 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 -- cgit 1.4.1