Work on chasm rooms

This commit is contained in:
2025-10-02 16:58:38 +01:00
parent 013f50f0bc
commit 7e3614c9c8
15 changed files with 301 additions and 152 deletions
+21 -23
View File
@@ -36,7 +36,6 @@ import Geometry
import LensHelp
import MonadHelp
import RandomHelp
import Linear
roomC :: RandomGen g => Float -> Float -> State g Room
roomC w h = do
@@ -75,9 +74,11 @@ glassSwitchBack = do
wth <- state $ randomR (200, 400)
hgt <- state $ randomR (400, 600)
wllen <- state $ randomR (60, wth / 2 -40)
l1 <- mntLightLnkCond (resetPLUse $ rprBool $ \rp _ -> isInLnk rp)
--l2 <- mntLightLnkCond (rprBool $ \rp _ -> (rp ^. rpPos . _x) > wth -1 && null (rp ^. rpPlacementUse))
l2 <- mntLightLnkCond (rprBool $ \rp _ -> rp ^. rpLinkStatus . rplsType . at (OnEdge West) == Just ()&& null (rp ^. rpPlacementUse))
l2 <-
mntLightLnkCond $
rprBool $ \rp _ ->
rp ^. rpLinkStatus . rplsType . at (OnEdge West) == Just ()
&& null (rp ^. rpPlacementUse)
let hf = hgt / 5
awindow h xl xr = windowLine (V2 xl h) (V2 xr h)
plmnts =
@@ -89,14 +90,8 @@ glassSwitchBack = do
, 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))
, l1
, l2
, l2
, l2
, l2
, l2
-- , sPS (V2 (wth / 2) (10 + hgt / 2)) 0 putLamp
]
<> replicate 5 l2
let northPSs = do
cry <- randomRanges [3 * hf + 10, 4 * hf -10, 4 * hf + 10, 5 * hf -10]
crx <- state $ randomR (wllen, wth - (wllen + 40))
@@ -108,16 +103,16 @@ glassSwitchBack = do
& rmRandPSs .~ [northPSs, midPS]
& rmName .~ "glassSwitchBack"
glassSwitchBackCrits :: RandomGen g => State g Room
glassSwitchBackCrits =
glassSwitchBack <&> rmPmnts
.++~ [ psPtPl (PSRoomRand 0 (uncurry PS)) (PutCrit miniGunCrit)
, psPtPl (PSRoomRand 1 (uncurry PS)) randC1
]
glassSwitchBackCrits :: RandomGen g => Int -> State g Room
glassSwitchBackCrits i = glassSwitchBack <&> rmPmnts <>~ fmap f [0 .. i -1]
where
f j = psPtPl (PSRoomRand j (uncurry PS)) randC1
-- note there used to be a creature with a minigun in glassSwitchBackCrits, has
-- been removed 25.10.01
miniTree2 :: RandomGen g => State g (Tree Room)
miniTree2 = do
rm <- glassSwitchBackCrits >>= shuffleLinks . restrictInLinks (\p -> (sndV2 . fst) p < 70)
rm <- glassSwitchBackCrits 2 >>= shuffleLinks . restrictInLinks (\p -> (sndV2 . fst) p < 70)
return $ branchWith rm (replicate 3 $ treePost [door, corridor, critInDeadEnd])
-- So, the idea is to attach outer children to the bottommost right nodes
@@ -131,8 +126,10 @@ roomMiniIntro = do
roomCenterPillar :: RandomGen g => State g Room
roomCenterPillar = do
l1 <- mntLightLnkCond (resetPLUse $ rprBool $ \rp _ -> isInLnk rp)
l2 <- mntLightLnkCond ((resetPLUse $ rprBool $ \rp _ -> isOutLnk rp)
& psFallback ?~ mntLightLnkCond' (resetPLUse useUnusedLnk))
l2 <-
mntLightLnkCond $
(resetPLUse $ rprBool $ \rp _ -> isOutLnk rp)
& psFallback ?~ mntLightLnkCond' (resetPLUse useUnusedLnk)
let plmnts =
[ blockLine (V2 115 115) (V2 115 125)
, blockLine (V2 125 115) (V2 125 125)
@@ -402,9 +399,10 @@ critsRoom :: Int -> State LayoutVars (Tree Room)
critsRoom i =
join $
takeOne
--[return <$> critsPillarRoom i]
--[return <$> roomC 200 200]
[return <$> glassSwitchBack]
[ return <$> roomCCrits i
, return <$> critsPillarRoom i
, return <$> glassSwitchBackCrits i
]
-- cor <- shuffleLinks corridor
-- return $ tToBTree "corDoor" $ treePost [door,cor,cleatOnward door]