Add pathing infrastructure

This commit is contained in:
2022-06-30 23:33:48 +01:00
parent 3dfa6926cc
commit 56b063544c
13 changed files with 130 additions and 45 deletions
+5 -3
View File
@@ -22,7 +22,7 @@ import qualified IntMapHelp as IM
import Tile
import RandomHelp
import Data.Graph.Inductive (labNodes)
import Data.Graph.Inductive (labNodes,labEdges)
import Data.List (nubBy)
import Data.Traversable
import Control.Lens
@@ -46,8 +46,10 @@ generateLevelFromRoomList gr' w = initWallZoning
, _pathGraph = path
, _pathGraphP = pairPath
}
& phZoning %~ \zn -> foldl' (flip $ updateZoning (:)) (zn & znObjects .~ mempty)
(labNodes (_pgGraph path))
& pnZoning %~ (\zn -> foldl' (flip $ updateZoning (:)) (zn & znObjects .~ mempty)
(labNodes (_pgGraph path)))
& peZoning %~ (\zn -> foldl' (flip $ updateZoning (:)) (zn & znObjects .~ mempty)
(labEdges (_pgGraph path)))
where
path = pairsToGraph'' pairPath
pairPath = foldMap _rmPath rs