Improve machines, tweak wall ids
This commit is contained in:
@@ -15,6 +15,7 @@ import Color
|
||||
|
||||
import Control.Lens
|
||||
import Data.List
|
||||
import qualified Data.IntSet as IS
|
||||
|
||||
addBlock
|
||||
:: [Point2] -- ^ Block polygon
|
||||
@@ -30,7 +31,7 @@ addBlock (p:ps) hp col opacity hps w
|
||||
| otherwise = w
|
||||
& wallsZone . znObjects %~ flip (IM.foldl' $ flip wallInZone) panes
|
||||
& walls %~ IM.union panes
|
||||
& blocks %~ IM.insert blid (Block {_blID = blid,_blWallIDs = is, _blHPs = hp:hps, _blShadows=[]})
|
||||
& blocks %~ IM.insert blid (Block {_blID = blid,_blWallIDs = IS.fromList is, _blHPs = hp:hps, _blShadows=[]})
|
||||
where
|
||||
blid = IM.newKey $ _blocks w
|
||||
lns = zip (p:ps) (ps ++ [p])
|
||||
@@ -87,7 +88,7 @@ placeLineBlock basePane blockWidth depth a b w = (,) 0
|
||||
k = IM.newKey $ _walls w
|
||||
blid = IM.newKey $ _blocks w
|
||||
insertBlock i = over blocks $ IM.insert (i+blid) Block
|
||||
{_blID = i + blid, _blWallIDs = ksAtI i, _blHPs = [5,5], _blShadows = shadowsAt i}
|
||||
{_blID = i + blid, _blWallIDs = IS.fromList $ ksAtI i, _blHPs = [5,5], _blShadows = shadowsAt i}
|
||||
insertBlocks = flip (foldr insertBlock) is
|
||||
ksAtI i = map ( + (k + i*4) ) [0,1,2,3]
|
||||
visibilityAt i
|
||||
|
||||
@@ -24,6 +24,7 @@ import Data.List
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
import Data.Graph.Inductive hiding ((&))
|
||||
import qualified Data.IntSet as IS
|
||||
|
||||
-- probably don't have to rebuild the entire graph, oh well
|
||||
addButtonDoor :: Color -> Point2 -> Float -> Point2 -> Point2 -> Float -> World -> (Int, World)
|
||||
@@ -58,7 +59,7 @@ putDoor col cond pss w = (drid, addWalls w & doors %~ addDoor)
|
||||
drid = IM.newKey $ _doors w
|
||||
addDoor = IM.insert drid $ Door
|
||||
{ _drID = drid
|
||||
, _drWallIDs = wlids
|
||||
, _drWallIDs = IS.fromList wlids
|
||||
, _drStatus = DoorInt 0
|
||||
, _drTrigger = cond
|
||||
, _drMech = doorMechanismStepwise nsteps drid wlids pss
|
||||
@@ -136,7 +137,7 @@ putSingleDoor isPathable col cond a b speed w = (drid, addWalls w
|
||||
drid = IM.newKey $ _doors w
|
||||
addDoor = IM.insert drid $ Door
|
||||
{ _drID = drid
|
||||
, _drWallIDs = wlids
|
||||
, _drWallIDs = IS.fromList wlids
|
||||
, _drStatus = DoorClosed
|
||||
, _drTrigger = cond
|
||||
, _drMech = doorMechanism drid speed (zip3 wlids shiftedPairs pairs)
|
||||
|
||||
Reference in New Issue
Block a user