Add or annotations
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ roomTreex = do
|
||||
struct' <- aTreeStrut
|
||||
let struct = Node [EndRoom] []
|
||||
let t' = padCorridors struct
|
||||
t = treeTrunk [[StartRoom],[Corridor],[FirstWeapon],[Corridor]] t'
|
||||
t = treeTrunk [[StartRoom],[OrAno [[DoorAno],[Corridor]] ],[FirstWeapon],[Corridor]] t'
|
||||
fmap (shiftExpandTree . expandTreeBy id) $ mapM annoToRoomTree t
|
||||
|
||||
levx :: RandomGen g => State g [Room]
|
||||
|
||||
@@ -21,9 +21,11 @@ data Annotation
|
||||
= Lock Int
|
||||
| Key Int
|
||||
| Corridor
|
||||
| DoorAno
|
||||
| FirstWeapon
|
||||
| StartRoom
|
||||
| EndRoom
|
||||
| OrAno [[Annotation]]
|
||||
|
||||
addLock :: RandomGen g => Int -> Tree [Annotation] -> State g (Tree [Annotation])
|
||||
addLock i t = do
|
||||
@@ -41,7 +43,11 @@ randomPadCorridors (Node x xs) = do
|
||||
return $ treeTrunk (replicate n [Corridor]) (Node x xs')
|
||||
|
||||
annoToRoomTree :: RandomGen g => [Annotation] -> State g (Tree (Either Room Room))
|
||||
annoToRoomTree [OrAno as] = do
|
||||
a <- takeOne as
|
||||
annoToRoomTree a
|
||||
annoToRoomTree [Corridor] = fmap (pure . Right) $ randomiseOutLinks corridor
|
||||
annoToRoomTree [DoorAno] = fmap (\r -> Node (Left door) [(pure . Right) r]) (randomiseOutLinks corridor)
|
||||
annoToRoomTree [FirstWeapon] = do
|
||||
branchWP <- branchRectWith weaponRoom
|
||||
blockedC <- blockedCorridor
|
||||
|
||||
Reference in New Issue
Block a user