Move wall damages to external position
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user