54 lines
1.3 KiB
Haskell
54 lines
1.3 KiB
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
{-# LANGUAGE DeriveAnyClass #-}
|
|
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.Block (
|
|
module Dodge.Data.Block,
|
|
module Dodge.Data.Material,
|
|
module Dodge.Data.PathGraph,
|
|
) where
|
|
|
|
import Data.Set (Set)
|
|
import Color
|
|
import Control.Lens
|
|
import Data.Aeson
|
|
import Data.Aeson.TH
|
|
import qualified Data.IntSet as IS
|
|
import Dodge.Data.Material
|
|
import Dodge.Data.PathGraph
|
|
import Geometry
|
|
import Shape.Data
|
|
|
|
data Block = Block
|
|
{ _blID :: Int
|
|
, _blWallIDs :: IS.IntSet
|
|
, _blHP :: Int
|
|
, _blShadows :: [Int] -- a list of blocks/walls? that are not shown when this block exists
|
|
, _blFootprint :: [Point2]
|
|
, _blPos :: Point2
|
|
, _blDir :: Float
|
|
, _blHeight :: Float
|
|
, _blMaterial :: Material
|
|
, _blDraw :: BlockDraw --Block -> SPic
|
|
, _blObstructs :: Set (Int, Int, PathEdge)
|
|
}
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data BlockDraw
|
|
= BlockDrawMempty
|
|
| BlockDrawBlSh BlSh
|
|
| BlockDraws [BlockDraw]
|
|
| BlockDrawColHeightPoss Color Float [Point2]
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data BlSh
|
|
= BlShMempty
|
|
| BlShConst Shape
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
makeLenses ''Block
|
|
deriveJSON defaultOptions ''BlSh
|
|
deriveJSON defaultOptions ''BlockDraw
|
|
deriveJSON defaultOptions ''Block
|