Fix one bug in door wall movement, add airlock, cleanup

This commit is contained in:
2021-11-06 01:06:04 +00:00
parent 5a52b646e1
commit 4c6437da26
5 changed files with 64 additions and 14 deletions
+55 -1
View File
@@ -5,6 +5,7 @@ import Dodge.Room.Data
import Dodge.Placements
import Dodge.Room.Foreground
import Dodge.Default.Room
import Dodge.Default.Wall
import Dodge.Data
import Dodge.LevelGen.Data
import Dodge.LevelGen.Switch
@@ -17,7 +18,8 @@ import System.Random
import Control.Monad.State
{- | A passage with a switch that opens forward access while closing backwards access. -}
airlock :: RandomGen g => State g Room
airlock = takeOne [airlock0,airlock90,airlockCrystal]
--airlock = takeOne [airlock0,airlock90,airlockCrystal,airlockZ]
airlock = takeOne [airlockZ]
{- | Straight airlock -}
airlock0 :: Room
airlock0 = defaultRoom
@@ -40,6 +42,58 @@ airlock0 = defaultRoom
cond' btid w' = _btState (_buttons w' IM.! btid) == BtOn
col = dim $ dim $ bright red
airlockSimple :: Room
airlockSimple = defaultRoom
{ _rmPolys =
[ rectNSWE 120 0 0 180 ]
, _rmLinks = lnks
, _rmPath = concatMap (doublePair. (V2 90 30,) . fst) lnks
, _rmPS =
[ Placement (PS (V2 90 115) pi) (PutButton $ makeSwitch col red id id)
$ \btid -> jspsJ (V2 0 0) 0 (PutDoor col (cond btid) outDoorps)
$ sPS (V2 180 0) 0 (PutDoor col (cond btid) inDoorps)
]
, _rmBound =
[ rectNSWE 120 0 0 180 ]
}
where
lnks =
[(V2 0 30,pi/2)
,(V2 180 30,1.5*pi)
]
cond btid w' = _btState (_buttons w' IM.! btid) == BtOn
col = dim $ dim $ bright red
outDoorps = (V2 0 0 ,) <$> arcStepwise 3 (negate $ pi/2) (V2 0 0) (V2 0 55)
inDoorps = (V2 0 0 ,) <$> arcStepwise 3 (negate $ pi/2) (V2 0 0) (V2 (-55) 0)
airlockZ :: Room
airlockZ = defaultRoom
{ _rmPolys =
[ rectNSWE 120 0 0 180 ]
, _rmLinks =
[(V2 0 30,pi/2)
,(V2 180 30,1.5*pi)
]
, _rmPath = []
-- [(V2 0 40,V2 40 0)
-- ,(V2 40 0,V2 0 40)
-- ]
, _rmPS =
[ Placement (PS (V2 90 115) pi) (PutButton $ makeSwitch col red id id)
$ \btid -> jspsJ (V2 0 60) 0 (PutDoor col (cond btid) outDoorps)
$ sPS (V2 180 60) 0 (PutDoor col (cond btid) inDoorps)
, sps0 $ PutWall (rectNSEW 70 50 120 60) defaultWall
, mountLightV (V2 90 60) (V3 90 40 50)
, mountLightV (V2 90 60) (V3 90 80 50)
]
, _rmBound =
[ rectNSWE 120 0 0 180 ]
}
where
cond btid w' = _btState (_buttons w' IM.! btid) == BtOn
col = dim $ dim $ bright red
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 = defaultRoom
{ _rmPolys =