Work on tutorial rooms with laser turret

This commit is contained in:
2026-02-25 20:00:37 +00:00
parent 8ae58823f8
commit c2c139c8aa
4 changed files with 133 additions and 94 deletions
+51 -21
View File
@@ -8,9 +8,9 @@ module Dodge.Room.LasTurret (
keyCardRoomRunPast,
lasSensorTurretTest,
healthTest,
lasCenRunClose,
) where
--import Dodge.Item.Held.Cane
import qualified Data.Set as S
import Dodge.Cleat
import Dodge.Data.GenWorld
@@ -31,10 +31,11 @@ import Geometry
import LensHelp
import RandomHelp
cenLasTur :: RandomGen g => State g Room
cenLasTur :: (RandomGen g) => State g Room
cenLasTur = do
thelight <- mntLightLnkCond $ rprBool $ const . isInLnk
roomNgon 8 200 <&> rmPmnts
roomNgon 8 200
<&> rmPmnts
.~ [ putLasTurret 0.02
, heightWallPS
(resetPLUse $ rprBoolShift (const . isInLnk) (shiftInBy 100 <&> (,S.singleton UsedPosLow)))
@@ -49,11 +50,11 @@ lightSensInsideDoor :: Int -> Room -> Room
lightSensInsideDoor i rm =
rm
& rmPmnts
.++~ [ psPt atFstLnkOut (PutForeground $ floorWire (V2 20 0) (V2 20 (-100)))
, psPt atFstLnkOut (PutForeground $ floorWire (V2 0 (-100)) (V2 20 (-100)))
, psPt atFstLnkOut (PutForeground $ verticalWire (V2 20 0) 0 80)
, sensAboveDoor LaserSensor 10 (atFstLnkOutShiftInward 100) & plExternalID ?~ i
]
.++~ [ psPt atFstLnkOut (PutForeground $ floorWire (V2 20 0) (V2 20 (-100)))
, psPt atFstLnkOut (PutForeground $ floorWire (V2 0 (-100)) (V2 20 (-100)))
, psPt atFstLnkOut (PutForeground $ verticalWire (V2 20 0) 0 80)
, sensAboveDoor LaserSensor 10 (atFstLnkOutShiftInward 100) & plExternalID ?~ i
]
-- & rmOutPmnt . at i ?~ sensAboveDoor LaserSensor 10 (atFstLnkOutShiftInward 100)
@@ -61,18 +62,18 @@ lightSensByDoor :: Int -> Room -> Room
lightSensByDoor i rm =
rm
& rmPmnts
.++~ [ psPt atFstLnkOut $ PutForeground $ verticalWire (V2 20 0) 0 80
, heightWallPS (atNthLnkOutShiftInward 1 100) 30 covershape
, heightWallPS (atFstLnkOutShiftInward 100) 30 covershape
, sensAboveDoor LaserSensor 20 (atFstLnkOutShiftBy sensorshift) & plExternalID ?~ i
]
.++~ [ psPt atFstLnkOut $ PutForeground $ verticalWire (V2 20 0) 0 80
, heightWallPS (atNthLnkOutShiftInward 1 100) 30 covershape
, heightWallPS (atFstLnkOutShiftInward 100) 30 covershape
, sensAboveDoor LaserSensor 20 (atFstLnkOutShiftBy sensorshift) & plExternalID ?~ i
]
where
-- & rmOutPmnt . at i ?~ sensAboveDoor LaserSensor 20 (atFstLnkOutShiftBy sensorshift)
covershape = rectNSWE 10 (-10) (-20) 20
sensorshift (p, a) = ((p +.+ rotateV a (V2 60 (-20)), a), S.singleton UsedPosLow)
keyCardRoomRunPast :: RandomGen g => Int -> Int -> State g (MetaTree Room String)
keyCardRoomRunPast :: (RandomGen g) => Int -> Int -> State g (MetaTree Room String)
keyCardRoomRunPast keyid rmid = do
cenroom <- shuffleLinks . keyCardAnalyserByDoor keyid rmid =<< roomNgon 6 200
let doorroom = triggerDoorRoom rmid
@@ -101,14 +102,15 @@ analyserByNthLink n proxreq i =
)
)
(atNthLnkOutShiftBy n sensorshift)
& plExternalID ?~ i
& plExternalID
?~ i
where
sensorshift (p, a) = ((p +.+ rotateV a (V2 (-30) (-10)), a), S.singleton UsedPosLow)
analyserByDoor :: ProximityRequirement -> Int -> Room -> Room
analyserByDoor pr i = rmPmnts .:~ analyserByNthLink 0 pr i
healthTest :: RandomGen g => Int -> State g (Tree Room)
healthTest :: (RandomGen g) => Int -> State g (Tree Room)
healthTest n = do
cenroom <- shuffleLinks . healthAnalyserByDoor n =<< roomNgon 8 200
return $
@@ -120,14 +122,14 @@ healthTest n = do
, cleatOnward door
]
lasSensorTurretTest :: RandomGen g => Int -> State g (MetaTree Room String)
lasSensorTurretTest :: (RandomGen g) => Int -> State g (MetaTree Room String)
lasSensorTurretTest n = do
cenroom <- shuffleLinks . lightSensInsideDoor n =<< cenLasTur
rToOnward "lasSensorTurretTest" $
treePost
[door, cenroom, triggerDoorRoom n, cleatOnward door]
lasCenSensEdge :: RandomGen g => Int -> State g (MetaTree Room String)
lasCenSensEdge :: (RandomGen g) => Int -> State g (MetaTree Room String)
lasCenSensEdge n = do
cenroom <- shuffleLinks . lightSensByDoor n =<< cenLasTur
let doorroom = triggerDoorRoom n
@@ -139,7 +141,35 @@ lasCenSensEdge n = do
, treePost [door, cleatLabel 0 corridor]
]
lasTunnel :: RandomGen g => Float -> State g Room
lasCenRunClose :: (RandomGen g) => State g (MetaTree Room String)
lasCenRunClose = do
thelight <- mntLightLnkCond $ rprBool $ const . isInLnk
thelight1 <- mntLightLnkCond $ rprBool $ const . isOutLnk
r <-
roomNgon 8 250
<&> rmPmnts
.~ [ putLasTurret 0.02
, inlinkwall 70 (rectNSWE 10 (-10) (-10) 30)
, inlinkwall 125 (rectNSWE 55 (-55) (-10) 10)
, inlinkwall 180 (rectNSWE 10 (-10) (-30) 10)
, outlinkwall 70 (rectNSWE 10 (-10) (-30) 10)
, outlinkwall 125 (rectNSWE 55 (-55) (-10) 10)
, outlinkwall 180 (rectNSWE 10 (-10) (-10) 30)
, thelight
, thelight1
]
-- <&> rmLinks %~ setOutLinksByType (PolyEdge 7)
-- <&> rmLinks %~ tail
-- <&> rmLinks %~ setOutLinks (const False)
rToOnward "lasCenRunClose" $ return $ cleatOnward r
where
linkwall f x = heightWallPS
(resetPLUse $ rprBoolShift (const . f) (shiftInBy x <&> (,S.singleton UsedPosLow)))
30
inlinkwall = linkwall isInLnk
outlinkwall = linkwall isOutLnk
lasTunnel :: (RandomGen g) => Float -> State g Room
lasTunnel y = do
extraPlmnts <-
takeOne
@@ -166,7 +196,7 @@ lasTunnel y = do
]
, _rmPmnts =
[ putLasTurret 0.005 & plSpot .~ PS (V2 10 (240 + y)) (1.5 * pi)
, --, midWall (rectNSEW 65 40 0 25)
, -- , midWall (rectNSEW 65 40 0 25)
mntLS vShape (V2 60 145) (V3 40 125 90)
, mntLS vShape (V2 (-40) 145) (V3 (-20) 125 90)
]
@@ -180,7 +210,7 @@ lasTunnel y = do
]
-- a y value of 400 is probably "unrunnable"
lasTunnelRunPast :: RandomGen g => Float -> State g (MetaTree Room String)
lasTunnelRunPast :: (RandomGen g) => Float -> State g (MetaTree Room String)
lasTunnelRunPast y = do
r <- lasTunnel y
r1 <- takeOne [door, corridor]
+1
View File
@@ -24,6 +24,7 @@ roomNgon n x = do
, _rmPmnts = [thelight]
, _rmBound = [poly]
, _rmFloor = Tiled [makeTileFromPoly poly 2]
--, _rmFloor = InheritFloor
, _rmName = show n ++ "gon"
, _rmPos = poss
}
+11 -7
View File
@@ -54,14 +54,18 @@ tutAnoTree = do
[ tToBTree "TutStartRez" . return . cleatOnward <$> tutRezBox
, corDoor
, tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
, lasCenRunClose
-- , passthroughLockKeyLists lockRoomKeyItems itemRooms
, tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
, passthroughLockKeyLists
[(sensorRoomRunPast ElectricSensor, takeOne
[-- CRAFT (ENERGYBALLCRAFT TeslaBall) ,
HELD SPARKGUN])]
itemRooms
, tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
, tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
-- , tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
-- , tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
-- , passthroughLockKeyLists
-- [(sensorRoomRunPast ElectricSensor, takeOne
-- [-- CRAFT (ENERGYBALLCRAFT TeslaBall) ,
-- HELD SPARKGUN])]
-- itemRooms
-- , tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
-- , tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
, tToBTree "sdr" . return . cleatOnward <$>
(shuffleLinks =<< distributerRoom BulletAmmo 100000)
-- , return $ tToBTree "cor" $ return $ cleatOnward corridor