diff options
Diffstat (limited to 'src/Xanthous/Generators.hs')
-rw-r--r-- | src/Xanthous/Generators.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Xanthous/Generators.hs b/src/Xanthous/Generators.hs index 832a3d8fdc1d..7bcf4da0515e 100644 --- a/src/Xanthous/Generators.hs +++ b/src/Xanthous/Generators.hs @@ -12,6 +12,7 @@ module Xanthous.Generators , Level(..) , levelWalls , levelItems + , levelCreatures , levelCharacterPosition , generateLevel ) where @@ -29,7 +30,8 @@ import Xanthous.Data (Dimensions, Position(Position)) import Xanthous.Data.EntityMap (EntityMap) import qualified Xanthous.Data.EntityMap as EntityMap import Xanthous.Entities.Environment -import Xanthous.Entities.Item +import Xanthous.Entities.Item (Item) +import Xanthous.Entities.Creature (Creature) -------------------------------------------------------------------------------- data Generator = CaveAutomata @@ -38,9 +40,6 @@ data Generator = CaveAutomata data SGenerator (gen :: Generator) where SCaveAutomata :: SGenerator 'CaveAutomata -data AGenerator where - AGenerator :: forall gen. SGenerator gen -> AGenerator - type family Params (gen :: Generator) :: Type where Params 'CaveAutomata = CaveAutomata.Params @@ -89,9 +88,10 @@ cellsToWalls cells = foldl' maybeInsertWall mempty . assocs $ cells -------------------------------------------------------------------------------- data Level = Level - { _levelWalls :: EntityMap Wall - , _levelItems :: EntityMap Item - , _levelCharacterPosition :: Position + { _levelWalls :: !(EntityMap Wall) + , _levelItems :: !(EntityMap Item) + , _levelCreatures :: !(EntityMap Creature) + , _levelCharacterPosition :: !Position } makeLenses ''Level @@ -101,5 +101,6 @@ generateLevel gen ps dims = do let cells = generate gen ps dims rand _levelWalls = cellsToWalls cells _levelItems <- randomItems cells + _levelCreatures <- randomCreatures cells _levelCharacterPosition <- chooseCharacterPosition cells pure Level {..} |