This commit is contained in:
2025-10-24 23:22:16 +01:00
parent b4012af312
commit 3f5f5d2c6b
12 changed files with 77 additions and 117 deletions
+27 -50
View File
@@ -3,6 +3,7 @@
{- Rooms that contain two doors and a switch alternating both. -}
module Dodge.Room.Airlock where
import Dodge.PlacementSpot
import Dodge.LevelGen.DoorPane
import Dodge.Default.Door
import qualified Data.IntMap.Strict as IM
@@ -38,8 +39,8 @@ decontamRoom i =
& rmPmnts
.~ [ pContID (PS (V2 (-35) 50) (negate $ pi / 2)) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
\btid -> Just $
putDoubleDoorThen False thewall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\_ _ -> Just $ putDoubleDoor False thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
putDoubleDoorThen defaultDoorWall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\_ _ -> Just $ putDoubleDoor defaultDoorWall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
, invisibleWall $ rectNSWE 60 40 (-40) (-30)
, spanLightI (V2 (-20) 30) (V2 (-20) 70)
, analyser (NoItemZone ps) (PS 50 0) (PS mcpos 0) & plExternalID ?~ i
@@ -52,7 +53,7 @@ decontamRoom i =
f gw = fromMaybe (error "tried to put a door using an empty placement list") $ do
pmnt <- gw ^? genPmnt . ix i
return $
putDoubleDoor False
putDoubleDoor
defaultDoorWall
(cond pmnt)
(V2 (-10) 35)
@@ -62,8 +63,6 @@ decontamRoom i =
mcpos = V2 70 50
cutps = [rectNSWE 100 0 0 40, switchcut]
ps = (\p -> p - mcpos) <$> orderPolygon (concat cutps)
--thewall = switchWallCol col
thewall = defaultDoorWall
switchcut = rectNSWE 65 35 (-40) 80
lnks =
[ (V2 20 95, 0)
@@ -81,8 +80,8 @@ airlock0 =
, _rmPmnts =
[ pContID (PS (V2 (-35) 50) (negate $ pi / 2)) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
\btid -> Just $
putDoubleDoorThen False thewall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\_ _ -> Just $ putDoubleDoor False thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
putDoubleDoorThen defaultDoorWall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\_ _ -> Just $ putDoubleDoor defaultDoorWall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
, invisibleWall $ rectNSWE 60 40 (-40) (-30)
, spanLightI (V2 (-2) 30) (V2 (-2) 70)
, sps0 $ putShape $ thinHighBar 75 (V2 40 50) (V2 (-1) 50)
@@ -90,7 +89,6 @@ airlock0 =
, _rmBound = [rectNSWE 75 15 0 40, switchcut]
}
where
thewall = defaultDoorWall
switchcut = rectNSWE 65 35 (-40) 20
lnks =
[ (V2 20 95, 0)
@@ -99,22 +97,19 @@ airlock0 =
col = dim $ dim $ bright red
airlockDoubleDoor ::
Point2 ->
Point2 ->
WdBl ->
Float ->
Point2A ->
Point2A ->
Float ->
Point2A ->
Point2A ->
Maybe Placement
airlockDoubleDoor p1 p2 cond l1 x1 y1 l2 x2 y2 =
jspsJ p1 0 (putDoor cond l1 x1 y1) $
sPS p2 0 (putDoor cond l2 x2 y2)
airlockDoubleDoor cond l x1 y1 x2 y2 =
jspsJ 0 0 (putDoor cond l x1 y1) $
sPS 0 0 (putDoor cond l x2 y2)
putDoor :: WdBl -> Float -> Point2A -> Point2A -> PSType
putDoor cond l p1 p2 = PutDoor' dr wl
putDoor cond l p1 p2 = PutDoor dr wl
where
wl = defaultDoorWall
dr = defaultDoor
@@ -125,26 +120,26 @@ putDoor cond l p1 p2 = PutDoor' dr wl
& drFootPrint .~ IM.fromList (zip [0..] $ wlps')
wlps' = rectanglePairs 9 0 (V2 l 0)
airlockSimple :: Room
airlockSimple =
defaultRoom
airlockSimple :: RandomGen g => State g Room
airlockSimple = do
light1 <- mntLightLnkCond $ resetPLUse $ rprBool $ \rp _ -> isInLnk rp
light2 <- mntLightLnkCond $ resetPLUse $ rprBool $ \rp _ -> isOutLnk rp
return $ defaultRoom
{ _rmPolys =
[rectNSWE 120 0 0 180]
, _rmLinks = map (uncurry outLink) (init lnks) ++ [uncurry inLink $ last lnks]
, _rmPath = foldMap (doublePairSet . (V2 90 30,) . fst) lnks
, _rmPmnts =
[ pContID (PS (V2 90 115) pi) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
[ light1,light2,
pContID (PS (V2 90 115) pi) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
\btid ->
airlockDoubleDoor
0
(V2 180 0)
(WdBlBtOn btid)
l1
x1
y1
l2
x2
y2
55
(0, pi / 2)
(0, 0)
(V2 180 0, pi / 2)
(V2 180 0, pi)
-- outDoorps inDoorps
]
, _rmBound =
@@ -156,12 +151,6 @@ airlockSimple =
, (V2 180 30, 1.5 * pi)
]
col = dim $ dim $ bright red
l1 = 55
l2 = 55
x1 = (0, pi / 2)
y1 = (0, 0)
y2 = (0, pi / 2)
x2 = (0, pi)
airlockZ :: RandomGen g => State g Room
airlockZ = do
@@ -180,15 +169,12 @@ airlockZ = do
[ pContID (PS (V2 90 115) pi) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
\btid ->
airlockDoubleDoor
(V2 0 60)
(V2 180 60)
(WdBlBtOn btid)
l1
x1
y1
l2
x2
y2
61
(V2 0 60, - pi / 2)
(V2 0 60, 0)
(V2 180 60, - pi)
(V2 180 60, - pi / 2)
, sps0 $ PutWall (reverse $ rectNSWE 70 50 60 120) defaultWall
, lighting
]
@@ -198,15 +184,6 @@ airlockZ = do
where
lnks = muout [(V2 0 30, pi / 2)] ++ muin [(V2 180 30, 1.5 * pi)]
col = dim $ dim $ bright red
l1 = 61
l2 = 61
x1 = (0, - pi / 2)
y1 = (0, 0)
x2 = (0, - pi)
y2 = (0, - pi / 2)
-- outDoorps = (V2 0 0,) <$> arcStepwise 3 (pi / 2) (V2 0 0) (V2 0 (-61))
-- inDoorps = (V2 0 0,) <$> arcStepwise 3 (pi / 2) (V2 0 0) (V2 (-61) 0)
airlock90 :: Room
airlock90 =
+1 -2
View File
@@ -41,6 +41,5 @@ triggerDoorRoom i =
where
f gw = fromMaybe (error "tried to put a door using an empty placement list") $ do
pmnt <- gw ^? genPmnt . ix i
return $ putDoubleDoor False
defaultDoorWall (cond pmnt) (V2 0 20) (V2 40 20) 2
return $ putDoubleDoor defaultDoorWall (cond pmnt) (V2 0 20) (V2 40 20) 2
cond pmnt = WdTrig $ fromJust (_plMID pmnt)
+1 -1
View File
@@ -138,7 +138,7 @@ addButtonSlowDoor x h rm = do
col
(rprBool (isUnusedLnkType InLink))
$ \btplmnt -> Just $
putDoubleDoorThen False
putDoubleDoorThen
thewall
(WdBlBtOn $ fromJust $ _plMID btplmnt)
30
-1
View File
@@ -332,7 +332,6 @@ centerVaultRoom w h d =
jspsJ (V2 0 (d -10)) 0 (putSlideDr (thedoor btid) thewall 1 (V2 (-21) 0) (V2 0 0)) $
sPS (V2 0 (d -10)) 0 (putSlideDr (thedoor btid) thewall 1 (V2 21 0) (V2 0 0))
]
--thewall = switchWallCol col
thewall = defaultDoorWall
thedoor btid =
defaultDoor
+1
View File
@@ -45,6 +45,7 @@ tutAnoTree = do
foldMTRS
[ tToBTree "TutStartRez" . return . cleatOnward <$> tutRezBox
, corDoor
, tToBTree "x" . return . cleatOnward <$> airlockSimple
-- , tToBTree "lastun" . return . cleatOnward <$> tanksRoom [] []
-- , return $ tToBTree "cor" $ return $ cleatOnward corridor
-- , return $ tToBTree "cor" $ return $ cleatOnward corridor