Allow for more complex placement positioning
This commit is contained in:
@@ -16,6 +16,7 @@ module Dodge.Room.Link
|
||||
, changeLinkTo
|
||||
, changeLinkFrom
|
||||
, randomiseOutLinks
|
||||
, chooseOneInLink
|
||||
) where
|
||||
import Dodge.Placement.PlaceSpot
|
||||
import Dodge.LevelGen.Data
|
||||
@@ -29,6 +30,17 @@ import Control.Monad.State
|
||||
import Control.Lens
|
||||
import Data.List
|
||||
import qualified Data.Set as S
|
||||
--import System.Random
|
||||
|
||||
chooseOneInLink :: RandomGen g => Room -> State g Room
|
||||
chooseOneInLink r = restrictToFstInLink <$> shuffleLinks r
|
||||
|
||||
restrictToFstInLink :: Room -> Room
|
||||
restrictToFstInLink = rmLinks %~ f
|
||||
where
|
||||
f (rl:xs) | S.member InLink (_rlType rl) = rl : restrictLinkType InLink (const False) xs
|
||||
| otherwise = rl : f xs
|
||||
f [] = []
|
||||
|
||||
{- Shuffle the initial links of a room randomly. -}
|
||||
randomiseOutLinks :: RandomGen g => Room -> State g Room
|
||||
|
||||
Reference in New Issue
Block a user