Add rooms, placements and room positions

This commit is contained in:
2022-03-08 22:57:58 +00:00
parent 2e1c7f2687
commit ff6064a3b6
14 changed files with 315 additions and 138 deletions
+23 -4
View File
@@ -104,13 +104,15 @@ data RoomLinkType
| InLink
| LabLink Int
| OnEdge CardinalPoint
deriving (Eq,Ord)
| FromSouth Int
| FromWest Int
deriving (Eq,Ord,Show)
data CardinalPoint
= North
| East
| South
| West
deriving (Eq,Ord)
deriving (Eq,Ord,Show)
data RoomWire
= --RoomWire Point2 Float
WallWire Point2 Float Float
@@ -120,32 +122,49 @@ data RoomPos
,_rpOutRoomID :: Int
,_rpPos :: Point2
,_rpDir :: Float
,_rpLinkType :: S.Set RoomLinkType
}
| UsedInLink
{_rpInRoomID :: Int
,_rpPos :: Point2
,_rpDir ::Float
,_rpDir :: Float
,_rpLinkType :: S.Set RoomLinkType
}
| UnusedLink
{_rpPos :: Point2
,_rpDir ::Float
,_rpLinkType :: S.Set RoomLinkType
}
| UsedLink
{_rpPos :: Point2
,_rpDir :: Float
,_rpLinkType :: S.Set RoomLinkType
}
| UsedSpot
{_rpPos :: Point2
,_rpDir :: Float
,_rpType :: S.Set RoomPosType
}
| UnusedSpot
{_rpPos :: Point2
,_rpDir :: Float
,_rpType :: S.Set RoomPosType
}
deriving (Eq,Ord,Show)
data RoomPosType
= RoomPosOnPath
| RoomPosOffPath
| RoomPosExLink
deriving (Eq,Ord,Show)
makeLenses ''Room
makeLenses ''PSType
makeLenses ''PlacementSpot
makeLenses ''Placement
makeLenses ''RoomLink
makeLenses ''RoomPos
makeLenses ''RoomPosType
spNoID :: PlacementSpot -> PSType -> Placement
spNoID ps pst = Placement ps pst Nothing (const Nothing)
@@ -196,7 +215,7 @@ jps0 :: PSType -> (Int -> Maybe Placement) -> Maybe Placement
jps0 pst = Just . Placement (PS (V2 0 0) 0) pst Nothing . contToIDCont
jps0PushPS :: PSType -> (Int -> Maybe Placement) -> Maybe Placement
jps0PushPS pst f = Just . Placement (PS (V2 0 0) 0) pst Nothing
jps0PushPS pst f = Just . Placement (PSNoShiftCont (V2 0 0) 0) pst Nothing
$ \plmnt -> f (fromJust $ _plMID plmnt) <&> plSpot .~ _plSpot plmnt
ps0j :: PSType -> Placement -> Placement