Make obstacles block pathing

This commit is contained in:
2022-06-30 23:59:07 +01:00
parent 56b063544c
commit ed33b4ff2b
7 changed files with 18 additions and 37 deletions
+9 -4
View File
@@ -30,7 +30,7 @@ import Geometry.ConvexPoly
--import Data.Foldable
import qualified Data.IntMap.Strict as IM -- Lazy?
import qualified Data.Map.Strict as M
import qualified Data.Set as Set
--import qualified Data.Set as Set
import Control.Lens
import Data.Maybe
import qualified Streaming.Prelude as S
@@ -113,21 +113,26 @@ debugDraw' cfig w bl = case bl of
Walls_info -> Right $ drawWlIDs cfig w
Pathing -> Right $ drawPathing cfig w
Show_nodes_near_select -> Right $ drawNodesNearSelect w
Show_path_between -> Right $ drawPathBetween w
drawCreatureDisplayTexts :: World -> Picture
drawCreatureDisplayTexts w = foldMap (creatureDisplayText w) (_creatures w)
drawPathBetween :: World -> Picture
drawPathBetween w = color yellow
$ foldMap (arrowPath . mapMaybe (`getNodePos` w)) (makePathBetween sp ep w)
where
sp = _lSelect w
ep = _rSelect w
drawNodesNearSelect :: World -> Picture
drawNodesNearSelect w = setLayer DebugLayer $
runIdentity (S.foldMap_ (drawZone pnZoneSize) (zoneAroundPoint pnZoneSize sp))
<> color red (foldMap (drawCross . snd) $ nodesNearL sp w)
<> color green (drawCross sp)
<> color cyan (foldMap (drawCross . snd) $ walkableNodeNear sp w)
<> color yellow (foldMap (arrowPath . mapMaybe (`getNodePos` w)) (makePathBetween sp ep w))
where
sp = _lSelect w
ep = _rSelect w
drawInspectWalls :: World -> Picture
drawInspectWalls w = foldMap (drawInspectWall w)