This commit is contained in:
2022-06-14 13:15:25 +01:00
parent a280bbb787
commit 1b500afbf7
4 changed files with 35 additions and 48 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ initialAnoTree = OnwardList
[ IntAnno $ AnTree . startRoom
-- , (SpecificRoom . return . tToBTree $ treePost [corridor,corridor,cleatOnward corridor])
, AnTree $ tToBTree "spawners" <$> spawnerRoom
, AnRoom $ pistolerRoom
, AnRoom pistolerRoom
, AnRoom doubleCorridorBarrels
, IntAnno $ PassthroughLockKeyLists
[(sensorRoomRunPast ELECTRICAL, takeOne [STATICMODULE,SPARKGUN] )] itemRooms
+1 -4
View File
@@ -9,10 +9,7 @@ addRandomGirderEW :: RandomGen g => Room -> State g Room
addRandomGirderEW rm = do
hgshape <- takeOne [girder 96 20 10, girderZ 96 20 10, girderV 96 20 10]
lgshape <- takeOne [girder 60 20 10, girderZ 60 20 10, girderV 60 20 10]
addgird <- takeOne $
[ addGirderNS' hgshape black
, addGirderNS' lgshape red
]
addgird <- takeOne [ addGirderNS' hgshape black , addGirderNS' lgshape red ]
addgird rm
addRandomGirderFrom :: RandomGen g => CardinalPoint -> Int -> Room -> State g Room
+1 -1
View File
@@ -30,7 +30,7 @@ glassLesson = do
, treeFromPost ( (door & rmConnectsTo .~ S.member (OnEdge East))
: corridors) $ cleatOnward door]
where
fromWest edge i s = S.member (OnEdge edge) s && S.member ((FromEdge West) i) s
fromWest edge i s = OnEdge edge `S.member` s && FromEdge West i `S.member` s
uppers = Node (door & rmConnectsTo .~ fromWest North 0) [pure topRoom]
botRoom = roomRect 200 200 1 1
& rmPmnts .~ botplmnts
+32 -42
View File
@@ -33,7 +33,6 @@ import Dodge.Room.Airlock
import Geometry
import MonadHelp
import LensHelp
--import Color
import qualified Data.Set as S
@@ -46,10 +45,10 @@ roomC w h = do
ntanks <- takeOne [0,0,0,0,0,1,1,1,1,2,3,4]
thetank <- randomTank <&> plSpot .~ unusedOffPathAwayFromLink 50
maybeaddgird <- takeOne [return, addRandomGirderFrom West 0, addRandomGirderFrom North 0]
maybeaddgird =<< (shuffleLinks $ roomRectAutoLinks w h
maybeaddgird =<< shuffleLinks (roomRectAutoLinks w h
& rmLinks %~
( (setInLinks (\rl -> S.fromList [(FromEdge East) 0,OnEdge South] `S.isSubsetOf` _rlType rl))
. (setOutLinks (\rl -> OnEdge West `S.member` _rlType rl))
( setInLinks (\rl -> S.fromList [FromEdge East 0,OnEdge South] `S.isSubsetOf` _rlType rl)
. setOutLinks (\rl -> OnEdge West `S.member` _rlType rl)
)
& rmPmnts .++~ (wl : replicate ntanks thetank)
& rmRandPSs .~ [farside]
@@ -69,7 +68,7 @@ roomPadCut ps p = defaultRoom
}
branchWith :: Room -> [Tree Room] -> Tree Room
branchWith r ts = Node r $ return (cleatOnward door) : ts
branchWith r = Node r . (return (cleatOnward door) :)
glassSwitchBack :: RandomGen g => State g Room
glassSwitchBack = do
@@ -77,11 +76,12 @@ glassSwitchBack = do
hgt <- state $ randomR (400,600)
wllen <- state $ randomR (60,wth/2-40)
let hf = hgt/5
awindow h xl xr = windowLine (V2 xl h) (V2 xr h)
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))
[awindow hf (wth-60) wllen
,awindow (2*hf) (wth-wllen) 60
,awindow (3*hf) (wth-60) wllen
,awindow (4*hf) (wth-wllen) 60
,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))
@@ -89,9 +89,7 @@ glassSwitchBack = do
, 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
]
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)
@@ -135,21 +133,19 @@ roomCenterPillar = shuffleLinks . restrictInLinks ((\p -> dist p (V2 120 0) < 10
{- Probabilites of the type of the first floor weapon. -}
randFirstWeapon :: State StdGen PSType
randFirstWeapon = do
takeOne $ map PutFlIt $
replicate 10 pistol
++ replicate 5 (bangStick 4)
++ replicate 5 (bangCaneX 3)
randFirstWeapon = takeOne $ map PutFlIt $
replicate 10 pistol
++ replicate 5 (bangStick 4)
++ replicate 5 (bangCaneX 3)
weaponEmptyRoom :: RandomGen g => State g (Tree Room)
weaponEmptyRoom = do
w <- state $ randomR (220,300)
h <- state $ randomR (220,300)
let plmnts =
[sPS (V2 (w/2) (h-40)) 0 $ RandPS randFirstWeapon
,sPS (V2 20 20) (pi/2) randC1
,sPS (V2 (w-20) 20) (pi/2) randC1
--,sPS (V2 (w/2) (h/2)) 0 putLamp
[sPS (V2 (w/2) (h-40)) 0 $ RandPS randFirstWeapon
,sPS (V2 20 20) (pi/2) randC1
,sPS (V2 (w-20) 20) (pi/2) randC1
,mntLightLnkCond useUnusedLnk
]
f (V2 x y,a) = (a == pi && x > 25 && x < w - 25) || (a /= 0 && y > w - 30)
@@ -159,42 +155,36 @@ weaponEmptyRoom = do
weaponUnderCrits :: RandomGen g => Int -> State g (MetaTree Room String)
weaponUnderCrits i = do
let plmnts =
[--sPS (V2 20 0) 0 $ RandPS randFirstWeapon
sPS (V2 20 0) (negate $ pi/2) randC1
,sPS (V2 20 20) ( pi/2) randC1
]
addwpat p = rmPmnts .:~ PickOnePlacement i (sPS p 0 $ RandPS randFirstWeapon)
let continuationRoom = treePost
let addwpat p = rmPmnts .:~ PickOnePlacement i (sPS p 0 $ RandPS randFirstWeapon)
continuationRoom = treePost
[ addwpat (V2 20 0) corridorN
, addwpat (V2 20 0) corridorN
, cleatOnward (set rmPmnts plmnts corridorN)
, cleatOnward $ corridorN & rmPmnts .~
[ sPS (V2 20 0) (negate $ pi/2) randC1
, sPS (V2 20 20) ( pi/2) randC1
]
]
rcp <- roomCenterPillar
rmpils <- roomPillars 30 240 240 2 2
deadEndRoom' <- takeOne [ addwpat (V2 120 20) rmpils , addwpat (V2 120 20) rcp]
junctionRoom <- takeOne [ tEast, tWest]
let thetree = treeFromTrunk [ corridorN , corridorN]
$ Node junctionRoom [continuationRoom ,pure deadEndRoom' ]
rToOnward "weaponUnderCrits" thetree
rToOnward "weaponUnderCrits" $ treeFromTrunk [ corridorN , corridorN]
$ Node junctionRoom [continuationRoom ,pure deadEndRoom' ]
weaponBehindPillar :: RandomGen g => State g (Tree Room)
weaponBehindPillar = do
wpa <- state $ randomR (0,pi)
wpos <- takeOne [V2 120 160,V2 80 40,V2 160 40,V2 220 200,V2 40 200,V2 120 35]
cpos <- takeOne $ [V2 x y | x <- [20,220], y <- [20,40]] ++ [V2 120 160,V2 120 200]
let d p = argV $ V2 120 80 -.- p
let plmnts1 =
[sPS wpos wpa $ RandPS randFirstWeapon
,sPS cpos (d cpos) randC1
]
rcp <- roomCenterPillar
return $ treeFromTrunk
[ corridor
--, $ over rmOutLinks tail $ over rmPmnts (++ plmnts1) rcp
, over rmPmnts (++ plmnts1) rcp
]
(pure . cleatOnward $ set rmPmnts [sPS (V2 20 60) (negate $ pi/2) randC1] corridorN)
[ corridor
, rcp & rmPmnts ++.~
[sPS wpos wpa $ RandPS randFirstWeapon
,sPS cpos (argV $ V2 120 80 -.- cpos) randC1
]
]
(pure . cleatOnward $ set rmPmnts [sPS (V2 20 60) (negate $ pi/2) randC1] corridorN)
weaponBetweenPillars :: RandomGen g => State g (Tree Room)
weaponBetweenPillars = do