This commit is contained in:
2022-06-14 12:48:48 +01:00
parent 79aab975c8
commit e1f3a774b2
2 changed files with 10 additions and 15 deletions
+6 -13
View File
@@ -16,8 +16,8 @@ import Picture
import qualified Data.IntMap.Strict as IM import qualified Data.IntMap.Strict as IM
{- | A passage with a switch that opens forward access while closing backwards access. -} {- | A passage with a switch that opens forward access while closing backwards access. -}
airlock :: RandomGen g => State g Room airlock :: RandomGen g => State g Room
--airlock = takeOne [airlock0,airlock90,airlockCrystal,airlockZ] airlock = takeOne [airlock0,airlock90,airlockCrystal,airlockZ]
airlock = takeOne [airlockCrystal] --airlock = takeOne [airlockCrystal]
{- | Straight airlock -} {- | Straight airlock -}
airlock0 :: Room airlock0 :: Room
airlock0 = defaultRoom airlock0 = defaultRoom
@@ -129,13 +129,9 @@ airlock90 = defaultRoom
col = dim $ dim $ bright red col = dim $ dim $ bright red
pss = (V2 0 0 ,) <$> arcStepwise 3 (negate $ pi/2) (V2 0 0) (V2 0 55) pss = (V2 0 0 ,) <$> arcStepwise 3 (negate $ pi/2) (V2 0 0) (V2 0 55)
airlockCrystal airlockCrystal :: Room
:: Room
airlockCrystal = defaultRoom airlockCrystal = defaultRoom
{ _rmPolys = { _rmPolys = [ rectNSWE 140 0 0 40 , switchcutout ]
[ rectNSWE 140 0 0 40
, orderPolygon $ map toV2 [ (39,20) , (150,60) , (150,80) , (39,120) ]
]
, _rmLinks = muout[(V2 20 130,0) ] ++ muin[(V2 20 0 ,pi) ] , _rmLinks = muout[(V2 20 130,0) ] ++ muin[(V2 20 0 ,pi) ]
, _rmPath = [ ] , _rmPath = [ ]
, _rmPmnts = , _rmPmnts =
@@ -144,13 +140,10 @@ airlockCrystal = defaultRoom
, crystalLine (V2 0 70) (V2 40 70) , crystalLine (V2 0 70) (V2 40 70)
, mntLS vShape (V2 150 70) (V3 110 70 70) , mntLS vShape (V2 150 70) (V3 110 70 70)
] ]
, _rmBound = , _rmBound = [ rectNSWE 120 20 0 40 , switchcutout ]
[ rectNSWE 120 20 0 40
, orderPolygon $ map toV2 [ (39,20) , (150,60) , (150,80) , (39,120) ]
]
} }
where where
--cond w = or $ M.lookup (DoorNumOpen n) (_worldState w) switchcutout = orderPolygon $ map toV2 [ (39,20) , (150,60) , (150,80) , (39,120) ]
cond btid w' = _btState (_buttons w' IM.! btid) == BtOn cond btid w' = _btState (_buttons w' IM.! btid) == BtOn
col = dim $ dim $ bright red col = dim $ dim $ bright red
pss :: [(Point2,Point2)] pss :: [(Point2,Point2)]
+4 -2
View File
@@ -334,7 +334,9 @@ spawnerRoom :: RandomGen g => State g (Tree Room)
spawnerRoom = do spawnerRoom = do
x <- state $ randomR (250,300) x <- state $ randomR (250,300)
y <- state $ randomR (300,400) y <- state $ randomR (300,400)
roomWithSpawner <- roomC x y <&> roomWithSpawner <- roomC x y <&> rmPmnts .:~ spNoID
rmPmnts .:~ spNoID (PSRoomRand 0 (uncurry PS)) (PutCrit spawnerCrit) (rprBool $ \rp _ -> _rpPlacementUse rp == 0 && RoomPosOnPath `S.member` _rpType rp
&& xV2 (_rpPos rp) < x/2 && yV2 (_rpPos rp) < y/2 )
(PutCrit spawnerCrit)
aRoom <- airlock aRoom <- airlock
return $ treeFromTrunk [ aRoom, corridor] $ pure $ cleatOnward roomWithSpawner return $ treeFromTrunk [ aRoom, corridor] $ pure $ cleatOnward roomWithSpawner