Start to migrate all old level generation to MetaTrees

This commit is contained in:
2022-06-12 19:31:57 +01:00
parent 617765d5d4
commit dbba78ef05
9 changed files with 57 additions and 93 deletions
+7 -21
View File
@@ -192,7 +192,7 @@ weaponEmptyRoom = do
$ restrictRMInLinksPD f (roomRect w h 2 2 & rmPmnts .~ plmnts)
return $ treeFromTrunk [ corridor] (pure $ cleatOnward rm )
weaponUnderCrits :: RandomGen g => Int -> State g (LabTree Room)
weaponUnderCrits :: RandomGen g => Int -> State g (MetaTree Room)
weaponUnderCrits i = do
let plmnts =
[--sPS (V2 20 0) 0 $ RandPS randFirstWeapon
@@ -211,19 +211,7 @@ weaponUnderCrits i = do
junctionRoom <- takeOne [ tEast, tWest]
let thetree = treeFromTrunk [ corridorN , corridorN]
$ Node junctionRoom [continuationRoom ,pure deadEndRoom' ]
return (toOnward "weaponUnderCrits" , thetree )
-- TODO addSubmessages
--composingNodeName :: ComposingNode Room -> TreeSubLabelling
--composingNodeName cn = case cn of
-- rm -> f $ _rmName rm ++ "-"
-- SplitDown rm -> f $ _rmName rm ++ "-SplitDown"
-- useAll rm -> f $ _rmName rm ++ "-useAll"
-- UseSome is rm -> f $ _rmName rm ++ "-" ++ show is ++ "-UseSome"
-- UseNone rm -> f $ _rmName rm ++ "-UseNone"
-- useLabel i rm -> f $ _rmName rm ++ "-" ++ show i ++ "-useLabel"
-- where
-- f str = TreeSubLabelling str Nothing
rToOnward "weaponUnderCrits" thetree
weaponBehindPillar :: RandomGen g => State g (Tree Room)
weaponBehindPillar = do
@@ -291,16 +279,14 @@ deadEndRoom = defaultRoom
where
lnks = [(V2 0 30 ,0) ]
{- A random Either tree with a weapon and melee monster challenge. -}
weaponRoom :: RandomGen g => Int -> State g (LabTree Room)
weaponRoom :: RandomGen g => Int -> State g (MetaTree Room)
weaponRoom i = join $ takeOne
[ weaponEmptyRoom <&> f "weaponEmptyRoom"
[ weaponEmptyRoom >>= rToOnward "weaponEmptyRoom"
, weaponUnderCrits i
, weaponBehindPillar <&> f "weaponBehindPillar"
, weaponBetweenPillars <&> f "weaponBetweenPillars"
, weaponLongCorridor <&> f "weaponLongCorridor"
, weaponBehindPillar >>= rToOnward "weaponBehindPillar"
, weaponBetweenPillars >>= rToOnward "weaponBetweenPillars"
, weaponLongCorridor >>= rToOnward "weaponLongCorridor"
]
where
f str = ( toOnward str ,)
roomCCrits :: RandomGen g => State g Room
roomCCrits = roomC 200 200