Move wall damages to external position

This commit is contained in:
2022-06-19 15:05:12 +01:00
parent f2d6504634
commit a7e6d6f3cc
14 changed files with 47 additions and 18 deletions
+5 -4
View File
@@ -7,13 +7,14 @@ module Dodge.Wall.Damage
) where
import Dodge.Data
import LensHelp
import Dodge.Wall.DamageEffect
damageWall :: Damage -> Wall -> World -> World
damageWall dt wl = case _wlStructure wl of
MachinePart mcid -> _wlDamageEff wl dt wl . (machines . ix mcid . mcDamage .:~ dt)
BlockPart blid -> _wlDamageEff wl dt wl . (blocks . ix blid %~ damageBlockWith dt)
CreaturePart crid f -> f dt wl crid
_ -> _wlDamageEff wl dt wl
MachinePart mcid -> defaultWallDamage dt wl . (machines . ix mcid . mcDamage .:~ dt)
BlockPart blid -> defaultWallDamage dt wl . (blocks . ix blid %~ damageBlockWith dt)
-- CreaturePart crid f -> f dt wl crid
_ -> defaultWallDamage dt wl
damageBlockWith :: Damage -> Block -> Block
damageBlockWith dm = case _dmType dm of