Apply different damage amounts to different materials

This commit is contained in:
2025-10-24 10:08:36 +01:00
parent b2265297b5
commit 9a3c642684
4 changed files with 72 additions and 65 deletions
+6 -6
View File
@@ -13,17 +13,17 @@ damageWall :: Damage -> Wall -> World -> World
damageWall dt wl w = case _wlStructure wl of
MachinePart mcid -> w' & cWorld . lWorld . machines . ix mcid . mcDamage .:~ dt
BlockPart blid ->
w' & cWorld . lWorld . blocks . ix blid . blHP -~ x
w' & cWorld . lWorld . blocks . ix blid . blHP -~ dmam
& maybeDestroyBlock blid
DoorPart drid ->
w' & cWorld . lWorld . doors . ix drid . drHP -~ x
w' & cWorld . lWorld . doors . ix drid . drHP -~ dmam
-- & maybeDestroyDoor drid
_ -> w'
where
x = case dt of
Explosive y _ -> y * 100
_ -> dt ^. dmAmount
w' = damMatSideEffect dt (_wlMaterial wl) (Right wl) w
-- x = case dt of
-- Explosive y _ -> y * 100
-- _ -> dt ^. dmAmount
(dmam,w') = damMatSideEffect dt (_wlMaterial wl) (Right wl) w
-- block destruction is convoluted...
maybeDestroyBlock :: Int -> World -> World