Add log when generating layout
This commit is contained in:
+43
-22
@@ -130,14 +130,18 @@ rot90Around cen p = cen +.+ vNormal (p -.- cen)
|
||||
|
||||
-- So, the idea is to attach outer children to the bottommost right nodes
|
||||
-- inside an inner tree
|
||||
roomMiniIntro :: RandomGen g => State g (SubCompTree Room)
|
||||
roomMiniIntro :: RandomGen g => State g (LabSubCompTree Room)
|
||||
roomMiniIntro = do
|
||||
midroom <- join $ takeOne [miniTree2] --,glassLesson]
|
||||
return $ chainUses [return $ UseAll corridor,return $ UseAll corridor,return $ UseAll corridor,return $ UseAll door, midroom,return $ UseAll corridor]
|
||||
(return $ chainUses
|
||||
[return $ UseAll corridor,return $ UseAll corridor,return $ UseAll corridor,return $ UseAll door, midroom,return $ UseAll corridor]
|
||||
) <&> (,TreeSubLabelling "roomMiniIntro" Nothing)
|
||||
|
||||
roomCenterPillar :: RandomGen g => State g Room
|
||||
roomCenterPillar = shuffleLinks . restrictInLinks ((\p -> dist p (V2 120 0) < 10) . fst)
|
||||
$ set rmPmnts plmnts $ roomRect 240 240 2 2
|
||||
$ set rmPmnts plmnts
|
||||
$ set rmName "roomCenterPillar"
|
||||
$ roomRect 240 240 2 2
|
||||
where
|
||||
plmnts =
|
||||
[ blockLine (V2 115 115) (V2 115 125)
|
||||
@@ -196,7 +200,7 @@ weaponEmptyRoom = do
|
||||
$ restrictRMInLinksPD f (roomRect w h 2 2 & rmPmnts .~ plmnts)
|
||||
return $ treeFromTrunk [PassDown corridor] (singleUseAll rm )
|
||||
|
||||
weaponUnderCrits :: RandomGen g => Int -> State g (SubCompTree Room)
|
||||
weaponUnderCrits :: RandomGen g => Int -> State g (LabSubCompTree Room)
|
||||
weaponUnderCrits i = do
|
||||
let plmnts =
|
||||
[--sPS (V2 20 0) 0 $ RandPS randFirstWeapon
|
||||
@@ -204,23 +208,36 @@ weaponUnderCrits i = do
|
||||
,sPS (V2 20 20) ( pi/2) randC1
|
||||
]
|
||||
addwpat p = rmPmnts .:~ PickOnePlacement i (sPS p 0 $ RandPS randFirstWeapon)
|
||||
let continuationRoom = treeFromTrunk
|
||||
let continuationRoom = treeFromTrunk
|
||||
[PassDown $ addwpat (V2 20 0) corridorN,PassDown $ addwpat (V2 20 0) corridorN]
|
||||
(singleUseAll (set rmPmnts plmnts corridorN))
|
||||
rcp <- roomCenterPillar
|
||||
rcp <- roomCenterPillar
|
||||
rmpils <- roomPillars 30 240 240 2 2
|
||||
deadEndRoom' <- takeOne
|
||||
[ addwpat (V2 120 20) rmpils
|
||||
, addwpat (V2 120 20) rcp]
|
||||
junctionRoom <- takeOne [PassDown tEast,PassDown tWest]
|
||||
return $ treeFromTrunk
|
||||
--[PassDown $ corridorN & rmPmnts .:~ mntLightLnkCond (resetPLUse $ rprBool $ \rp _ -> isInLnk rp)
|
||||
[PassDown corridorN
|
||||
,PassDown corridorN]
|
||||
$ Node junctionRoom
|
||||
[continuationRoom
|
||||
,singleUseNone deadEndRoom'
|
||||
]
|
||||
let thetree = treeFromTrunk
|
||||
--[PassDown $ corridorN & rmPmnts .:~ mntLightLnkCond (resetPLUse $ rprBool $ \rp _ -> isInLnk rp)
|
||||
[PassDown corridorN
|
||||
,PassDown corridorN]
|
||||
$ Node junctionRoom
|
||||
[continuationRoom
|
||||
,singleUseNone deadEndRoom'
|
||||
]
|
||||
return thetree
|
||||
<&> (, TreeSubLabelling ("weaponUnderCrits "++show i) (Just $ fmap composingNodeName thetree))
|
||||
|
||||
composingNodeName :: ComposingNode Room -> TreeSubLabelling
|
||||
composingNodeName cn = case cn of
|
||||
PassDown rm -> f $ _rmName rm ++ "-PassDown"
|
||||
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
|
||||
|
||||
weaponBehindPillar :: RandomGen g => State g (SubCompTree Room)
|
||||
weaponBehindPillar = do
|
||||
@@ -285,18 +302,21 @@ deadEndRoom = defaultRoom
|
||||
, _rmPath = []
|
||||
, _rmPmnts = [sPS (V2 0 (-10)) 0 putLamp]
|
||||
, _rmBound = [rectNSWE 20 (-20) (-30) 30]
|
||||
, _rmName = "deadEndRoom"
|
||||
}
|
||||
where
|
||||
lnks = [(V2 0 30 ,0) ]
|
||||
{- A random Either tree with a weapon and melee monster challenge. -}
|
||||
weaponRoom :: RandomGen g => Int -> State g (SubCompTree Room, String)
|
||||
weaponRoom :: RandomGen g => Int -> State g (LabSubCompTree Room)
|
||||
weaponRoom i = join $ takeOne
|
||||
[ weaponEmptyRoom <&> (, "weaponEmptyRoom")
|
||||
, weaponUnderCrits i<&> (, "weaponUnderCrits")
|
||||
, weaponBehindPillar<&> (, "weaponBehindPillar")
|
||||
, weaponBetweenPillars<&> (, "weaponBetweenPillars")
|
||||
, weaponLongCorridor<&> (, "weaponLongCorridor")
|
||||
[ weaponEmptyRoom <&> (,f "weaponEmptyRoom")
|
||||
, weaponUnderCrits i
|
||||
, weaponBehindPillar<&> (,f "weaponBehindPillar")
|
||||
, weaponBetweenPillars<&> (,f "weaponBetweenPillars")
|
||||
, weaponLongCorridor<&> (,f "weaponLongCorridor")
|
||||
]
|
||||
where
|
||||
f str = TreeSubLabelling str Nothing
|
||||
|
||||
roomCCrits :: RandomGen g => State g Room
|
||||
roomCCrits = roomC 200 200
|
||||
@@ -392,7 +412,7 @@ pistolerRoom = pillarGrid
|
||||
]
|
||||
++)
|
||||
|
||||
shootingRange :: RandomGen g => State g (SubCompTree Room)
|
||||
shootingRange :: RandomGen g => State g (LabSubCompTree Room)
|
||||
shootingRange = do
|
||||
rm1 <- shootersRoom1 >>= randomiseAllLinks . restrictInLinks (\(V2 _ y,_) -> y < 40)
|
||||
. restrictOutLinks (\(V2 _ y,r) -> y > 200 && r /= 0)
|
||||
@@ -402,7 +422,7 @@ shootingRange = do
|
||||
rm3 <- shootersRoom >>= randomiseAllLinks
|
||||
. restrictInLinks (\(V2 x y,_) -> y < 10 && x > 20 && x < 180)
|
||||
. restrictOutLinks (\(_,r) -> r == 0)
|
||||
return $ treeFromPost
|
||||
(return $ treeFromPost
|
||||
[PassDown rm1
|
||||
,PassDown $ roomPadCut (rectNSWE 40 (-40) (-80) 80) (V2 0 20)
|
||||
& rmPmnts %~ (spanLightI (V2 (-80) 10) (V2 80 10) :)
|
||||
@@ -411,6 +431,7 @@ shootingRange = do
|
||||
& rmPmnts %~ (spanLightI (V2 (-80) 10) (V2 80 10) :)
|
||||
]
|
||||
(UseAll rm3)
|
||||
) <&> (,TreeSubLabelling "shootingRange" Nothing)
|
||||
|
||||
spawnerRoom :: RandomGen g => State g (SubCompTree Room)
|
||||
spawnerRoom = do
|
||||
|
||||
Reference in New Issue
Block a user