Move towards more usable placements

This commit is contained in:
2021-11-13 00:04:50 +00:00
parent 67e164c830
commit b243479759
13 changed files with 167 additions and 208 deletions
+5 -5
View File
@@ -27,7 +27,7 @@ airlock0 = defaultRoom
, _rmLinks = lnks
, _rmPath = [(V2 20 95,V2 20 45) ,(V2 20 45,V2 20 5) ]
, _rmPmnts =
[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) Nothing
$ \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
,spanLightI (V2 (-2) 30) (V2 (-2) 70)
@@ -49,7 +49,7 @@ airlockSimple = defaultRoom
, _rmLinks = lnks
, _rmPath = concatMap (doublePair. (V2 90 30,) . fst) lnks
, _rmPmnts =
[ Placement (PS (V2 90 115) pi) (PutButton $ makeSwitch col red id id)
[ Placement (PS (V2 90 115) pi) (PutButton $ makeSwitch col red id id) Nothing
$ \btid -> jspsJ (V2 0 0) 0 (PutDoor col (cond btid) outDoorps)
$ sPS (V2 180 0) 0 (PutDoor col (cond btid) inDoorps)
]
@@ -78,7 +78,7 @@ airlockZ = defaultRoom
-- ,(V2 40 0,V2 0 40)
-- ]
, _rmPmnts =
[ Placement (PS (V2 90 115) pi) (PutButton $ makeSwitch col red id id)
[ Placement (PS (V2 90 115) pi) (PutButton $ makeSwitch col red id id) Nothing
$ \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
@@ -118,7 +118,7 @@ airlock90 = defaultRoom
,(V2 40 0,V2 0 40)
]
, _rmPmnts =
[ 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) Nothing
$ \btid -> jsps (V2 5 5) 0 $ PutDoor col (cond btid) pss
,mountLightV (V2 20 20) (V3 70 70 50)
]
@@ -146,7 +146,7 @@ airlockCrystal = defaultRoom
, _rmLinks = [(V2 20 130,0) ,(V2 20 0 ,pi) ]
, _rmPath = [ ]
, _rmPmnts =
[ 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) Nothing
$ \btid -> jsps0 $ PutDoor col (cond btid) pss
, crystalLine (V2 0 70) (V2 40 70)
, mountLightV (V2 150 70) (V3 110 70 70)
+5 -6
View File
@@ -5,12 +5,11 @@ module Dodge.Room.Data
import Dodge.LevelGen.Data
import Geometry.Data
import Data.Tile
import Dodge.Data
import Control.Monad.State
import System.Random
import Control.Lens
import qualified Data.IntMap.Strict as IM
--import qualified Data.IntMap.Strict as IM
{-
The '_rmPolys' list states which polygons should be cut out to form the indestructible walls of the room.
Link pairs contain a position and rotation to attach to another room;
@@ -26,16 +25,16 @@ data Room = Room
, _rmPos :: [RoomPos]
, _rmPath :: [(Point2, Point2)]
, _rmPmnts :: [Placement]
, _rmTriggers :: IM.IntMap (World -> Bool)
, _rmTriggerPmnts :: IM.IntMap ((World -> Bool) -> Placement)
, _rmPartialPmnt :: Maybe (Int -> Placement)
, _rmExtendedPmnt :: Maybe Placement
, _rmBound :: [ [Point2] ]
, _rmFloor :: [Tile]
, _rmName :: String
, _rmShift :: (Point2, Float)
, _rmViewpoints :: [Point2]
, _rmRandPSs :: [State StdGen (Point2,Float)]
, _rmLabel :: Maybe Int
, _rmTakeFrom :: Maybe Int
, _rmLabel :: Maybe Int
, _rmTakeFrom :: Maybe Int
}
data RoomPos
= OutLink Int Point2 Float
+2 -4
View File
@@ -5,9 +5,9 @@ import Geometry
import Dodge.Room.Data
import Dodge.Default.Room
import Dodge.Placements
import Color
--import Color
import qualified Data.IntMap.Strict as IM
--import qualified Data.IntMap.Strict as IM
door :: Room
door = defaultRoom
@@ -30,8 +30,6 @@ switchDoor = defaultRoom
, _rmLinks = lnks
, _rmPath = [(V2 20 35,V2 20 5)]
-- door extends into side walls (for shadows as rendered 12/03)
, _rmTriggerPmnts = IM.fromList
[(0,\cond -> putDoubleDoor False red cond (V2 0 20) (V2 40 20) 2)]
-- note no bounds
}
where
+1 -1
View File
@@ -39,7 +39,7 @@ twinSlowDoorRoom w h x = defaultRoom
]
, _rmPath = []
, _rmPmnts =
[ Placement (PS (V2 0 (h-5)) pi) ( PutButton $ makeButton col id)
[ Placement (PS (V2 0 (h-5)) pi) ( PutButton $ makeButton col id) Nothing
$ \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
@@ -175,7 +175,7 @@ fillNothingPlacement :: PSType -> Room -> Room
fillNothingPlacement pst r =
r & rmPmnts %~ 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.
@@ -237,7 +237,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) Nothing
$ \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)
]