Cleanup
This commit is contained in:
@@ -62,9 +62,7 @@ randomiseAllLinks r = do
|
||||
{- Shuffle the order of all links of a room randomly.
|
||||
- Note this does not change their types. -}
|
||||
shuffleLinks :: RandomGen g => Room -> State g Room
|
||||
shuffleLinks r = do
|
||||
newLinks <- shuffle $ _rmLinks r
|
||||
return $ r {_rmLinks = newLinks }
|
||||
shuffleLinks = rmLinks %%~ shuffle
|
||||
|
||||
filterLinks :: RandomGen g => ((Point2,Float) -> Bool) -> Room -> State g Room
|
||||
filterLinks cond r = do
|
||||
|
||||
+13
-15
@@ -2,7 +2,7 @@ module Dodge.Room.RunPast where
|
||||
import Dodge.UseAll
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.LightSource
|
||||
import Dodge.RoomLink
|
||||
--import Dodge.RoomLink
|
||||
import Dodge.Data
|
||||
--import Dodge.Default
|
||||
--import Dodge.Layout.Tree.Either
|
||||
@@ -44,26 +44,24 @@ critRoom = corridorWallN & rmRandPSs .~ [psRandRanges (15,25) (30,45) (pi,2*pi)]
|
||||
|
||||
runPastRoom :: RandomGen g => Int -> State g (Tree Room)
|
||||
runPastRoom i = do
|
||||
h <- state $ randomR (200,400::Float)
|
||||
theedgetest <- takeOne [horEdgeTest (<1), horEdgeTest (>39)]
|
||||
thels <- roomCritLS
|
||||
theweapon <- randBlockBreakWeapon
|
||||
cenroom <- shuffleLinks $ restrictRMInLinksPD (\(V2 _ y,_) -> y < 1)
|
||||
$ roomRectAutoLinks 40 h & rmPmnts .~ [plRRpt 0 (PutFlIt theweapon)]
|
||||
theedge <- takeOne [West,East]
|
||||
--let cenroom = filterSortOutLinksOn theedgetest ((\(V2 a b) -> (a,b)) . fst)
|
||||
h <- state $ randomR (200,400::Float)
|
||||
thels <- roomCritLS
|
||||
theweapon <- randBlockBreakWeapon
|
||||
--cenroom <- shuffleLinks $ restrictRMInLinksPD (\(V2 _ y,_) -> y < 1)
|
||||
cenroom <- shuffleLinks
|
||||
$ roomRectAutoLinks 40 h & rmPmnts .~ [plRRpt 0 (PutFlIt theweapon)]
|
||||
theedge <- takeOne $ map OnEdge [West,East]
|
||||
let linkcor = critRoom & rmPmnts .~ [ spanLS thels (V2 0 65) (V2 40 65) ]
|
||||
critroom = linkcor & rmPmnts .:~ plRRpt 0 randC1
|
||||
aswitchroom = corridorWallN
|
||||
{_rmOutPmnt = [OutPlacement (putLitButOnPosExtTrig red useUnusedLnk) i]
|
||||
,_rmPmnts = []
|
||||
}
|
||||
switchdoor = triggerDoorRoom i
|
||||
n = length $ filter theedgetest $ map lnkPosDir $ _rmLinks cenroom
|
||||
switchdoor = triggerDoorRoom i
|
||||
n = length $ filter (elem theedge . _rlType) $ _rmLinks cenroom
|
||||
controom = treeFromPost [ switchdoor, linkcor,corridor,corridor] (useAll door)
|
||||
critrooms :: [Tree Room]
|
||||
critrooms = treeFromPost [ switchdoor] critroom
|
||||
doorrooms = treeFromPost [ switchdoor] critroom
|
||||
: replicate (n-2) (treeFromPost [ switchdoor] linkcor)
|
||||
return $ Node cenroom $
|
||||
map (over root $ rmConnectsTo .~ S.member (OnEdge theedge)) (controom : critrooms)
|
||||
return $ Node cenroom $
|
||||
map (over root $ rmConnectsTo .~ S.member theedge) (controom : doorrooms)
|
||||
++ [return aswitchroom]
|
||||
|
||||
+11
-8
@@ -1,4 +1,4 @@
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Room.Start where
|
||||
import Dodge.UseAll
|
||||
import Dodge.Data
|
||||
@@ -53,12 +53,12 @@ startRoom i = join (takeOne
|
||||
[-- (,) (0.5::Float) ((chainUses <$> sequence [powerFakeout,fmap fst $weaponRoom i])
|
||||
-- <&> (,TreeSubLabelling "chainUses <$> sequence [powerFakeout,weaponRoom i]" Nothing))
|
||||
-- wat
|
||||
rezBoxesWp >>= rToOnward "rezBoxesWp"
|
||||
, rezBoxThenWeaponRoom i
|
||||
, rezBoxesWpCrit >>= rToOnward "rezBoxesWpCrit"
|
||||
, runPastStart i >>= rToOnward ("runPastStart " ++ show i)
|
||||
, startCrafts >>= roomsContaining' [] >>= rezBoxThenRooms
|
||||
>>= rToOnward "startCrafts >>= roomsContaining [] >>= rezBoxThenRooms"
|
||||
-- rezBoxesWp >>= rToOnward "rezBoxesWp"
|
||||
-- , rezBoxThenWeaponRoom i
|
||||
-- , rezBoxesWpCrit >>= rToOnward "rezBoxesWpCrit"
|
||||
runPastStart i >>= rToOnward ("runPastStart " ++ show i)
|
||||
-- , startCrafts >>= roomsContaining' [] >>= rezBoxThenRooms
|
||||
-- >>= rToOnward "startCrafts >>= roomsContaining [] >>= rezBoxThenRooms"
|
||||
])
|
||||
randomChallenges :: RandomGen g => State g (LabTree Room)
|
||||
randomChallenges = shootingRange
|
||||
@@ -72,7 +72,10 @@ runPastStart :: RandomGen g => Int -> State g (Tree Room)
|
||||
runPastStart i = do
|
||||
s <- rezBoxStart
|
||||
rp <- runPastRoom i
|
||||
return $ s `passUntiluseAll` [rp]
|
||||
--return $ s `passUntiluseAll` [rp]
|
||||
return . shiftChildren $ attachTree toOnward' rp $ fmap ([],) s
|
||||
-- return . shiftChildren $ attachTree toOnward' (pure $ useAll corridor) $ fmap ([],) s
|
||||
|
||||
|
||||
rezBoxStart :: RandomGen g => State g (Tree Room)
|
||||
rezBoxStart = do
|
||||
|
||||
Reference in New Issue
Block a user