Fold in new composing room datatype

This commit is contained in:
2021-11-22 12:46:32 +00:00
parent e185caf157
commit 09e774d009
9 changed files with 166 additions and 144 deletions
+5 -5
View File
@@ -53,25 +53,25 @@ litCorridor90 = do
}
-- | A random length corridor with a destructible block blocking it.
longBlockedCorridor :: RandomGen g => State g (Tree (Either Room Room))
longBlockedCorridor :: RandomGen g => State g (SubCompTree Room)
longBlockedCorridor = do
r <- state $ randomR (0,pi)
n <- state $ randomR (0,3)
let plmnts = [sPS (V2 20 40) r $ dirtPoly $ square 10
,sPS (V2 20 15) 0 putLamp
]
sequence $ treeFromPost (replicate n $ Left <$> randomiseOutLinks corridor)
$ return $ Right $ set rmPmnts plmnts corridor
sequence $ treeFromPost (replicate n $ PassDown <$> randomiseOutLinks corridor)
$ return $ UseAll $ set rmPmnts plmnts corridor
-- | A single corridor with a destructible block blocking it.
blockedCorridor :: RandomGen g => State g (Tree (Either Room Room))
blockedCorridor :: RandomGen g => State g (SubCompTree Room)
blockedCorridor = do
r <- state $ randomR (0,pi)
let plmnts =
[sPS (V2 20 40) r $ dirtPoly $ square 10
,spanLightI (V2 0 15) (V2 40 15)
]
sequence $ treeFromPost [] $ return $ Right $ set rmPmnts plmnts corridor
sequence $ treeFromPost [] $ return $ UseAll $ set rmPmnts plmnts corridor
dirtPoly :: [Point2] -> PSType
dirtPoly = PutBlock DirtBlock [1] dirtWall . reverse