This commit is contained in:
2024-10-22 11:22:38 +01:00
parent 65f05b93f8
commit 9e3d8ae6b0
8 changed files with 425 additions and 407 deletions
+15 -10
View File
@@ -1,15 +1,19 @@
module Dodge.Block where
module Dodge.Block (
splinterBlock,
destroyBlock,
destroyDoor,
) where
import Control.Monad
import Data.Set (Set)
import Dodge.Data.MountedObject
import Control.Lens
import Control.Monad
import Data.Foldable
import qualified Data.Graph.Inductive as FGL
import qualified Data.IntSet as IS
import Data.Maybe
import Data.Set (Set)
import Dodge.Base.Collide
import Dodge.Block.Debris
import Dodge.Data.MountedObject
import Dodge.Data.World
import Dodge.DrWdWd
import Dodge.LightSource
@@ -44,10 +48,10 @@ unshadowBlock w wlid = case w ^? cWorld . lWorld . walls . ix wlid of
& insertWallInZones (wl & wlUnshadowed .~ True)
Nothing -> w
checkBlockHP :: Block -> World -> World
checkBlockHP bl
| _blHP bl < 1 = destroyBlock bl
| otherwise = id
--checkBlockHP :: Block -> World -> World
--checkBlockHP bl
-- | _blHP bl < 1 = destroyBlock bl
-- | otherwise = id
destroyBlock :: Block -> World -> World
destroyBlock bl w =
@@ -74,8 +78,9 @@ maybeClearPath :: World -> PathEdgeNodes -> World
maybeClearPath w (PathEdgeNodes x y pe)
| not . null $ overlapSegWalls (_peStart pe) (_peEnd pe) $ wlsNearSeg (_peStart pe) (_peEnd pe) w =
w
| otherwise = w
& cWorld . pathGraph %~ FGL.insEdge (x, y, pe & peObstacles .~ mempty) . FGL.delEdge (x, y)
| otherwise =
w
& cWorld . pathGraph %~ FGL.insEdge (x, y, pe & peObstacles .~ mempty) . FGL.delEdge (x, y)
destroyDoor :: Door -> World -> World
destroyDoor dr w =