Add objects based on walls, called machines

This commit is contained in:
2021-10-31 22:55:02 +00:00
parent 08fa84c1fd
commit 86fdfd260e
23 changed files with 183 additions and 90 deletions
+3 -3
View File
@@ -6,9 +6,9 @@ import Dodge.Data
import Control.Lens
damageBlocksBy :: Int -> Wall -> World -> World
damageBlocksBy x wl = case _wlBlockID wl of
Just' blid -> blocks . ix blid . blHPs %~ reduceHeadBy x
Nothing' -> id
damageBlocksBy x wl = case wl ^? wlStructure . wlStBlock of
Just blid -> blocks . ix blid . blHPs %~ reduceHeadBy x
Nothing -> id
where
reduceHeadBy y (z:zs) = z - y : zs
reduceHeadBy _ [] = []
+1 -2
View File
@@ -10,7 +10,6 @@ import Dodge.Creature.State.Data
import Geometry
import Data.Bifunctor
import Data.Maybe
import Control.Lens
type HitCreatureEffect = Particle -> Point2 -> Creature -> World -> World
@@ -67,7 +66,7 @@ penWalls
penWalls crEff wlEff pt hitThings w = case hitThings of
[] -> ( w, mvPt pt)
((p,Left cr):_) -> (crEff pt p cr w, destroyAt p pt)
((p,Right wl):hs) | isJust (wl ^? wlBlockID)
((p,Right wl):hs) | _wlFireThrough wl
-> first (wlEff pt p wl) $ penWalls crEff wlEff pt hs w
((p,Right wl):_) -> (wlEff pt p wl w, destroyAt p pt)