Commit before changing logging of placement spots

This commit is contained in:
2025-09-29 21:58:02 +01:00
parent 9ed6d75853
commit bf9a2250da
14 changed files with 294 additions and 288 deletions
+29 -8
View File
@@ -9,6 +9,7 @@ module Dodge.Room.Room (
spawnerRoom,
corDoor,
weaponBehindPillar,
critsRoom,
) where
import qualified Data.Set as S
@@ -73,6 +74,7 @@ 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)
let hf = hgt / 5
awindow h xl xr = windowLine (V2 xl h) (V2 xr h)
plmnts =
@@ -84,7 +86,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))
, sPS (V2 (wth / 2) (hgt / 2)) 0 putLamp
, l1
-- , sPS (V2 (wth / 2) (10 + hgt / 2)) 0 putLamp
]
let northPSs = do
cry <- randomRanges [3 * hf + 10, 4 * hf -10, 4 * hf + 10, 5 * hf -10]
@@ -120,7 +123,8 @@ roomMiniIntro = do
roomCenterPillar :: RandomGen g => State g Room
roomCenterPillar = do
l1 <- mntLightLnkCond (resetPLUse $ rprBool $ \rp _ -> isInLnk rp)
l2 <- mntLightLnkCond (resetPLUse $ rprBool $ \rp _ -> isOutLnk rp)
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)
@@ -299,15 +303,16 @@ shootersRoom' = do
]
toPS x y = return (V2 x y, -0.5 * pi)
roomRectAutoLinks w 600
<&> rmPmnts .~ plmnts
<&> rmRandPSs .~ [toPS x1 y1, toPS x2 y2, toPS x3 y3]
<&> rmPmnts .~ plmnts
<&> rmRandPSs .~ [toPS x1 y1, toPS x2 y2, toPS x3 y3]
shootersRoom1 :: RandomGen g => State g Room
shootersRoom1 = do
pl <- takeOne $
map
(\i -> psPtPl (PSRoomRand i (uncurry PS)) (PutCrit autoCrit))
[0, 1, 2]
pl <-
takeOne $
map
(\i -> psPtPl (PSRoomRand i (uncurry PS)) (PutCrit autoCrit))
[0, 1, 2]
shootersRoom' <&> rmPmnts
.:~ pl
@@ -377,5 +382,21 @@ corDoor = do
cor <- shuffleLinks (cleatOnward corridor) <&> rmPmnts .~ []
return $ tToBTree "corDoor" $ treePost [door, cor]
critsPillarRoom :: Int -> State LayoutVars Room
critsPillarRoom i = do
xs <- takeN i $ [V2 x y | x <- [20, 220], y <- [20, 40]] ++ [V2 120 160, V2 120 200]
rcp <- roomCenterPillar
return $ rcp & rmPmnts <>~ fmap f xs
where
f x = sPS x (argV $ V2 120 80 -.- x) randC1
critsRoom :: Int -> State LayoutVars (Tree Room)
critsRoom i =
join $
takeOne
--[return <$> critsPillarRoom i]
--[return <$> roomC 200 200]
[return <$> glassSwitchBack]
-- cor <- shuffleLinks corridor
-- return $ tToBTree "corDoor" $ treePost [door,cor,cleatOnward door]
+16 -17
View File
@@ -41,14 +41,10 @@ import qualified Data.IntMap.Strict as IM
tutAnoTree :: State LayoutVars MTRS
tutAnoTree = do
(is,wbp) <- setTreeInts =<< weaponBehindPillar
foldMTRS
[ tToBTree "TutStartRez" . return . cleatOnward <$> tutRezBox
, corDoor
, tutRooms is
, corDoor
, tToBTree "critroom" <$> return wbp
, corDoor
, tutHub
, tutDrop
, return $ tToBTree "cor" $ return $ cleatOnward corridor
---- , AnTree $ pickupTut
@@ -106,22 +102,24 @@ tutDrop = do
, makeTermLine "-------------------------------------------"
]
tutRooms :: [Int] -> State LayoutVars (MetaTree Room String)
tutRooms is = do
tutHub :: State LayoutVars (MetaTree Room String)
tutHub = do
(is,wbp) <- setTreeInts =<< critsRoom 2
i <- nextLayoutInt
j <- nextLayoutInt
k <- nextLayoutInt
let a gw = analyserByNthLinkWithPrompt
3 (makeTermPara $ show is <> show (getRoomsFromInts is gw)
<>(getCrsFromRooms' is gw))
3 --(makeTermPara $ show is <> show (getRoomsFromInts is gw)
-- <> getCrsFromRooms' is gw)
[]
(RequireDeadCreatures $ getCrsFromRooms is gw) k
x <-
shuffleLinks
. analyserByDoorWithPrompt sensorTut (RequireEquipment (AMMOMAG DRUMMAG)) i
. analyserByDoorWithPrompt [] (RequireEquipment (AMMOMAG DRUMMAG)) i
. (rmInPmnt .:~ (0,a))
=<< addDoorAtNthLinkToggleTerminal 1 ss j
<$> roomNgon 6 100
bcor <- blockedCorridor
. addDoorAtNthLinkToggleTerminal 1 ss j
=<< roomNgon 6 100
bcor <- treeAttachDeep (return door) <$> blockedCorridor
r1 <- r burstRifle <&> rmPmnts .:~ t
r2 <- r (drumMag & itConsumables ?~ 500)
return $
@@ -130,8 +128,9 @@ tutRooms is = do
x
[ treeFromPost [triggerDoorRoom i] r1
, treeFromPost [triggerDoorRoom j] r2
, bcor
, treeFromPost [triggerDoorRoom k & rmInPmnt . ix 0 . _1 .~ 1] r2
, (rmClusterStatus . csLinks . at OnwardCluster .~ Nothing)
<$> treeAttachDeep wbp bcor
, treeFromPost [] (cleatOnward $ triggerDoorRoom k & rmInPmnt . ix 0 . _1 .~ 1)
]
where
ss =
@@ -192,7 +191,7 @@ getCrsFromRooms' is gw = fmap h $ show $ foldMap f (IM.restrictKeys (gw ^. genRo
getCrsFromRooms :: [Int] -> GenWorld -> [Int]
getCrsFromRooms is gw = foldMap f (IM.restrictKeys (gw ^. genRooms) js)
where
js = foldMap IS.singleton $ IM.restrictKeys (gw ^. genInts) (IS.fromList is)
js = getRoomsFromInts is gw
f rm = foldMap g $ rm ^. rmPmnts
g x = case x ^. plType of
PutCrit _ -> [x ^?! plMID . _Just]
@@ -206,7 +205,7 @@ sensorTut =
, makeTermLine " | / - \\"
, makeTermLine "--------------------------------------------"
]
<> tlSetStatus (TerminalPressTo "CONTINUE")
-- <> tlSetStatus (TerminalPressTo "CONTINUE")
tutRezBox :: RandomGen g => State g Room
tutRezBox = do