Fix bugs in zones near segments

This commit is contained in:
2025-10-27 00:03:57 +00:00
parent c641cbaa69
commit aa82519e05
10 changed files with 319 additions and 172 deletions
+6 -3
View File
@@ -1,5 +1,6 @@
--{-# LANGUAGE TupleSections #-}
module Dodge.Path (
nodesNear,
pointTowardsImpulse,
makePathBetween,
makePathBetweenPs,
@@ -72,9 +73,11 @@ pathEdgeObstructed pe = any (`Set.member` pe) [WallObstacle WallNotAutoOpen, Cha
walkableNodeNear :: World -> Point2 -> Maybe Int
{-# INLINE walkableNodeNear #-}
walkableNodeNear w p = fmap fst . find (flip (isWalkable p) w . snd) $ nodesNear
where
nodesNear = zonesExtract (w ^. incNodeZoning) . snailAround $ zoneOfPoint pnZoneSize p
walkableNodeNear w p = fmap fst . find (flip (isWalkable p) w . snd) $ nodesNear w p
-- where
-- nodesNear = zonesExtract (w ^. incNodeZoning) . snailAround $ zoneOfPoint pnZoneSize p
nodesNear w p = zonesExtract (w ^. incNodeZoning) . snailAround $ zoneOfPoint pnZoneSize p
snailAround :: Int2 -> [Int2]
snailAround x = (x +) <$> smallSnailInt2