Add fallback placement for falled link based placement spots
This commit is contained in:
+33
-39
@@ -78,24 +78,6 @@ roomPillars = over rmLinks init $ set rmPS plmnts $ roomRect 240 240 2 2
|
||||
branchWith :: Room -> [Tree Room] -> Tree (Either Room Room)
|
||||
branchWith r ts = Node (Left r) $ return (Right door) : fmap (fmap Left) ts
|
||||
|
||||
glassSwitchBack :: RandomGen g => State g Room
|
||||
glassSwitchBack = do
|
||||
wth <- state $ randomR (200,400)
|
||||
hgt <- state $ randomR (400,600)
|
||||
wllen <- state $ randomR (60,wth/2-40)
|
||||
let hf = hgt/5
|
||||
let plmnts =
|
||||
[windowLine (V2 (wth-60 ) hf ) (V2 wllen hf )
|
||||
,windowLine (V2 (wth-wllen) (2*hf)) (V2 60 (2*hf))
|
||||
,windowLine (V2 (wth-60 ) (3*hf)) (V2 wllen (3*hf))
|
||||
,windowLine (V2 (wth-wllen) (4*hf)) (V2 60 (4*hf))
|
||||
,blockLine (V2 0 (1*hf)) (V2 wllen (1*hf))
|
||||
,blockLine (V2 (wth-wllen) (2*hf)) (V2 wth (2*hf))
|
||||
,blockLine (V2 0 (3*hf)) (V2 wllen (3*hf))
|
||||
,blockLine (V2 (wth-wllen) (4*hf)) (V2 wth (4*hf))
|
||||
, sPS (V2 (wth/2) (hgt/2)) 0 putLamp
|
||||
]
|
||||
return $ set rmPS plmnts $ roomRect wth hgt 2 6
|
||||
|
||||
manyDoors :: Int -> Tree (Either Room Room)
|
||||
manyDoors i = treeFromPost (replicate i (Left door)) $ Right door
|
||||
@@ -128,33 +110,45 @@ glassLesson = do
|
||||
]
|
||||
]
|
||||
|
||||
glassSwitchback1 :: RandomGen g => State g Room
|
||||
glassSwitchback1 = do
|
||||
glassSwitchBack :: RandomGen g => State g Room
|
||||
glassSwitchBack = do
|
||||
wth <- state $ randomR (200,400)
|
||||
hgt <- state $ randomR (400,600)
|
||||
wllen <- state $ randomR (60,wth/2-40)
|
||||
let hf = hgt/5
|
||||
cry <- randomRanges [--50+2*hf,30+3*hf
|
||||
50+3*hf,30+4*hf
|
||||
,50+4*hf,30+5*hf
|
||||
]
|
||||
crx <- state $ randomR (wllen,wth-(wllen+40))
|
||||
let plmnts = [windowLine (V2 (wth-60) ( 40+hf)) (V2 wllen (40+hf))
|
||||
,windowLine (V2 (wth-wllen) (40+2*hf)) (V2 60 (40+2*hf))
|
||||
,windowLine (V2 (wth-60) ( 40+3*hf)) (V2 wllen (40+3*hf))
|
||||
,windowLine (V2 (wth-wllen) (40+4*hf)) (V2 60 (40+4*hf))
|
||||
,sPS (V2 crx cry) 0 $ PutCrit miniGunCrit
|
||||
,sPS (V2 (wth-20) (hgt/2+40)) 0 randC1
|
||||
,sPS (V2 (wth/2) (hgt/2)) 0 putLamp
|
||||
,blockLine (V2 0 ( 40+1*hf)) (V2 wllen (40+1*hf))
|
||||
,blockLine (V2 (wth-wllen) ( 40+2*hf)) (V2 wth (40+2*hf))
|
||||
,blockLine (V2 0 ( 40+3*hf)) (V2 wllen (40+3*hf))
|
||||
,blockLine (V2 (wth-wllen) ( 40+4*hf)) (V2 wth (40+4*hf))
|
||||
]
|
||||
return $ set rmPS plmnts $ shiftRoomBy (V2 0 40,0) $ roomRect wth hgt 2 4
|
||||
con1 (V2 _ y,_) = y < 0.5*hgt
|
||||
plmnts =
|
||||
[ mntLightLnkCond con1
|
||||
, mntLightLnkCond (not . con1)
|
||||
,windowLine (V2 (wth-60 ) hf ) (V2 wllen hf )
|
||||
,windowLine (V2 (wth-wllen) (2*hf)) (V2 60 (2*hf))
|
||||
,windowLine (V2 (wth-60 ) (3*hf)) (V2 wllen (3*hf))
|
||||
,windowLine (V2 (wth-wllen) (4*hf)) (V2 60 (4*hf))
|
||||
,blockLine (V2 0 (1*hf)) (V2 wllen (1*hf))
|
||||
,blockLine (V2 (wth-wllen) (2*hf)) (V2 wth (2*hf))
|
||||
,blockLine (V2 0 (3*hf)) (V2 wllen (3*hf))
|
||||
,blockLine (V2 (wth-wllen) (4*hf)) (V2 wth (4*hf))
|
||||
, sPS (V2 (wth/2) (hgt/2)) 0 putLamp
|
||||
]
|
||||
let northPSs = do
|
||||
cry <- randomRanges [3*hf+10,4*hf-10
|
||||
,4*hf+10,5*hf-10
|
||||
]
|
||||
crx <- state $ randomR (wllen,wth-(wllen+40))
|
||||
return (V2 crx cry,1.5*pi)
|
||||
midPS = return (V2 (wth-20) (hgt/2+40), pi)
|
||||
return $ roomRect wth hgt 2 4
|
||||
& rmPS .~ plmnts
|
||||
& rmRandPSs .~ [northPSs,midPS]
|
||||
|
||||
glassSwitchBackCrits :: RandomGen g => State g Room
|
||||
glassSwitchBackCrits = glassSwitchBack
|
||||
<&> rmPS %~ ([Placement (PSRoomRand 0) (PutCrit miniGunCrit) (const Nothing)
|
||||
, Placement (PSRoomRand 1) randC1 (const Nothing)
|
||||
] ++)
|
||||
|
||||
miniTree2 :: RandomGen g => State g (Tree (Either Room Room))
|
||||
miniTree2 = glassSwitchback1
|
||||
miniTree2 = glassSwitchBackCrits
|
||||
>>= randomiseOutLinks
|
||||
>>= changeLinkTo (\p -> (sndV2 . fst) p < 70)
|
||||
<&> flip branchWith (replicate 3 $ treeFromPost [door,corridor] critInDeadEnd)
|
||||
|
||||
Reference in New Issue
Block a user