Add objects based on walls, called machines
This commit is contained in:
@@ -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 _ [] = []
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user