Implement randomised markings on sensors

This commit is contained in:
2022-03-13 19:59:46 +00:00
parent 06a501ff88
commit 1b6f11709c
16 changed files with 169 additions and 95 deletions
+19 -10
View File
@@ -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