Files
loop/src/Dodge/LevelGen/Data.hs
T
2021-09-28 15:44:32 +01:00

61 lines
1.5 KiB
Haskell

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.LevelGen.Data
( PSType (..)
, PlacementSpot (..)
, Placement (..)
, sPS
-- lenses
, placementSpot
, psType
, psPos
, psRot
, putID
, pwPoly
, pwWall
, unPutCrit
-- , groupPlacementID
-- , groupUpdate
, idPlacement
) where
import Dodge.Data
import Picture
import Geometry.Data
import Shape.Data
import Control.Lens
import Control.Monad.State
import System.Random
data PSType = PutCrit {_unPutCrit :: Creature}
| PutLS LightSource Picture
| PutButton Button
| PutProp Prop
| PutFlIt Item
| PutPressPlate PressPlate
| PutAutoDoor Point2 Point2
| PutBlock [Int] Color [Point2]
| PutLineBlock Wall Float Float Point2 Point2
| PutWall { _pwPoly :: [Point2] , _pwWall :: Wall }
| PutDoubleDoor Color (World -> Bool) Point2 Point2 Float
| PutSingleDoor Color (World -> Bool) Point2 Point2 Float
| PutDoor Color (World -> Bool) [(Point2,Point2)]
| PutBtDoor Color Point2 Float Point2 Point2 Float
| RandPS (State StdGen PSType)
| PutForeground Shape
| PutNothing
| PutID { _putID :: Int}
data PlacementSpot = PS
{ _psPos :: Point2
, _psRot :: Float
, _psType :: PSType
}
data Placement = Placement
{ _placementSpot :: PlacementSpot
, _idPlacement :: Int -> Maybe Placement
}
sPS :: Point2 -> Float -> PSType -> Placement
sPS p a pt = Placement (PS p a pt) (const Nothing)
makeLenses ''PSType
makeLenses ''PlacementSpot
makeLenses ''Placement