Function for adding random lights to roomNGon

This commit is contained in:
2026-03-19 11:40:49 +00:00
parent d1c2870d63
commit 508b848204
20 changed files with 453 additions and 336 deletions
+12 -1
View File
@@ -100,6 +100,8 @@ data PlacementSpot
| PSNoShiftCont {_psPos :: Point2, _psRot :: Float}
| PSPos
{ _psSelect :: RoomPos -> Room -> Maybe (PlacementSpot, RoomPos)
-- looks for the first rp for which a rp rm returns Just (ps,rp'),
-- replaces the rp with rp'
, _psRoomEff :: RoomPos -> Room -> Room
, _psFallback :: Maybe Placement
}
@@ -138,7 +140,7 @@ data Room = Room
, _rmPos :: [RoomPos]
, _rmPath :: S.Set (Point2, Point2)
, _rmPmnts :: [Placement]
, _rmInPmnt :: [(Int,GenWorld -> Placement)] -- so far as I can tell,
, _rmInPmnt :: [(Int,GenWorld -> State StdGen Placement)] -- so far as I can tell,
-- the first Int only determines the order in which these are applied
, _rmBound :: [[Point2]]
, _rmFloor :: Floor
@@ -162,3 +164,12 @@ makeLenses ''RoomType
makeLenses ''PSType
makeLenses ''PlacementSpot
makeLenses ''Placement
-- I may regret this. I believe it satisfies associativity, but haven't thought
-- about it too much.
instance Semigroup Placement where
p <> q = p & plIDCont %~ f
where
f g gw pl = case g gw pl of
Nothing -> Just q
Just r -> Just $ r & plIDCont %~ f
+5
View File
@@ -38,6 +38,10 @@ data RoomType
, _rmWidth :: Float
, _rmHeight :: Float
}
| RoomNgon
{ _rmngonSides :: Int
, _rmngonSize :: Float
}
deriving (Eq, Ord)
data RoomLinkType
@@ -81,6 +85,7 @@ data RoomPosFlag
= RoomPosOnGrid {_onGridFromEdges :: S.Set PathFromEdge}
| RoomPosOffGrid {_offGridFromEdges :: S.Set PathFromEdge}
| RoomPosOnFloor
| ColoredLightRP
deriving (Eq, Ord, Show)
data UsedPos