Simplify room out/in placements

This commit is contained in:
2025-09-23 10:14:19 +01:00
parent d1bb8a985b
commit 5ee78ceffc
4 changed files with 25 additions and 26 deletions
+8 -6
View File
@@ -3,6 +3,7 @@
{- Rooms that contain two doors and a switch alternating both. -}
module Dodge.Room.Airlock where
import Data.Maybe
import Control.Lens
import Control.Monad
--import Dodge.Annotation.Data
@@ -41,14 +42,15 @@ decontamRoom i =
]
& rmOutPmnt . at i ?~
analyser (NoItemZone ps) (PS 50 0) (PS mcpos 0)
& rmInPmnt .~ [InPlacement f i]
& rmInPmnt .~ [f]
& rmBound .~ [rectNSWE 75 15 0 40, switchcut]
where
f _ (pmnt : _) = putDoubleDoor DoorObstacle (switchWallCol red) (cond pmnt)
(V2 (-10) 35)
(V2 (-10) 65)
2
f _ _ = error "tried to put a door using an empty placement list"
f gw = fromMaybe (error "tried to put a door using an empty placement list") $ do
pmnt <- gw ^? genPmnt . ix i . _head
return $ putDoubleDoor DoorObstacle (switchWallCol red) (cond pmnt)
(V2 (-10) 35)
(V2 (-10) 65)
2
cond pmnt = WdTrig $ pmnt ^?! plMID . _Just
mcpos = V2 70 50
cutps = [rectNSWE 100 0 0 40, switchcut]
+7 -4
View File
@@ -9,6 +9,7 @@ import Dodge.Default.Room
import Dodge.Placement.Instance
import Dodge.RoomLink
import Geometry
import Control.Lens
door :: Room
door =
@@ -28,17 +29,19 @@ door =
]
triggerDoorRoom :: Int -> Room
triggerDoorRoom inplid =
triggerDoorRoom i =
defaultRoom
{ _rmPolys = [rectNSWE 40 0 0 40]
, _rmLinks = [uncurry outLink (V2 20 35, 0), uncurry inLink (V2 20 5, pi)]
, _rmPath = doublePairSet (V2 20 35, V2 20 5)
, _rmInPmnt = [InPlacement f inplid]
, _rmInPmnt = [f]
, _rmName = "triggerDoorRoom"
-- door extends into side walls (for shadows as rendered 12/03/21)
-- note no bounds
}
where
f _ (pmnt : _) = putDoubleDoor DoorObstacle (switchWallCol red) (cond pmnt) (V2 0 20) (V2 40 20) 2
f _ _ = error "tried to put a door using an empty placement list"
f gw = fromMaybe (error "tried to put a door using an empty placement list") $ do
pmnt <- gw ^? genPmnt . ix i . _head
return $ putDoubleDoor
DoorObstacle (switchWallCol red) (cond pmnt) (V2 0 20) (V2 40 20) 2
cond pmnt = WdTrig $ fromJust (_plMID pmnt)