Update pathing on block destruction without relying on _blObstructs

This commit is contained in:
2025-10-24 10:34:27 +01:00
parent 9a3c642684
commit c39f99e146
6 changed files with 181 additions and 158 deletions
+12 -12
View File
@@ -4,7 +4,7 @@
module Dodge.Update (updateUniverse) where
import Dodge.Zoning.Base
import Dodge.Path
--import Dodge.Path
import Data.Foldable
import qualified Data.Set as S
import Color
@@ -309,17 +309,17 @@ updateAimPos u =
u & uvWorld . cWorld . lWorld . lAimPos
.~ mouseWorldPos (u ^. uvWorld . input) (u ^. uvWorld . wCam)
updateEdgesWall :: S.Set (Int,Int) -> World -> World
updateEdgesWall = flip $ foldl' updateEdgeWallObs
updateEdgeWallObs :: World -> (Int,Int) -> World
updateEdgeWallObs w (i,j) = fromMaybe w $ do
s <- getNodePos i w
e <- getNodePos j w
let wlflags = foldMap (^. _2 . wlPathFlag) $ wlsHitUnsorted s e w
return $ w & cWorld . incGraph %~ updateEdge (f wlflags) (i,j)
where
f x _ = S.map WallObstacle x
--updateEdgesWall :: S.Set (Int,Int) -> World -> World
--updateEdgesWall = flip $ foldl' updateEdgeWallObs
--
--updateEdgeWallObs :: World -> (Int,Int) -> World
--updateEdgeWallObs w (i,j) = fromMaybe w $ do
-- s <- getNodePos i w
-- e <- getNodePos j w
-- let wlflags = foldMap (^. _2 . wlPathFlag) $ wlsHitUnsorted s e w
-- return $ w & cWorld . incGraph %~ updateEdge (f wlflags) (i,j)
-- where
-- f x _ = S.map WallObstacle x
updateDoors :: World -> World
updateDoors w = let (is,w') = foldrM updateDoor w (w ^. cWorld . lWorld . doors)