Implement randomised markings on sensors
This commit is contained in:
@@ -1,24 +1,33 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
--{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.LevelGen.LevelStructure where
|
||||
module Dodge.LevelGen.LevelStructure
|
||||
( module Dodge.LevelGen.Data
|
||||
, worldToGenWorld
|
||||
) where
|
||||
import Dodge.LevelGen.Data
|
||||
--import Dodge.Tree.Compose.Data
|
||||
import Dodge.Data
|
||||
import Dodge.RandomHelp
|
||||
import Color
|
||||
|
||||
--import Data.Tree
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
--import System.Random
|
||||
import qualified Data.Map.Strict as M
|
||||
--import Control.Lens
|
||||
import Control.Monad.State
|
||||
import System.Random
|
||||
|
||||
data GenWorld = GenWorld
|
||||
{ _gWorld :: World
|
||||
, _gPlacements :: IM.IntMap [(Placement,Int)]
|
||||
, _gRooms :: IM.IntMap Room
|
||||
}
|
||||
worldToGenWorld :: IM.IntMap Room -> World -> GenWorld
|
||||
worldToGenWorld rms w = GenWorld
|
||||
{ _gWorld = w
|
||||
, _gPlacements = IM.empty
|
||||
, _gRooms = rms
|
||||
, _gParams = evalState generateGenParams (_randGen w)
|
||||
}
|
||||
makeLenses ''GenWorld
|
||||
|
||||
generateGenParams :: RandomGen g => State g GenParams
|
||||
generateGenParams = do
|
||||
cols <- shuffle [Red .. Orange]
|
||||
shps <- shuffle [PlusDecoration ..]
|
||||
return . GenParams . M.fromList . zip [Flaming,Lasering,Electrical]
|
||||
$ zip cols shps
|
||||
|
||||
Reference in New Issue
Block a user