From 0f43e1ad8fa6d87c5338a69a4f8c377b1965747d Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 16 Oct 2025 12:26:43 +0100 Subject: [PATCH] Increase zone searching size for initial/end node in pathing --- src/Dodge/Path.hs | 12 +++++++++++- src/Dodge/Room/Tutorial.hs | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Dodge/Path.hs b/src/Dodge/Path.hs index c2ced7ef8..1f578ca52 100644 --- a/src/Dodge/Path.hs +++ b/src/Dodge/Path.hs @@ -12,6 +12,8 @@ module Dodge.Path ( snapToGrid, ) where +import Linear +import Data.List (sortOn) import Data.Set (Set) import qualified Data.Set as Set import Control.Lens @@ -49,7 +51,15 @@ walkableNodeNear :: World -> Point2 -> Maybe Int {-# INLINE walkableNodeNear #-} walkableNodeNear w p = fmap fst . find (flip (isWalkable p) w . snd) $ nodesNear where - nodesNear = zonesExtract (w ^. pnZoning) $ zonesAroundPoint pnZoneSize p + --nodesNear = zonesExtract (w ^. pnZoning) $ zonesAroundPoint pnZoneSize p + nodesNear = zonesExtract (w ^. pnZoning) . snailAround $ zoneOfPoint pnZoneSize p + +snailAround :: Int2 -> [Int2] +snailAround x = fmap (x+) $ smallSnailInt2 + +smallSnailInt2 :: [Int2] +smallSnailInt2 = sortOn (distance (V2 0 (0::Float)) . fmap fromIntegral) + [V2 x y | x <-[-2..2], y <-[-2..2]] makePathBetweenPs :: Point2 -> Point2 -> World -> Maybe [Point2] makePathBetweenPs a b w = mapMaybe (lab $ w ^. cWorld . pathGraph) <$> makePathBetween a b w diff --git a/src/Dodge/Room/Tutorial.hs b/src/Dodge/Room/Tutorial.hs index 4a5cad413..4b6d3cd53 100644 --- a/src/Dodge/Room/Tutorial.hs +++ b/src/Dodge/Room/Tutorial.hs @@ -247,8 +247,8 @@ tutHub = do . (rmInPmnt .:~ (0, a)) . addDoorAtNthLinkToggleTerminal 1 ss j =<< roomNgon 6 100 - --bcor <- treeAttachDeep (return door) <$> blockedCorridor - bcor <- treeAttachDeep (return door) <$> return (return $ cleatOnward door) + bcor <- treeAttachDeep (return door) <$> blockedCorridor + --bcor <- treeAttachDeep (return door) <$> return (return $ cleatOnward door) r1 <- r burstRifle <&> rmPmnts .:~ t r2 <- r (drumMag & itConsumables ?~ 90) --r2 <- r (tinMag & itConsumables ?~ 500)