This commit is contained in:
2025-11-09 15:41:19 +00:00
parent 5a40eac4e2
commit 6f3632d495
4 changed files with 231 additions and 261 deletions
+3 -3
View File
@@ -14,9 +14,9 @@ import qualified IntMapHelp as IM
unshadowBlock :: World -> Int -> World
unshadowBlock w wlid = w & cWorld . lWorld . walls . ix wlid . wlUnshadowed .~ True
destroyBlock :: S.Set Int2 -> Block -> World -> (S.Set Int2,World)
destroyBlock is bl w =
(js<>is,w
destroyBlock :: Block -> World -> (S.Set Int2,World)
destroyBlock bl w =
(js,w
& flip (foldl' unshadowBlock) (_blShadows bl)
& makeBlockDebris bl
& deleteWallIDs wlids
+1 -9
View File
@@ -253,18 +253,10 @@ drawInspectWalls w = concat $ do
)
drawInspectWall :: World -> Wall -> Picture
drawInspectWall _ wl =
setLayer DebugLayer $
color rose (thickLine 3 [a, b])
-- <> foldMap (drawDoorPaths w) (wl ^? wlStructure . wsDoor)
drawInspectWall _ wl = setLayer DebugLayer $ color rose (thickLine 3 [a, b])
where
(a, b) = _wlLine wl
--drawDoorPaths :: World -> Int -> Picture
--drawDoorPaths w drid = concat $ do
-- paths <- w ^? cWorld . lWorld . doors . ix drid . drObstructs
-- return $ foldMap' (drawPathEdge . (^. penPathEdge)) paths
drawPathEdge :: Point2 -> Point2 -> S.Set EdgeObstacle -> Picture
drawPathEdge x y pe = setLayer DebugLayer $ multiArrow x y green (S.map obstacleColor pe)
+13 -15
View File
@@ -25,31 +25,29 @@ import qualified Data.Set as S
-- maybeDestroyDoor should rather happen during the door mechanism update
damageWall :: Damage -> Wall -> (S.Set Int2,World) -> (S.Set Int2,World)
damageWall dt wl (is,w) = case _wlStructure wl of
MachinePart mcid -> f $ w' & cWorld . lWorld . machines . ix mcid . mcDamage .:~ dt
MachinePart mcid -> (,) is $ w' & cWorld . lWorld . machines . ix mcid . mcDamage .:~ dt
BlockPart blid ->
w' & cWorld . lWorld . blocks . ix blid . blHP -~ dmam
& maybeDestroyBlock is blid
& maybeDestroyBlock blid
& _1 <>~ is
DoorPart drid _ ->
w' & cWorld . lWorld . doors . ix drid . drHP -~ dmam
& maybeDestroyDoor is drid
_ -> f w'
& maybeDestroyDoor drid
& _1 <>~ is
_ -> (is, w')
where
f = (,) is
-- x = case dt of
-- Explosive y _ -> y * 100
-- _ -> dt ^. dmAmount
(dmam,w') = damMatSideEffect dt (_wlMaterial wl) (Right wl) w
-- block destruction is convoluted...
maybeDestroyBlock :: S.Set Int2 -> Int -> World -> (S.Set Int2,World)
maybeDestroyBlock is blid w = case w ^? cWorld . lWorld . blocks . ix blid of
Just bl | _blHP bl < 1 -> destroyBlock is bl w
_ -> (is,w)
maybeDestroyBlock :: Int -> World -> (S.Set Int2,World)
maybeDestroyBlock blid w = case w ^? cWorld . lWorld . blocks . ix blid of
Just bl | _blHP bl < 1 -> destroyBlock bl w
_ -> (mempty,w)
maybeDestroyDoor :: S.Set Int2 -> Int -> World -> (S.Set Int2, World)
maybeDestroyDoor is drid w = case w ^? cWorld . lWorld . doors . ix drid of
maybeDestroyDoor :: Int -> World -> (S.Set Int2, World)
maybeDestroyDoor drid w = case w ^? cWorld . lWorld . doors . ix drid of
Just dr | _drHP dr < 1 -> destroyDoor dr w
_ -> (is,w)
_ -> (mempty,w)
destroyDoor :: Door -> World -> (S.Set Int2, World)
destroyDoor dr w =
+214 -234
View File
File diff suppressed because it is too large Load Diff