Separate placement spot from placement type

This commit is contained in:
2021-11-02 21:12:11 +00:00
parent 59f43a3602
commit 0b058674ea
16 changed files with 77 additions and 85 deletions
+4 -4
View File
@@ -25,10 +25,10 @@ airlock0 = defaultRoom
, _rmLinks = lnks
, _rmPath = [(V2 20 95,V2 20 45) ,(V2 20 45,V2 20 5) ]
, _rmPS =
[Placement (PS (V2 (-35) 50) (negate $ pi/2) $ PutButton $ makeSwitch col red id id)
[Placement (PS (V2 (-35) 50) (negate $ pi/2)) (PutButton $ makeSwitch col red id id)
$ \btid -> Just $ putDoubleDoorThen False col (not . cond' btid) (V2 (-1) 20) (V2 41 20) 2
$ Just $ putDoubleDoorThen False col (cond' btid) (V2 (-1) 80) (V2 41 80) 2 Nothing
,mountLightI 70 (V2 (-2) 30) (V2 (-2) 70)
,spanLightI 70 (V2 (-2) 30) (V2 (-2) 70)
,sps0 $ PutForeground $ thinHighBar 75 (V2 40 50) (V2 (-1) 50)
]
, _rmBound = [rectNSWE 75 15 0 40]
@@ -61,7 +61,7 @@ airlock90 = defaultRoom
,(V2 40 0,V2 0 40)
]
, _rmPS =
[ Placement (PS (V2 120 120) (3 * pi/4) (PutButton $ makeSwitch col red id id))
[ Placement (PS (V2 120 120) (3 * pi/4)) ((PutButton $ makeSwitch col red id id))
$ \btid -> jsps (V2 5 5) 0 $ PutDoor col (cond btid) pss
,mountLightV (V2 20 20) (V3 70 70 50)
]
@@ -89,7 +89,7 @@ airlockCrystal = defaultRoom
, _rmLinks = [(V2 20 130,0) ,(V2 20 0 ,pi) ]
, _rmPath = [ ]
, _rmPS =
[ Placement (PS (V2 145 70) (pi/2) (PutButton $ makeSwitch col red id id))
[ Placement (PS (V2 145 70) (pi/2)) ( (PutButton $ makeSwitch col red id id))
$ \btid -> jsps0 $ PutDoor col (cond btid) pss
, crystalLine (V2 0 70) (V2 40 70)
, mountLightV (V2 150 70) (V3 110 70 70)
+2 -2
View File
@@ -97,8 +97,8 @@ roomCross x y = defaultRoom
]
, _rmPath = []
, _rmPS =
[ mountLightI 70 (V2 (x+5) x) (V2 (x+5) (-x))
, mountLightI 70 (V2 (-x-5) x) (V2 (-x-5) (-x))
[ spanLightI 70 (V2 (x+5) x) (V2 (x+5) (-x))
, spanLightI 70 (V2 (-x-5) x) (V2 (-x-5) (-x))
]
, _rmBound =
[rectNSWE y (-y) (-x) x
+1 -1
View File
@@ -17,7 +17,7 @@ corridor = defaultRoom
{ _rmPolys = [poly]
, _rmLinks = lnks
, _rmPath = concatMap (doublePair . (,) (V2 20 60) . fst) lnks
, _rmPS = [ mountLightI 50 (V2 0 40) (V2 40 40) ]
, _rmPS = [ spanLightI 50 (V2 0 40) (V2 40 40) ]
, _rmBound = [ rectNSWE 50 30 0 40 ]
, _rmFloor = [makeTileFromPoly poly 2]
}
+11 -3
View File
@@ -110,12 +110,13 @@ girderV h d w x y = colorSH red $ mconcat $
evenDouble (a:_:xs) = a:a:evenDouble xs
evenDouble xs = xs
girder
:: Float -- ^ height
girderCol
:: Color
-> Float -- ^ height
-> Float -- ^ distance between cross bars
-> Float -- ^ width
-> Point2 -> Point2 -> Shape
girder h d w x y = colorSH red $ mconcat $
girderCol col h d w x y = colorSH col $ mconcat $
[ thinHighBar h xt yt
, thinHighBar h xb yb
]
@@ -129,6 +130,13 @@ girder h d w x y = colorSH red $ mconcat $
ps = divideLineExact d xb yb
qs = divideLineExact d xt yt
girder
:: Float -- ^ height
-> Float -- ^ distance between cross bars
-> Float -- ^ width
-> Point2 -> Point2 -> Shape
girder = girderCol red
robotArm :: Shape
robotArm = undefined
+1 -1
View File
@@ -39,7 +39,7 @@ twinSlowDoorRoom w h x = defaultRoom
]
, _rmPath = []
, _rmPS =
[ Placement (PS (V2 0 (h-5)) pi $ PutButton $ makeButton col id)
[ Placement (PS (V2 0 (h-5)) pi) ( PutButton $ makeButton col id)
$ \btid -> jsps0J (PutSlideDoor False col (cond' btid) (V2 x 1) (V2 x h) wlSpeed)
$ ps0 (PutSlideDoor False col (cond' btid) (V2 (-x) 1) (V2 (-x) h) wlSpeed)
$ \did -> jps0 (PutLS (colorLightAt (V3 0.75 0 0) (V3 0 (h-1) lampHeight) 0))
+2 -2
View File
@@ -169,7 +169,7 @@ fillNothingPlacement :: PSType -> Room -> Room
fillNothingPlacement pst r =
r & rmPS %~ replaceNothingWith pst
where
replaceNothingWith x (Placement (PS p rot PutNothing) _: pss) = sPS p rot x : pss
replaceNothingWith x (Placement (PS p rot) PutNothing _: pss) = sPS p rot x : pss
replaceNothingWith x (ps:pss) = ps : replaceNothingWith x pss
replaceNothingWith _ [] = []
{- | Successively fill 'PutNothing' placements with a list of given 'PSType's.
@@ -231,7 +231,7 @@ centerVaultRoom w h d = do
where
col = dim $ dim $ bright red
theDoor =
[ Placement (PS (V2 35 (d+4)) 0 $ PutButton $ makeSwitch col red id id)
[ Placement (PS (V2 35 (d+4)) 0) (PutButton $ makeSwitch col red id id)
$ \btid -> jspsJ (V2 0 (d-10)) 0 (PutSlideDoor False col (cond' btid) (V2 (-21) 0) (V2 0 0) 2)
$ sPS (V2 0 (d-10)) 0 (PutSlideDoor False col (cond' btid) (V2 21 0) (V2 0 0) 2)
]
+2 -2
View File
@@ -42,7 +42,7 @@ litCorridor90 = do
]
, _rmPS =
[ sPS (V2 20 (h-5)) 0 putLamp
, mountLightI 70 (V2 0 (0.4*h)) (V2 40 (0.4*h))
, spanLightI 70 (V2 0 (0.4*h)) (V2 40 (0.4*h))
, windowLine (V2 0 (h-20)) (V2 40 (h-20))
, sPS (V2 (-50) (h-85)) 0 putLamp
, windowLine (V2 (-40) (h-60)) (V2 (-40) (h-100))
@@ -75,6 +75,6 @@ blockedCorridor = do
let plmnts =
[sPS (V2 20 40) r $ PutBlock [5,5,5] (V4 (150/256) ( 75/256) 0 ( 250/256))
$ reverse $ rectNSWE 10 (-10) (-10) 10
,mountLightI 55 (V2 0 15) (V2 40 15)
,spanLightI 55 (V2 0 15) (V2 40 15)
]
sequence $ treeFromPost [] $ return $ Right $ set rmPS plmnts corridor
+1 -1
View File
@@ -21,7 +21,7 @@ import System.Random
rezBox :: Room
rezBox = shiftRoomBy (V2 (-20) (-10),0) $ roomRect 40 20 1 1
& rmPS .~ [ mountColLightI (V3 0 0.7 0.2) 70 (V2 0 10) (V2 40 10) ]
& rmPS .~ [ spanColLightI (V3 0 0.7 0.2) 70 (V2 0 10) (V2 40 10) ]
startRoom :: RandomGen g => State g (Tree (Either Room Room))
startRoom = do