Start to implement lock and key system
This commit is contained in:
+25
-25
@@ -164,12 +164,12 @@ glassSwitchBack = do
|
||||
return $ set rmPS plmnts $ roomRect wth hgt 2 6
|
||||
|
||||
manyDoors :: Int -> Tree (Either Room Room)
|
||||
manyDoors i = treePost (replicate i (Left door)) $ Right door
|
||||
manyDoors i = treeFromPost (replicate i (Left door)) $ Right door
|
||||
|
||||
glassLesson :: RandomGen g => State g (Tree (Either Room Room))
|
||||
glassLesson = do
|
||||
corridors <- sequence $ replicate 3 $ fmap Left $ randomiseOutLinks corridor
|
||||
return $ Node (Left $ botRoom) [deadRoom door,uppers, treePost (Left door : corridors) $ Right door]
|
||||
return $ Node (Left $ botRoom) [deadRoom door,uppers, treeFromPost (Left door : corridors) $ Right door]
|
||||
where uppers = Node (Left door) [deadRoom topRoom]
|
||||
botRoom = set rmPS botplmnts
|
||||
$ roomRect 200 200 1 1
|
||||
@@ -212,7 +212,7 @@ miniRoom1 = do
|
||||
|
||||
miniTree2 :: RandomGen g => State g (Tree (Either Room Room))
|
||||
miniTree2 = miniRoom1 >>= randomiseOutLinks >>= changeLinkTo (\p -> (snd . fst) p < 70)
|
||||
>>= return . flip branchWith (replicate 3 $ treePost [door,corridor]
|
||||
>>= return . flip branchWith (replicate 3 $ treeFromPost [door,corridor]
|
||||
critInDeadEnd )
|
||||
|
||||
miniRoom3 :: RandomGen g => State g (Tree (Either Room Room))
|
||||
@@ -252,7 +252,7 @@ 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 (Tree (Either Room Room))
|
||||
roomMiniIntro = fmap (g . expandTreeBy f) $ sequence $ treePost
|
||||
roomMiniIntro = fmap (g . expandTreeBy f) $ sequence $ treeFromPost
|
||||
[return $ connectRoom door
|
||||
,join $ takeOne [miniTree2,glassLesson]
|
||||
-- ,join $ takeOne [miniRoom1]
|
||||
@@ -298,22 +298,22 @@ allPairs xs = [(x,y) | x <- xs, y <- xs, x /= y]
|
||||
randomCorridorFrom :: RandomGen g => [a] -> State g (Tree (Either a a))
|
||||
randomCorridorFrom xs = do
|
||||
rooms <- sequence $ replicate 5 $ takeOne xs
|
||||
return $ treeTrunk (map Left $ init rooms) (Node (Right (last rooms)) [])
|
||||
|
||||
return $ treeFromTrunk (map Left $ init rooms) (Node (Right (last rooms)) [])
|
||||
|
||||
{-
|
||||
Probabilites of the type of the first floor weapon.
|
||||
-}
|
||||
randFirstWeapon :: State StdGen PSType
|
||||
randFirstWeapon = do
|
||||
-- r <- state $ randomR (-pi,pi)
|
||||
takeOne $ map PutFlIt
|
||||
[ pistol
|
||||
, ltAutoGun
|
||||
-- , autoGun
|
||||
, spreadGun
|
||||
, multGun
|
||||
, launcher
|
||||
-- , lasGun
|
||||
-- , flamer
|
||||
]
|
||||
takeOne $ map PutFlIt $
|
||||
replicate 10 pistol
|
||||
++ replicate 5 ltAutoGun
|
||||
++ replicate 5 spreadGun
|
||||
++ replicate 5 multGun
|
||||
++ replicate 2 autoGun
|
||||
++ [launcher]
|
||||
++ [lasGun]
|
||||
++ [flamer]
|
||||
|
||||
--randC1 :: State StdGen PSType
|
||||
randC1 = RandPS $ takeOne $ map PutCrit $ (armourChaseCrit : replicate 50 chaseCrit)
|
||||
@@ -341,13 +341,13 @@ weaponUnderCrits = do
|
||||
,PS (20,0) (0-pi/2) $ randC1
|
||||
,PS (20,20) (0-pi/2) $ randC1
|
||||
]
|
||||
let continuationRoom = treeTrunk [Left corridorN,Left corridorN]
|
||||
let continuationRoom = treeFromTrunk [Left corridorN,Left corridorN]
|
||||
(connectRoom (set rmPS plmnts $ corridorN))
|
||||
rcp' <- roomCenterPillar
|
||||
let rcp = over rmPS ( PS (120,80) 0 putLamp : ) rcp'
|
||||
deadEndRoom <- takeOne [roomPillars,rcp]
|
||||
junctionRoom <- takeOne [Left tEast,Left tWest]
|
||||
return $ treeTrunk [Left corridorN,Left corridorN]
|
||||
return $ treeFromTrunk [Left corridorN,Left corridorN]
|
||||
$ Node junctionRoom
|
||||
[continuationRoom
|
||||
,deadRoom deadEndRoom
|
||||
@@ -362,7 +362,7 @@ weaponBehindPillar = do
|
||||
,PS crPos (d crPos) $ randC1
|
||||
]
|
||||
rcp <- roomCenterPillar
|
||||
return $ treeTrunk [Left door
|
||||
return $ treeFromTrunk [Left door
|
||||
,Left $ over rmLinks tail $ over rmPS (++ plmnts1) rcp]
|
||||
(connectRoom $ set rmPS [PS (20,60) (0-pi/2) $ randC1]
|
||||
$ corridorN)
|
||||
@@ -389,7 +389,7 @@ blockedCorridor = do
|
||||
$ reverse $ rectNSWE 10 (-10) (-10) 10
|
||||
,PS (20,15) 0 $ putLamp
|
||||
]
|
||||
sequence $ treePost (replicate n $ fmap Left $ randomiseOutLinks corridor)
|
||||
sequence $ treeFromPost (replicate n $ fmap Left $ randomiseOutLinks corridor)
|
||||
$ fmap Right $ return $ set rmPS plmnts corridor
|
||||
|
||||
weaponLongCorridor :: RandomGen g => State g (Tree (Either Room Room))
|
||||
@@ -401,8 +401,8 @@ weaponLongCorridor = do
|
||||
]
|
||||
i1 <- state $ randomR (2,5)
|
||||
i2 <- state $ randomR (2,5)
|
||||
let branch1 = treeTrunk (replicate i1 $ Left corridorN) (connectRoom $ putCrs connectingRoom)
|
||||
let branch2 = treeTrunk (replicate i2 $ Left corridorN) (deadRoom $ putWp corridor)
|
||||
let branch1 = treeFromTrunk (replicate i1 $ Left corridorN) (connectRoom $ putCrs connectingRoom)
|
||||
let branch2 = treeFromTrunk (replicate i2 $ Left corridorN) (deadRoom $ putWp corridor)
|
||||
return $ Node (Left root) [branch1,branch2]
|
||||
where putCrs = over rmPS (++ [PS (10,40) (-pi/2) $ randC
|
||||
,PS (-10,40) (-pi/2) $ randC
|
||||
@@ -618,7 +618,7 @@ shootingRange = do
|
||||
>>= filterLinks (\((_,y),r) -> y > 200 && r /= 0)
|
||||
rm3 <- shootersRoom >>= changeLinkTo (\((x,y),_) -> y < 10 && x > 20 && x < 180)
|
||||
>>= filterLinks (\(_,r) -> r == 0)
|
||||
return $ treePost [Left rm1
|
||||
return $ treeFromPost [Left rm1
|
||||
,Left $ roomPadCut (rectNSWE 20 (-20) (-80) 80) (0,20)
|
||||
,Left rm2
|
||||
,Left $ roomPadCut (rectNSWE 20 (-20) (-80) 80) (0,20)
|
||||
@@ -639,4 +639,4 @@ spawnerRoom = do
|
||||
]
|
||||
let f ((lx,_),_) = lx < x/2-5
|
||||
roomWithSpawner <- (fmap connectRoom . randomiseOutLinks) =<< filterLinks f (set rmPS plmnts $ roomRect x y 2 2)
|
||||
return $ treeTrunk [Left (airlock 0)] roomWithSpawner
|
||||
return $ treeFromTrunk [Left (airlock 0)] roomWithSpawner
|
||||
|
||||
Reference in New Issue
Block a user