Allow for destruction of blocks again
This commit is contained in:
@@ -64,8 +64,10 @@ zonedBlockWalls = concatMap f . IM.toList . _znObjects . _wallsZone
|
|||||||
g (y,zs) = show y
|
g (y,zs) = show y
|
||||||
|
|
||||||
testStringInit :: World -> [String]
|
testStringInit :: World -> [String]
|
||||||
|
testStringInit _ = []
|
||||||
--testStringInit w = map (show . _blWallIDs) . IM.elems $ _blocks w
|
--testStringInit w = map (show . _blWallIDs) . IM.elems $ _blocks w
|
||||||
testStringInit w = (map (f w) . filter g . IM.elems $ _walls w)
|
--testStringInit w = (map (f w) . filter g . IM.elems $ _walls w)
|
||||||
|
-- ++ map (show . fst) (IM.toList $ _znObjects $ _wallsZone w)
|
||||||
-- ++ zonedBlockWalls w
|
-- ++ zonedBlockWalls w
|
||||||
where
|
where
|
||||||
g Block{} = True
|
g Block{} = True
|
||||||
|
|||||||
+6
-5
@@ -85,16 +85,17 @@ updateBlocks w = foldr f w $ _blocks w
|
|||||||
where
|
where
|
||||||
f bl w'
|
f bl w'
|
||||||
| head (_blHPs bl) < 1 = w'
|
| head (_blHPs bl) < 1 = w'
|
||||||
& blocks %~ IM.delete (_blID bl)
|
|
||||||
& walls %~ removeIDs (_blWallIDs bl)
|
& walls %~ removeIDs (_blWallIDs bl)
|
||||||
-- & flip (foldr removeFromZone) (_blWallIDs bl)
|
& flip (foldr removeFromZone) (_blWallIDs bl)
|
||||||
|
& blocks %~ IM.delete (_blID bl)
|
||||||
| otherwise = w'
|
| otherwise = w'
|
||||||
removeIDs is wls = foldr IM.delete wls is
|
removeIDs is wls = foldr IM.delete wls is
|
||||||
--removeFromZone wlid w' = over (wallsZone . znObjects . ix x . ix y) (IM.delete (_wlID wl)) w'
|
removeFromZone wlid w' = over (wallsZone . znObjects . ix x . ix y) (IM.delete (_wlID wl)) w'
|
||||||
removeFromZone wlid w' = over (wallsZone . znObjects . ix x . ix y . ix (_wlID wl)) setCol w'
|
--removeFromZone wlid w' = set (wallsZone . znObjects) IM.empty w'
|
||||||
|
--removeFromZone wlid w' = over (wallsZone . znObjects . ix x . ix y . ix (_wlID wl)) setCol w'
|
||||||
where
|
where
|
||||||
(x,y) = zoneOfPoint $ uncurry pHalf (_wlLine wl)
|
(x,y) = zoneOfPoint $ uncurry pHalf (_wlLine wl)
|
||||||
wl = _walls w' IM.! wlid
|
wl = _walls w IM.! wlid
|
||||||
setCol = wlColor .~ V4 1 1 0 1
|
setCol = wlColor .~ V4 1 1 0 1
|
||||||
|
|
||||||
-- | Note the explict use of record syntax. Using lens creates a space leak.
|
-- | Note the explict use of record syntax. Using lens creates a space leak.
|
||||||
|
|||||||
Reference in New Issue
Block a user