Allow for more complex placement positioning
This commit is contained in:
@@ -38,11 +38,14 @@ data PSType = PutCrit {_unPutCrit :: Creature}
|
||||
data PlacementSpot
|
||||
= PS { _psPos :: Point2 , _psRot :: Float }
|
||||
| PSPos
|
||||
{ _psLnkShift :: RoomPos -> Maybe (PlacementSpot, RoomPos)
|
||||
, _psLnkRoomEff :: RoomPos -> Room -> Room
|
||||
, _psLnkFallback :: Maybe Placement
|
||||
{ _psSelect :: RoomPos -> Room -> Maybe (PlacementSpot, RoomPos)
|
||||
, _psRoomEff :: RoomPos -> Room -> Room
|
||||
, _psFallback :: Maybe Placement
|
||||
}
|
||||
| PSRoomRand
|
||||
{ _psRoomRandPointNum :: Int
|
||||
, _psRandShift :: (Point2,Float) -> PlacementSpot
|
||||
}
|
||||
| PSRoomRand { _psRoomRandPointNum :: Int }
|
||||
data Placement = Placement
|
||||
{ _plSpot :: PlacementSpot
|
||||
, _plType :: PSType
|
||||
@@ -82,6 +85,7 @@ data Room = Room
|
||||
, _rmTakeFrom :: Maybe Int
|
||||
, _rmStartWires :: IM.IntMap RoomWire
|
||||
, _rmEndWires :: IM.IntMap RoomWire
|
||||
, _rmConnectsTo :: S.Set RoomLinkType
|
||||
}
|
||||
data RoomLink = RoomLink
|
||||
{ _rlType :: S.Set RoomLinkType
|
||||
@@ -92,6 +96,13 @@ data RoomLinkType
|
||||
= OutLink
|
||||
| InLink
|
||||
| LabLink Int
|
||||
| OnEdge CardinalPoint
|
||||
deriving (Eq,Ord)
|
||||
data CardinalPoint
|
||||
= North
|
||||
| East
|
||||
| South
|
||||
| West
|
||||
deriving (Eq,Ord)
|
||||
data RoomWire
|
||||
= --RoomWire Point2 Float
|
||||
@@ -112,9 +123,13 @@ data RoomPos
|
||||
{_rpPos :: Point2
|
||||
,_rpDir ::Float
|
||||
}
|
||||
| PosPl
|
||||
| UsedSpot
|
||||
{_rpPos :: Point2
|
||||
,_rpDir ::Float
|
||||
,_rpDir :: Float
|
||||
}
|
||||
| UnusedSpot
|
||||
{_rpPos :: Point2
|
||||
,_rpDir :: Float
|
||||
}
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
@@ -144,7 +159,7 @@ sps :: PlacementSpot -> PSType -> Placement
|
||||
sps ps pt = Placement ps pt Nothing (const Nothing)
|
||||
|
||||
plRRpt :: Int -> PSType -> Placement
|
||||
plRRpt i pt = Placement (PSRoomRand i) pt Nothing (const Nothing)
|
||||
plRRpt i pt = Placement (PSRoomRand i (uncurry PS)) pt Nothing (const Nothing)
|
||||
|
||||
jsps :: Point2 -> Float -> PSType -> Maybe Placement
|
||||
jsps p a pst = Just $ Placement (PS p a) pst Nothing $ const Nothing
|
||||
|
||||
Reference in New Issue
Block a user