{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TemplateHaskell #-} module Dodge.Data.Beam where import TH.Derive import Data.Store import Data.Binary import Flat import Color import Control.Lens import Data.Aeson import Data.Aeson.TH import Geometry.Data {- | Linear beams. Last only one frame. - Can interact with one another in a limited manner - can probably be moved to a separate file -} data Beam = Beam { _bmDraw :: BeamDraw -- Beam -> Picture , _bmPos :: Point2 , _bmDir :: Float , _bmDamage :: Int , _bmColor :: Color , _bmPoints :: [Point2] , _bmFirstPoints :: [Point2] , _bmRange :: Float , _bmPhaseV :: Float , _bmOrigin :: Maybe Int , _bmType :: BeamType } deriving (Eq, Ord, Show, Read, Generic, Flat) data BeamDraw = BasicBeamDraw | BeamDrawColor Color deriving (Eq, Ord, Show, Read, Generic, Flat) data BeamCombineType = FlameBeamCombine | LasBeamCombine | TeslaBeamCombine | SplitBeamCombine | NoBeamCombine deriving (Eq, Ord, Show, Read, Generic, Flat) data BeamType = BeamCombine { _beamCombine :: BeamCombineType -- (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World } | BeamSimple deriving (Eq, Ord, Show, Read, Generic, Flat) makeLenses ''BeamType makeLenses ''Beam deriveJSON defaultOptions ''BeamType deriveJSON defaultOptions ''Beam deriveJSON defaultOptions ''BeamDraw deriveJSON defaultOptions ''BeamCombineType $($(derive [d| instance Deriving (Store Beam ) |])) $($(derive [d| instance Deriving (Store BeamDraw) |])) $($(derive [d| instance Deriving (Store BeamCombineType) |])) $($(derive [d| instance Deriving (Store BeamType) |]))