Make "tanks" into Blocks

This commit is contained in:
2022-06-18 23:28:17 +01:00
parent cc93fc83d7
commit bae0f7dcad
10 changed files with 38 additions and 19 deletions
+3 -2
View File
@@ -28,8 +28,8 @@ addBlock (p:ps) wl bl w = w
& walls %~ IM.union panes
& blocks %~ IM.insert blid bl
{_blID = blid,_blWallIDs = IS.fromList is, _blShadows=[]
, _blFootprint = p:ps, _blPos = centroid (p:ps), _blDraw = const mempty
, _blDeath = makeBlockDebris}
, _blFootprint = p:ps
}
where
blid = IM.newKey $ _blocks w
lns = zip (p:ps) (ps ++ [p])
@@ -85,6 +85,7 @@ placeLineBlock basePane blockWidth depth a b gw = ( 0
insertBlock (i,p) = over blocks $ IM.insert (i+blid) Block
{ _blID = i + blid, _blWallIDs = IS.fromList $ ksAtI i
, _blHP = 1000, _blShadows = shadowsAt i
, _blRot = 0 -- THIS IS NOT SENSIBLE. TODO rethink block positioning
, _blFootprint = cornersAt p -- TODO check winding (clockwise, anticlockwise)
, _blPos = p, _blDraw = const mempty , _blDeath = makeBlockDebris}
insertBlocks = flip (foldr insertBlock) $ zip is blockCenPs