Commit before changing block type

This commit is contained in:
2021-10-19 21:11:02 +01:00
parent 982c8d81e1
commit d136fd910c
3 changed files with 16 additions and 5 deletions
+7 -5
View File
@@ -100,13 +100,15 @@ addBlock
-> [Int] -- ^ Extra layers of health
-> World
-> World
addBlock (p:ps) hp col isSeeThrough degradability w
| hp <= 0 && null degradability = w
| hp <= 0 = addBlock (p:ps) (head degradability + hp) col isSeeThrough (tail degradability) w
addBlock (p:ps) hp col isSeeThrough hps w
| hp <= 0 && null hps = w
| hp <= 0 = addBlock (p:ps) (head hps + hp) col isSeeThrough (tail hps) w
| otherwise = w
& wallsZone . znObjects %~ flip (IM.foldl' $ flip wallInZone) panes
& walls %~ IM.union panes
& walls %~ IM.union panes
& blocks %~ IM.insert blid (Block' {_blID = blid,_blWallIDs = is, _blHPs = hp:hps, _blShadows'=[]})
where
blid = IM.newKey $ _blocks w
lns = zip (p:ps) (ps ++ [p])
i = IM.newKey $ _walls w
is = [i.. i + length lns-1]
@@ -121,7 +123,7 @@ addBlock (p:ps) hp col isSeeThrough degradability w
, _wlIsSeeThrough = isSeeThrough
, _blVisible = True
, _blShadows = []
, _blDegrades = degradability
, _blDegrades = hps
, _wlDraw = True
, _wlRotateTo = True
}