Attempt to make CWorld correct instance of Store
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Color where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Geometry
|
||||
import LinearHelp
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data PaletteColor = RED | GREEN | BLUE | YELLOW | CYAN
|
||||
| MAGENTA | ROSE | VIOLET | AZURE | AQUAMARINE | CHARTREUSE | ORANGE | WHITE | BLACK
|
||||
@@ -134,3 +139,6 @@ numColor _ = toV4 (1,1,1,1)
|
||||
|
||||
light4 :: Color -> Color
|
||||
light4 = light . light . light . light
|
||||
|
||||
$($(derive [d| instance Deriving (Store PaletteColor) |]))
|
||||
-- $($(derive [d| instance Deriving (Store ProximityRequirement) |]))
|
||||
|
||||
@@ -10,6 +10,8 @@ import Dodge.Data.Creature.Stance
|
||||
import Dodge.Data.CreatureEffect
|
||||
import Geometry.Data
|
||||
import Sound.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ActionPlan
|
||||
= Inanimate
|
||||
@@ -200,3 +202,9 @@ deriveJSON defaultOptions ''Goal
|
||||
makeLenses ''ActionPlan
|
||||
makeLenses ''Impulse
|
||||
makeLenses ''Action
|
||||
$($(derive [d| instance Deriving (Store ActionPlan) |]))
|
||||
$($(derive [d| instance Deriving (Store RandImpulse) |]))
|
||||
$($(derive [d| instance Deriving (Store Impulse) |]))
|
||||
$($(derive [d| instance Deriving (Store Action) |]))
|
||||
$($(derive [d| instance Deriving (Store Strategy) |]))
|
||||
$($(derive [d| instance Deriving (Store Goal) |]))
|
||||
|
||||
@@ -8,6 +8,9 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.CrWlID
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import LinearHelp
|
||||
|
||||
data ArcStep = ArcStep
|
||||
{ _asPos :: Point2
|
||||
@@ -24,3 +27,5 @@ data NextArcStep
|
||||
makeLenses ''ArcStep
|
||||
deriveJSON defaultOptions ''ArcStep
|
||||
deriveJSON defaultOptions ''NextArcStep
|
||||
$($(derive [d| instance Deriving (Store ArcStep) |]))
|
||||
$($(derive [d| instance Deriving (Store NextArcStep) |]))
|
||||
|
||||
@@ -8,6 +8,8 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
{- | Linear beams. Last only one frame.
|
||||
- Can interact with one another in a limited manner
|
||||
@@ -54,3 +56,7 @@ deriveJSON defaultOptions ''BeamType
|
||||
deriveJSON defaultOptions ''Beam
|
||||
deriveJSON defaultOptions ''BeamDraw
|
||||
deriveJSON defaultOptions ''BeamCombineType
|
||||
$($(derive [d| instance Deriving (Store BeamType) |]))
|
||||
$($(derive [d| instance Deriving (Store Beam) |]))
|
||||
$($(derive [d| instance Deriving (Store BeamDraw) |]))
|
||||
$($(derive [d| instance Deriving (Store BeamCombineType) |]))
|
||||
|
||||
@@ -7,6 +7,7 @@ module Dodge.Data.Block (
|
||||
module Dodge.Data.PathGraph,
|
||||
) where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
@@ -16,6 +17,8 @@ import Dodge.Data.Material
|
||||
import Dodge.Data.PathGraph
|
||||
import Geometry
|
||||
import Shape.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Block = Block
|
||||
{ _blID :: Int
|
||||
@@ -48,3 +51,6 @@ makeLenses ''Block
|
||||
deriveJSON defaultOptions ''Block
|
||||
deriveJSON defaultOptions ''BlockDraw
|
||||
deriveJSON defaultOptions ''BlSh
|
||||
$($(derive [d| instance Deriving (Store Block) |]))
|
||||
$($(derive [d| instance Deriving (Store BlockDraw) |]))
|
||||
$($(derive [d| instance Deriving (Store BlSh) |]))
|
||||
|
||||
@@ -6,6 +6,8 @@ module Dodge.Data.Bounds where
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Bounds = Bounds
|
||||
{ _bdMinX :: Float
|
||||
@@ -20,3 +22,4 @@ defaultBounds = Bounds 0 0 0 0
|
||||
|
||||
makeLenses ''Bounds
|
||||
deriveJSON defaultOptions ''Bounds
|
||||
$($(derive [d| instance Deriving (Store Bounds) |]))
|
||||
|
||||
@@ -6,11 +6,14 @@ module Dodge.Data.Bullet
|
||||
, module Dodge.Data.Damage
|
||||
)where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Damage
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Bullet = Bullet
|
||||
{ _buDelayFraction :: Float
|
||||
@@ -32,6 +35,7 @@ data EnergyBallType = IncBall | TeslaBall | ConcBall
|
||||
deriving (Show, Read, Eq, Ord, Enum, Bounded)
|
||||
|
||||
data BulletUpdateMod = NoBulletUpdateMod
|
||||
| ABulletUpdateMod -- hack for template splicing
|
||||
deriving (Show, Read, Eq, Ord, Enum, Bounded)
|
||||
|
||||
data BulletEffect
|
||||
@@ -57,3 +61,9 @@ deriveJSON defaultOptions ''BulletUpdateMod
|
||||
deriveJSON defaultOptions ''BulletEffect
|
||||
deriveJSON defaultOptions ''BulletSpawn
|
||||
deriveJSON defaultOptions ''BulletTrajectory
|
||||
$($(derive [d| instance Deriving (Store Bullet) |]))
|
||||
$($(derive [d| instance Deriving (Store EnergyBallType) |]))
|
||||
$($(derive [d| instance Deriving (Store BulletUpdateMod) |]))
|
||||
$($(derive [d| instance Deriving (Store BulletEffect) |]))
|
||||
$($(derive [d| instance Deriving (Store BulletSpawn) |]))
|
||||
$($(derive [d| instance Deriving (Store BulletTrajectory) |]))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
module Dodge.Data.Button where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
@@ -10,6 +11,8 @@ import Data.Aeson.TH
|
||||
import Dodge.Data.WorldEffect
|
||||
import Geometry.Data
|
||||
import Sound.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ButtonDraw
|
||||
= DefaultDrawButton Color
|
||||
@@ -65,3 +68,7 @@ deriveJSON defaultOptions ''ButtonDraw
|
||||
deriveJSON defaultOptions ''ButtonEvent
|
||||
deriveJSON defaultOptions ''Button
|
||||
deriveJSON defaultOptions ''ButtonState
|
||||
$($(derive [d| instance Deriving (Store ButtonDraw) |]))
|
||||
$($(derive [d| instance Deriving (Store ButtonEvent) |]))
|
||||
$($(derive [d| instance Deriving (Store Button) |]))
|
||||
$($(derive [d| instance Deriving (Store ButtonState) |]))
|
||||
|
||||
@@ -221,6 +221,9 @@ makeLenses ''WorldBeams
|
||||
makeLenses ''CWCam
|
||||
makeLenses ''CWGen
|
||||
makeLenses ''CWTime
|
||||
$($(derive [d|
|
||||
instance Deriving (Store CWorld)
|
||||
|]))
|
||||
|
||||
$($(derive [d| instance Deriving (Store CWorld) |]))
|
||||
$($(derive [d| instance Deriving (Store WorldBeams) |]))
|
||||
$($(derive [d| instance Deriving (Store CWCam) |]))
|
||||
$($(derive [d| instance Deriving (Store CWGen) |]))
|
||||
$($(derive [d| instance Deriving (Store CWTime) |]))
|
||||
|
||||
@@ -5,6 +5,8 @@ module Dodge.Data.CamouflageStatus where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data CamouflageStatus
|
||||
= FullyVisible
|
||||
@@ -12,3 +14,4 @@ data CamouflageStatus
|
||||
deriving (Eq, Ord, Enum, Read, Show, Bounded)
|
||||
|
||||
deriveJSON defaultOptions ''CamouflageStatus
|
||||
$($(derive [d| instance Deriving (Store CamouflageStatus) |]))
|
||||
|
||||
@@ -8,6 +8,8 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data CloudDraw
|
||||
= CloudColor Float Float Color -- radius-multiply fade-time color
|
||||
@@ -34,3 +36,6 @@ makeLenses ''Cloud
|
||||
deriveJSON defaultOptions ''CloudDraw
|
||||
deriveJSON defaultOptions ''Cloud
|
||||
deriveJSON defaultOptions ''CloudType
|
||||
$($(derive [d| instance Deriving (Store CloudDraw) |]))
|
||||
$($(derive [d| instance Deriving (Store Cloud) |]))
|
||||
$($(derive [d| instance Deriving (Store CloudType) |]))
|
||||
|
||||
@@ -3,13 +3,17 @@
|
||||
|
||||
module Dodge.Data.Corpse where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import ShapePicture.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data CorpseResurrection = NoResurrection
|
||||
| HackCorpseRez
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data Corpse = Corpse
|
||||
@@ -24,3 +28,5 @@ data Corpse = Corpse
|
||||
makeLenses ''Corpse
|
||||
deriveJSON defaultOptions ''CorpseResurrection
|
||||
deriveJSON defaultOptions ''Corpse
|
||||
$($(derive [d| instance Deriving (Store CorpseResurrection) |]))
|
||||
$($(derive [d| instance Deriving (Store Corpse) |]))
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
module Dodge.Data.CrGroupParams where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import qualified Data.IntSet as IS
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data CrGroupParams = CrGroupParams
|
||||
{ _crGroupParamID :: Int
|
||||
@@ -18,8 +21,11 @@ data CrGroupParams = CrGroupParams
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data CrGroupUpdate = DefaultCrGroupUpdate
|
||||
| HackCrGroupUpdate
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
makeLenses ''CrGroupParams
|
||||
deriveJSON defaultOptions ''CrGroupParams
|
||||
deriveJSON defaultOptions ''CrGroupUpdate
|
||||
$($(derive [d| instance Deriving (Store CrGroupParams) |]))
|
||||
$($(derive [d| instance Deriving (Store CrGroupUpdate) |]))
|
||||
|
||||
@@ -6,9 +6,12 @@ module Dodge.Data.CrWlID where
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data CrWlID = CrID Int | WlID Int | NothingID -- TODO rewrite/remove this
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
makeLenses ''CrWlID
|
||||
deriveJSON defaultOptions ''CrWlID
|
||||
$($(derive [d| instance Deriving (Store CrWlID) |]))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
module Dodge.Data.Creature (
|
||||
module Dodge.Data.Creature,
|
||||
@@ -14,6 +15,9 @@ module Dodge.Data.Creature (
|
||||
module Dodge.Data.Hammer,
|
||||
) where
|
||||
|
||||
import LinearHelp
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
@@ -73,6 +77,7 @@ data Creature = Creature
|
||||
deriving (Eq, Show, Read)
|
||||
|
||||
data CreatureCorpse = MakeDefaultCorpse
|
||||
| HackDefaultCorpse
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data Intention = Intention
|
||||
@@ -90,3 +95,15 @@ makeLenses ''Intention
|
||||
deriveJSON defaultOptions ''Creature
|
||||
deriveJSON defaultOptions ''CreatureCorpse
|
||||
deriveJSON defaultOptions ''Intention
|
||||
|
||||
{- FOURMOLU_DISABLE -}
|
||||
$($(derive [d|
|
||||
instance Deriving (Store Intention)
|
||||
|]))
|
||||
$($(derive [d|
|
||||
instance Deriving (Store CreatureCorpse)
|
||||
|]))
|
||||
$($(derive [d|
|
||||
instance Deriving (Store Creature)
|
||||
|]))
|
||||
{- FOURMOLU_ENABLE -}
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
module Dodge.Data.Creature.Memory where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Memory = Memory
|
||||
{ _soundsToInvestigate :: [Point2]
|
||||
@@ -16,3 +19,4 @@ data Memory = Memory
|
||||
|
||||
makeLenses ''Memory
|
||||
deriveJSON defaultOptions ''Memory
|
||||
$($(derive [d| instance Deriving (Store Memory) |]))
|
||||
|
||||
@@ -6,6 +6,8 @@ module Dodge.Data.Creature.Misc (
|
||||
module Dodge.Data.CamouflageStatus,
|
||||
) where
|
||||
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
@@ -84,3 +86,12 @@ deriveJSON defaultOptions ''CrMvType
|
||||
deriveJSON defaultOptions ''HumanoidAI
|
||||
deriveJSON defaultOptions ''CreatureType
|
||||
deriveJSON defaultOptions ''BarrelType
|
||||
|
||||
{- FOURMOLU_DISABLE -}
|
||||
$($(derive [d| instance Deriving (Store CreatureStatistics) |]))
|
||||
$($(derive [d| instance Deriving (Store Vocalization) |]))
|
||||
$($(derive [d| instance Deriving (Store CrMvType) |]))
|
||||
$($(derive [d| instance Deriving (Store HumanoidAI) |]))
|
||||
$($(derive [d| instance Deriving (Store CreatureType) |]))
|
||||
$($(derive [d| instance Deriving (Store BarrelType) |]))
|
||||
{- FOURMOLU_ENABLE -}
|
||||
|
||||
@@ -26,6 +26,8 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.FloatFunction
|
||||
import qualified IntMapHelp as IM
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Perception = Perception
|
||||
{ _cpVigilance :: Vigilance
|
||||
@@ -75,3 +77,9 @@ deriveJSON defaultOptions ''Audition
|
||||
deriveJSON defaultOptions ''Vigilance
|
||||
deriveJSON defaultOptions ''Attention
|
||||
deriveJSON defaultOptions ''Awareness
|
||||
$($(derive [d| instance Deriving (Store Perception) |]))
|
||||
$($(derive [d| instance Deriving (Store Vision) |]))
|
||||
$($(derive [d| instance Deriving (Store Audition) |]))
|
||||
$($(derive [d| instance Deriving (Store Vigilance) |]))
|
||||
$($(derive [d| instance Deriving (Store Attention) |]))
|
||||
$($(derive [d| instance Deriving (Store Awareness) |]))
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
module Dodge.Data.Creature.Stance where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Stance = Stance
|
||||
{ _carriage :: Carriage
|
||||
@@ -45,3 +48,7 @@ deriveJSON defaultOptions ''Stance
|
||||
deriveJSON defaultOptions ''Carriage
|
||||
deriveJSON defaultOptions ''FootForward
|
||||
deriveJSON defaultOptions ''Posture
|
||||
$($(derive [d| instance Deriving (Store Stance) |]))
|
||||
$($(derive [d| instance Deriving (Store Carriage) |]))
|
||||
$($(derive [d| instance Deriving (Store FootForward) |]))
|
||||
$($(derive [d| instance Deriving (Store Posture) |]))
|
||||
|
||||
@@ -10,6 +10,8 @@ import Data.Aeson.TH
|
||||
import qualified Data.IntSet as IS
|
||||
import Dodge.Data.Damage
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data CreatureState = CrSt
|
||||
{ _csDamage :: [Damage]
|
||||
@@ -58,3 +60,8 @@ deriveJSON defaultOptions ''CreatureDropType
|
||||
deriveJSON defaultOptions ''CrSpState
|
||||
deriveJSON defaultOptions ''Faction
|
||||
deriveJSON defaultOptions ''CrGroup
|
||||
$($(derive [d| instance Deriving (Store CreatureState) |]))
|
||||
$($(derive [d| instance Deriving (Store CreatureDropType) |]))
|
||||
$($(derive [d| instance Deriving (Store CrSpState) |]))
|
||||
$($(derive [d| instance Deriving (Store Faction) |]))
|
||||
$($(derive [d| instance Deriving (Store CrGroup) |]))
|
||||
|
||||
@@ -5,17 +5,23 @@ module Dodge.Data.CreatureEffect where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data WdCrCr = NoCreatureEffect
|
||||
| HackWdCrCr
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data CrWdImp = NoCrWdImp
|
||||
| HackCrWdImp
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data CrWdWd = CrWdWdId
|
||||
| HackCrWdWd
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data IntImp = NoIntImp
|
||||
| HackIntImp
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data CrImp
|
||||
@@ -24,6 +30,7 @@ data CrImp
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data P2Imp = P2ImpNo
|
||||
| HackP2Imp
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data WdCrBl
|
||||
@@ -42,6 +49,7 @@ data CrBl
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data MCrAc = MCrNoAction
|
||||
| HackMCrAc
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data CrAc
|
||||
@@ -50,9 +58,11 @@ data CrAc
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data P2Ac = P2NoAction
|
||||
| HackP2Ac
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data MP2Ac = MP2NoAction
|
||||
| HackMP2Ac
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data CrWdAc
|
||||
@@ -74,3 +84,16 @@ deriveJSON defaultOptions ''CrAc
|
||||
deriveJSON defaultOptions ''P2Ac
|
||||
deriveJSON defaultOptions ''MP2Ac
|
||||
deriveJSON defaultOptions ''CrWdAc
|
||||
$($(derive [d| instance Deriving (Store WdCrCr) |]))
|
||||
$($(derive [d| instance Deriving (Store CrWdImp) |]))
|
||||
$($(derive [d| instance Deriving (Store CrWdWd) |]))
|
||||
$($(derive [d| instance Deriving (Store IntImp) |]))
|
||||
$($(derive [d| instance Deriving (Store CrImp) |]))
|
||||
$($(derive [d| instance Deriving (Store P2Imp) |]))
|
||||
$($(derive [d| instance Deriving (Store WdCrBl) |]))
|
||||
$($(derive [d| instance Deriving (Store CrBl) |]))
|
||||
$($(derive [d| instance Deriving (Store MCrAc) |]))
|
||||
$($(derive [d| instance Deriving (Store CrAc) |]))
|
||||
$($(derive [d| instance Deriving (Store P2Ac) |]))
|
||||
$($(derive [d| instance Deriving (Store MP2Ac) |]))
|
||||
$($(derive [d| instance Deriving (Store CrWdAc) |]))
|
||||
|
||||
@@ -10,7 +10,10 @@ module Dodge.Data.Damage (
|
||||
module Dodge.Data.Damage.Type,
|
||||
) where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Damage.Type
|
||||
@@ -52,3 +55,5 @@ makeLenses ''Damage
|
||||
makeLenses ''DamageEffect
|
||||
deriveJSON defaultOptions ''DamageEffect
|
||||
deriveJSON defaultOptions ''Damage
|
||||
$($(derive [d| instance Deriving (Store DamageEffect) |]))
|
||||
$($(derive [d| instance Deriving (Store Damage) |]))
|
||||
|
||||
@@ -5,6 +5,8 @@ module Dodge.Data.Damage.Type where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data DamageType
|
||||
= PIERCING
|
||||
@@ -29,3 +31,4 @@ instance ToJSONKey DamageType
|
||||
instance FromJSONKey DamageType
|
||||
|
||||
deriveJSON defaultOptions ''DamageType
|
||||
$($(derive [d| instance Deriving (Store DamageType) |]))
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.Distortion where
|
||||
|
||||
import LinearHelp
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Distortion
|
||||
= RadialDistortion Point2 Point2 Point2 Float
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
|
||||
deriveJSON defaultOptions ''Distortion
|
||||
$($(derive [d| instance Deriving (Store Distortion) |]))
|
||||
|
||||
@@ -8,6 +8,7 @@ module Dodge.Data.Door (
|
||||
module Dodge.Data.WorldEffect,
|
||||
) where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
@@ -16,6 +17,8 @@ import Dodge.Data.MountedObject
|
||||
import Dodge.Data.PathGraph
|
||||
import Dodge.Data.WorldEffect
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data DoorStatus = DoorOpen | DoorClosed | DoorHalfway | DoorInt Int
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
@@ -50,3 +53,6 @@ makeLenses ''Door
|
||||
deriveJSON defaultOptions ''DoorStatus
|
||||
deriveJSON defaultOptions ''PushSource
|
||||
deriveJSON defaultOptions ''Door
|
||||
$($(derive [d| instance Deriving (Store DoorStatus) |]))
|
||||
$($(derive [d| instance Deriving (Store PushSource) |]))
|
||||
$($(derive [d| instance Deriving (Store Door) |]))
|
||||
|
||||
@@ -9,6 +9,8 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Damage.Type
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data EnergyBall = EnergyBall
|
||||
{ _ebVel :: Point2
|
||||
@@ -24,3 +26,4 @@ data EnergyBall = EnergyBall
|
||||
|
||||
makeLenses ''EnergyBall
|
||||
deriveJSON defaultOptions ''EnergyBall
|
||||
$($(derive [d| instance Deriving (Store EnergyBall) |]))
|
||||
|
||||
@@ -5,6 +5,8 @@ module Dodge.Data.Equipment.Misc where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data EquipSite
|
||||
= GoesOnHead
|
||||
@@ -31,3 +33,5 @@ instance FromJSONKey EquipPosition
|
||||
|
||||
deriveJSON defaultOptions ''EquipSite
|
||||
deriveJSON defaultOptions ''EquipPosition
|
||||
$($(derive [d| instance Deriving (Store EquipSite) |]))
|
||||
$($(derive [d| instance Deriving (Store EquipPosition) |]))
|
||||
|
||||
@@ -8,6 +8,8 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Flame = Flame
|
||||
{ _flVel :: Point2
|
||||
@@ -22,3 +24,4 @@ data Flame = Flame
|
||||
|
||||
makeLenses ''Flame
|
||||
deriveJSON defaultOptions ''Flame
|
||||
$($(derive [d| instance Deriving (Store Flame) |]))
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
module Dodge.Data.Flare where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Flare
|
||||
= MuzFlare
|
||||
@@ -26,3 +29,4 @@ data Flare
|
||||
|
||||
makeLenses ''Flare
|
||||
deriveJSON defaultOptions ''Flare
|
||||
$($(derive [d| instance Deriving (Store Flare) |]))
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
module Dodge.Data.FloatFunction where
|
||||
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
|
||||
@@ -15,3 +17,5 @@ data FloatFloat
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
deriveJSON defaultOptions ''FloatFloat
|
||||
|
||||
$($(derive [d|instance Deriving (Store FloatFloat)|]))
|
||||
|
||||
@@ -3,14 +3,18 @@
|
||||
|
||||
module Dodge.Data.FloorItem where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Item
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data FloorItem = FlIt {_flIt :: Item, _flItPos :: Point2, _flItRot :: Float, _flItID :: Int}
|
||||
deriving (Eq, Show, Read)
|
||||
|
||||
makeLenses ''FloorItem
|
||||
deriveJSON defaultOptions ''FloorItem
|
||||
$($(derive [d| instance Deriving (Store FloorItem) |]))
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
module Dodge.Data.ForegroundShape where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry
|
||||
import ShapePicture
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ForegroundShape = ForegroundShape
|
||||
{ _fsID :: Int
|
||||
@@ -20,3 +23,4 @@ data ForegroundShape = ForegroundShape
|
||||
|
||||
makeLenses ''ForegroundShape
|
||||
deriveJSON defaultOptions ''ForegroundShape
|
||||
$($(derive [d| instance Deriving (Store ForegroundShape) |]))
|
||||
|
||||
@@ -9,6 +9,8 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import qualified Data.Map.Strict as M
|
||||
import Dodge.Data.Damage.Type
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
newtype GenParams = GenParams
|
||||
{ _sensorCoding :: M.Map DamageType (PaletteColor, DecorationShape)
|
||||
@@ -21,3 +23,5 @@ data DecorationShape = PLUS | SQUARE | CIRCLE | THREELINES
|
||||
makeLenses ''GenParams
|
||||
deriveJSON defaultOptions ''GenParams
|
||||
deriveJSON defaultOptions ''DecorationShape
|
||||
$($(derive [d| instance Deriving (Store GenParams) |]))
|
||||
$($(derive [d| instance Deriving (Store DecorationShape) |]))
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
module Dodge.Data.Gust where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Gust = Gust
|
||||
{ _guID :: Int
|
||||
@@ -18,3 +21,4 @@ data Gust = Gust
|
||||
|
||||
makeLenses ''Gust
|
||||
deriveJSON defaultOptions ''Gust
|
||||
$($(derive [d| instance Deriving (Store Gust) |]))
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
module Dodge.Data.HUD where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data HUDElement
|
||||
= DisplayInventory {_subInventory :: SubInventory}
|
||||
@@ -36,3 +39,6 @@ makeLenses ''SubInventory
|
||||
deriveJSON defaultOptions ''HUDElement
|
||||
deriveJSON defaultOptions ''SubInventory
|
||||
deriveJSON defaultOptions ''HUD
|
||||
$($(derive [d| instance Deriving (Store HUDElement) |]))
|
||||
$($(derive [d| instance Deriving (Store SubInventory) |]))
|
||||
$($(derive [d| instance Deriving (Store HUD) |]))
|
||||
|
||||
@@ -6,6 +6,8 @@ module Dodge.Data.Hammer where
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data HammerType
|
||||
= NoHammer
|
||||
@@ -21,3 +23,5 @@ data HammerPosition
|
||||
makeLenses ''HammerType
|
||||
deriveJSON defaultOptions ''HammerType
|
||||
deriveJSON defaultOptions ''HammerPosition
|
||||
$($(derive [d| instance Deriving (Store HammerType) |]))
|
||||
$($(derive [d| instance Deriving (Store HammerPosition) |]))
|
||||
|
||||
@@ -15,6 +15,8 @@ module Dodge.Data.Item (
|
||||
module Dodge.Data.Item.Location,
|
||||
) where
|
||||
|
||||
import Data.Store
|
||||
import TH.Derive
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
@@ -54,3 +56,5 @@ _itUseAimStance = _aimStance . _heldAim . _itUse
|
||||
|
||||
makeLenses ''Item
|
||||
deriveJSON defaultOptions ''Item
|
||||
|
||||
$($(derive [d| instance Deriving (Store Item) |]))
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
module Dodge.Data.Item.Combine where
|
||||
|
||||
import Control.Lens
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import qualified Data.Map.Strict as M
|
||||
@@ -219,3 +221,14 @@ deriveJSON defaultOptions ''ModuleSlot
|
||||
makeLenses ''ItemType
|
||||
makeLenses ''ItemBaseType
|
||||
makeLenses ''HeldItemType
|
||||
$($(derive [d| instance Deriving (Store ItemType) |]))
|
||||
$($(derive [d| instance Deriving (Store Stack) |]))
|
||||
$($(derive [d| instance Deriving (Store CraftType) |]))
|
||||
$($(derive [d| instance Deriving (Store ItemBaseType) |]))
|
||||
$($(derive [d| instance Deriving (Store ConsumableItemType) |]))
|
||||
$($(derive [d| instance Deriving (Store EquipItemType) |]))
|
||||
$($(derive [d| instance Deriving (Store LeftItemType) |]))
|
||||
$($(derive [d| instance Deriving (Store HeldItemType) |]))
|
||||
$($(derive [d| instance Deriving (Store ItemModuleType) |]))
|
||||
$($(derive [d| instance Deriving (Store Detector) |]))
|
||||
$($(derive [d| instance Deriving (Store ModuleSlot) |]))
|
||||
|
||||
@@ -5,6 +5,8 @@ module Dodge.Data.Item.CurseStatus where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data CurseStatus
|
||||
= Uncursed
|
||||
@@ -13,3 +15,4 @@ data CurseStatus
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
deriveJSON defaultOptions ''CurseStatus
|
||||
$($(derive [d| instance Deriving (Store CurseStatus) |]))
|
||||
|
||||
@@ -6,6 +6,8 @@ module Dodge.Data.Item.Effect where
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ItEffect = ItEffect
|
||||
{ _ieInv :: ItInvEffect --Item -> Creature -> World -> World
|
||||
@@ -27,9 +29,11 @@ data ItInvEffect
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data ItFloorEffect = NoFloorEffect
|
||||
| DefaultFloorEffect
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data ItDropEffect = NoDropEffect
|
||||
| DefaultDropEffect
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
makeLenses ''ItEffect
|
||||
@@ -37,3 +41,7 @@ deriveJSON defaultOptions ''ItEffect
|
||||
deriveJSON defaultOptions ''ItInvEffect
|
||||
deriveJSON defaultOptions ''ItFloorEffect
|
||||
deriveJSON defaultOptions ''ItDropEffect
|
||||
$($(derive [d| instance Deriving (Store ItEffect) |]))
|
||||
$($(derive [d| instance Deriving (Store ItInvEffect) |]))
|
||||
$($(derive [d| instance Deriving (Store ItFloorEffect) |]))
|
||||
$($(derive [d| instance Deriving (Store ItDropEffect) |]))
|
||||
|
||||
@@ -6,6 +6,8 @@ module Dodge.Data.Item.HeldDelay where
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data UseDelay -- should just be Delay
|
||||
= NoDelay
|
||||
@@ -27,3 +29,4 @@ data UseDelay -- should just be Delay
|
||||
|
||||
makeLenses ''UseDelay
|
||||
deriveJSON defaultOptions ''UseDelay
|
||||
$($(derive [d| instance Deriving (Store UseDelay) |]))
|
||||
|
||||
@@ -7,6 +7,8 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import qualified Data.Sequence as Seq
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data HeldScroll
|
||||
= HeldScrollDoNothing
|
||||
@@ -21,3 +23,4 @@ data HeldScroll
|
||||
|
||||
makeLenses ''HeldScroll
|
||||
deriveJSON defaultOptions ''HeldScroll
|
||||
$($(derive [d| instance Deriving (Store HeldScroll) |]))
|
||||
|
||||
@@ -7,6 +7,8 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.CamouflageStatus
|
||||
import Dodge.Data.Item.Combine
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data HeldUse
|
||||
= HeldDoNothing
|
||||
@@ -94,3 +96,8 @@ deriveJSON defaultOptions ''HeldMod
|
||||
deriveJSON defaultOptions ''Euse
|
||||
deriveJSON defaultOptions ''HeldUse
|
||||
deriveJSON defaultOptions ''Luse
|
||||
$($(derive [d| instance Deriving (Store Cuse) |]))
|
||||
$($(derive [d| instance Deriving (Store HeldMod) |]))
|
||||
$($(derive [d| instance Deriving (Store Euse) |]))
|
||||
$($(derive [d| instance Deriving (Store HeldUse) |]))
|
||||
$($(derive [d| instance Deriving (Store Luse) |]))
|
||||
|
||||
@@ -5,6 +5,8 @@ module Dodge.Data.Item.Location where
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ItemLocation
|
||||
= InInv {_ipCrID :: Int, _ipInvID :: Int}
|
||||
@@ -15,3 +17,4 @@ data ItemLocation
|
||||
|
||||
makeLenses ''ItemLocation
|
||||
deriveJSON defaultOptions ''ItemLocation
|
||||
$($(derive [d| instance Deriving (Store ItemLocation) |]))
|
||||
|
||||
@@ -7,6 +7,9 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import LinearHelp
|
||||
|
||||
data ItemDimension = ItemDimension
|
||||
{ _dimRad :: Float
|
||||
@@ -40,3 +43,7 @@ deriveJSON defaultOptions ''ItemDimension
|
||||
deriveJSON defaultOptions ''ItemPortage
|
||||
deriveJSON defaultOptions ''ItemValue
|
||||
deriveJSON defaultOptions ''ItemValueType
|
||||
$($(derive [d| instance Deriving (Store ItemDimension) |]))
|
||||
$($(derive [d| instance Deriving (Store ItemPortage) |]))
|
||||
$($(derive [d| instance Deriving (Store ItemValue) |]))
|
||||
$($(derive [d| instance Deriving (Store ItemValueType) |]))
|
||||
|
||||
@@ -10,6 +10,8 @@ import Data.Aeson.TH
|
||||
import Dodge.Data.ArcStep
|
||||
import Dodge.Data.Beam
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ItemParams
|
||||
= NoParams
|
||||
@@ -113,3 +115,9 @@ deriveJSON defaultOptions ''PreviousArcEffect
|
||||
deriveJSON defaultOptions ''GunBarrels
|
||||
deriveJSON defaultOptions ''Nozzle
|
||||
deriveJSON defaultOptions ''BarrelSpread
|
||||
$($(derive [d| instance Deriving (Store ItemParams) |]))
|
||||
$($(derive [d| instance Deriving (Store ShrinkGunStatus) |]))
|
||||
$($(derive [d| instance Deriving (Store PreviousArcEffect) |]))
|
||||
$($(derive [d| instance Deriving (Store GunBarrels) |]))
|
||||
$($(derive [d| instance Deriving (Store Nozzle) |]))
|
||||
$($(derive [d| instance Deriving (Store BarrelSpread) |]))
|
||||
|
||||
@@ -7,6 +7,9 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import LinearHelp
|
||||
|
||||
data Scope
|
||||
= NoScope
|
||||
@@ -30,3 +33,4 @@ data Scope
|
||||
|
||||
makeLenses ''Scope
|
||||
deriveJSON defaultOptions ''Scope
|
||||
$($(derive [d| instance Deriving (Store Scope) |]))
|
||||
|
||||
@@ -7,6 +7,9 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import LinearHelp
|
||||
|
||||
data Targeting
|
||||
= NoTargeting
|
||||
@@ -38,3 +41,6 @@ makeLenses ''Targeting
|
||||
deriveJSON defaultOptions ''Targeting
|
||||
deriveJSON defaultOptions ''TargetUpdate
|
||||
deriveJSON defaultOptions ''TargetDraw
|
||||
$($(derive [d| instance Deriving (Store Targeting) |]))
|
||||
$($(derive [d| instance Deriving (Store TargetUpdate) |]))
|
||||
$($(derive [d| instance Deriving (Store TargetDraw) |]))
|
||||
|
||||
@@ -7,6 +7,8 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import qualified IntMapHelp as IM
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ItemTweaks
|
||||
= NoTweaks
|
||||
@@ -35,3 +37,6 @@ makeLenses ''ItemTweaks
|
||||
deriveJSON defaultOptions ''ItemTweaks
|
||||
deriveJSON defaultOptions ''TweakType
|
||||
deriveJSON defaultOptions ''TweakParam
|
||||
$($(derive [d| instance Deriving (Store ItemTweaks) |]))
|
||||
$($(derive [d| instance Deriving (Store TweakType) |]))
|
||||
$($(derive [d| instance Deriving (Store TweakParam) |]))
|
||||
|
||||
@@ -20,6 +20,8 @@ import Dodge.Data.Item.HeldUse
|
||||
import Dodge.Data.Item.Use.Consumption
|
||||
import Dodge.Data.Item.Use.Equipment
|
||||
import Dodge.Data.Item.HeldDelay
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ItemUse
|
||||
= HeldUse
|
||||
@@ -80,3 +82,8 @@ deriveJSON defaultOptions ''ItemUse
|
||||
deriveJSON defaultOptions ''AimParams
|
||||
deriveJSON defaultOptions ''AimStance
|
||||
deriveJSON defaultOptions ''ItZoom
|
||||
|
||||
$($(derive [d| instance Deriving (Store ItemUse) |]))
|
||||
$($(derive [d| instance Deriving (Store AimParams) |]))
|
||||
$($(derive [d| instance Deriving (Store AimStance) |]))
|
||||
$($(derive [d| instance Deriving (Store ItZoom) |]))
|
||||
|
||||
@@ -8,6 +8,8 @@ module Dodge.Data.Item.Use.Consumption (
|
||||
module Dodge.Data.Item.Use.Consumption.LoadAction,
|
||||
) where
|
||||
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
@@ -48,3 +50,6 @@ makeLenses ''ItAmount
|
||||
deriveJSON defaultOptions ''HeldConsumption
|
||||
deriveJSON defaultOptions ''LeftConsumption
|
||||
deriveJSON defaultOptions ''ItAmount
|
||||
$($(derive [d| instance Deriving (Store HeldConsumption) |]))
|
||||
$($(derive [d| instance Deriving (Store LeftConsumption) |]))
|
||||
$($(derive [d| instance Deriving (Store ItAmount) |]))
|
||||
|
||||
@@ -7,6 +7,8 @@ module Dodge.Data.Item.Use.Consumption.Ammo (
|
||||
module Dodge.Data.Payload,
|
||||
) where
|
||||
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
@@ -56,6 +58,7 @@ data AmmoType
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data ForceFieldType = DefaultForceField
|
||||
| HackForTemplateForceField
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data GasCreate = CreatePoisonGas | CreateFlame
|
||||
@@ -69,3 +72,9 @@ deriveJSON defaultOptions ''ProjectileUpdate
|
||||
deriveJSON defaultOptions ''AmmoType
|
||||
deriveJSON defaultOptions ''GasCreate
|
||||
deriveJSON defaultOptions ''ForceFieldType
|
||||
$($(derive [d| instance Deriving (Store ProjectileDraw) |]))
|
||||
$($(derive [d| instance Deriving (Store ProjectileCreate) |]))
|
||||
$($(derive [d| instance Deriving (Store ProjectileUpdate) |]))
|
||||
$($(derive [d| instance Deriving (Store AmmoType) |]))
|
||||
$($(derive [d| instance Deriving (Store GasCreate) |]))
|
||||
$($(derive [d| instance Deriving (Store ForceFieldType) |]))
|
||||
|
||||
@@ -8,6 +8,8 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Hammer
|
||||
import Sound.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data LoadAction
|
||||
= LoadEject {_actionTime :: Int, _actionSound :: SoundID}
|
||||
@@ -30,3 +32,6 @@ makeLenses ''InvSelAction
|
||||
deriveJSON defaultOptions ''LoadAction
|
||||
deriveJSON defaultOptions ''InvSel
|
||||
deriveJSON defaultOptions ''InvSelAction
|
||||
$($(derive [d| instance Deriving (Store LoadAction) |]))
|
||||
$($(derive [d| instance Deriving (Store InvSel) |]))
|
||||
$($(derive [d| instance Deriving (Store InvSelAction) |]))
|
||||
|
||||
@@ -11,6 +11,8 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Equipment.Misc
|
||||
import Dodge.Data.Item.HeldUse
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data EquipEffect = EquipEffect
|
||||
{ _eeUse :: Euse --Item -> Creature -> World -> World
|
||||
@@ -32,3 +34,5 @@ makeLenses ''EquipEffect
|
||||
makeLenses ''EquipParams
|
||||
deriveJSON defaultOptions ''EquipEffect
|
||||
deriveJSON defaultOptions ''EquipParams
|
||||
$($(derive [d| instance Deriving (Store EquipEffect) |]))
|
||||
$($(derive [d| instance Deriving (Store EquipParams) |]))
|
||||
|
||||
@@ -8,6 +8,8 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data LaserType
|
||||
= DamageLaser {_laserTypeDamage :: Int}
|
||||
@@ -36,3 +38,6 @@ makeLenses ''LaserType
|
||||
deriveJSON defaultOptions ''LaserType
|
||||
deriveJSON defaultOptions ''LaserStart
|
||||
deriveJSON defaultOptions ''Laser
|
||||
$($(derive [d| instance Deriving (Store LaserType) |]))
|
||||
$($(derive [d| instance Deriving (Store LaserStart) |]))
|
||||
$($(derive [d| instance Deriving (Store Laser) |]))
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
|
||||
module Dodge.Data.LightSource where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data LightSourceDraw = DefaultLightSourceDraw
|
||||
| HackLightSourceDraw
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data TLSIntensity
|
||||
@@ -53,3 +57,9 @@ deriveJSON defaultOptions ''TLSUpdate
|
||||
deriveJSON defaultOptions ''LSParam
|
||||
deriveJSON defaultOptions ''LightSource
|
||||
deriveJSON defaultOptions ''TempLightSource
|
||||
$($(derive [d| instance Deriving (Store LightSourceDraw) |]))
|
||||
$($(derive [d| instance Deriving (Store TLSIntensity) |]))
|
||||
$($(derive [d| instance Deriving (Store TLSUpdate) |]))
|
||||
$($(derive [d| instance Deriving (Store LSParam) |]))
|
||||
$($(derive [d| instance Deriving (Store LightSource) |]))
|
||||
$($(derive [d| instance Deriving (Store TempLightSource) |]))
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
module Dodge.Data.LinearShockwave where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data LinearShockwave = LinearShockwave
|
||||
{ _lwPos :: Point2
|
||||
@@ -18,3 +21,4 @@ data LinearShockwave = LinearShockwave
|
||||
|
||||
makeLenses ''LinearShockwave
|
||||
deriveJSON defaultOptions ''LinearShockwave
|
||||
$($(derive [d| instance Deriving (Store LinearShockwave) |]))
|
||||
|
||||
@@ -11,6 +11,7 @@ module Dodge.Data.Machine (
|
||||
module Dodge.Data.GenParams,
|
||||
) where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
@@ -25,6 +26,8 @@ import Dodge.Data.Material
|
||||
import Dodge.Data.ObjectType
|
||||
import Geometry.Data
|
||||
import Sound.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Machine = Machine
|
||||
{ _mcID :: Int
|
||||
@@ -64,3 +67,6 @@ makePrisms ''MachineType
|
||||
deriveJSON defaultOptions ''Machine
|
||||
deriveJSON defaultOptions ''MachineType
|
||||
deriveJSON defaultOptions ''Turret
|
||||
$($(derive [d| instance Deriving (Store Machine) |]))
|
||||
$($(derive [d| instance Deriving (Store MachineType) |]))
|
||||
$($(derive [d| instance Deriving (Store Turret) |]))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
module Dodge.Data.Machine.Sensor where
|
||||
|
||||
import LinearHelp
|
||||
import Dodge.Data.GenParams
|
||||
import Color
|
||||
import Control.Lens
|
||||
@@ -10,6 +11,8 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Item.Combine
|
||||
import Dodge.Data.Damage.Type
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Sensor
|
||||
= DamageSensor
|
||||
@@ -41,3 +44,6 @@ makeLenses ''ProximityRequirement
|
||||
deriveJSON defaultOptions ''Sensor
|
||||
deriveJSON defaultOptions ''ProximityRequirement
|
||||
deriveJSON defaultOptions ''CloseToggle
|
||||
$($(derive [d| instance Deriving (Store Sensor) |]))
|
||||
$($(derive [d| instance Deriving (Store ProximityRequirement) |]))
|
||||
$($(derive [d| instance Deriving (Store CloseToggle) |]))
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
module Dodge.Data.Magnet where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
newtype MagnetUpdate = MagnetUpdateTimer Int
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
@@ -28,3 +31,6 @@ makeLenses ''Magnet
|
||||
deriveJSON defaultOptions ''MagnetUpdate
|
||||
deriveJSON defaultOptions ''MagnetBuBu
|
||||
deriveJSON defaultOptions ''Magnet
|
||||
$($(derive [d| instance Deriving (Store MagnetUpdate) |]))
|
||||
$($(derive [d| instance Deriving (Store MagnetBuBu) |]))
|
||||
$($(derive [d| instance Deriving (Store Magnet) |]))
|
||||
|
||||
@@ -7,8 +7,11 @@ module Dodge.Data.Material where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Material = Wood | Dirt | Stone | Glass | Metal | Crystal | Flesh | Electronics
|
||||
deriving (Eq, Ord, Show, Bounded, Enum, Read)
|
||||
|
||||
deriveJSON defaultOptions ''Material
|
||||
$($(derive [d| instance Deriving (Store Material) |]))
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
module Dodge.Data.Modification where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.WorldEffect
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Modification
|
||||
= ModIDTimerPoint3Bool
|
||||
@@ -28,3 +31,4 @@ data Modification
|
||||
|
||||
makeLenses ''Modification
|
||||
deriveJSON defaultOptions ''Modification
|
||||
$($(derive [d| instance Deriving (Store Modification) |]))
|
||||
|
||||
@@ -5,6 +5,8 @@ module Dodge.Data.MountedObject where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data MountedObject
|
||||
= MountedLS Int
|
||||
@@ -12,3 +14,4 @@ data MountedObject
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
deriveJSON defaultOptions ''MountedObject
|
||||
$($(derive [d| instance Deriving (Store MountedObject) |]))
|
||||
|
||||
@@ -5,6 +5,8 @@ module Dodge.Data.ObjectType where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ObjectType
|
||||
= ObTerminal
|
||||
@@ -25,3 +27,4 @@ instance ToJSONKey ObjectType
|
||||
instance FromJSONKey ObjectType
|
||||
|
||||
deriveJSON defaultOptions ''ObjectType
|
||||
$($(derive [d| instance Deriving (Store ObjectType) |]))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
{- |
|
||||
@@ -10,12 +11,14 @@ The warnings have been disabled.
|
||||
-}
|
||||
module Dodge.Data.PathGraph where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Graph.Inductive
|
||||
import Data.Map.Strict (Map)
|
||||
import qualified Data.Set as Set
|
||||
import Data.Store
|
||||
import Data.Store.TH
|
||||
import GHC.Generics
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
@@ -65,9 +68,15 @@ instance (FromJSON a, FromJSON b) => FromJSON (Gr a b)
|
||||
|
||||
makeLenses ''PathGraph
|
||||
makeLenses ''PathEdge
|
||||
$( $( derive
|
||||
[d|
|
||||
instance Store a => Deriving (Store (Gr a))
|
||||
|]
|
||||
)
|
||||
)
|
||||
|
||||
{- FOURMOLU_DISABLE -}
|
||||
$($(derive [d|
|
||||
instance Deriving (Store EdgeObstacle)
|
||||
|]))
|
||||
$($(derive [d|
|
||||
instance Deriving (Store PathEdge)
|
||||
|]))
|
||||
$($(derive [d|
|
||||
instance Deriving (Store (Gr Point2 PathEdge))
|
||||
|]))
|
||||
{- FOURMOLU_ENABLE -}
|
||||
|
||||
@@ -5,8 +5,11 @@ module Dodge.Data.Payload where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Payload = ExplosionPayload | DudPayload
|
||||
deriving (Show, Read, Eq, Ord, Enum, Bounded)
|
||||
|
||||
deriveJSON defaultOptions ''Payload
|
||||
$($(derive [d| instance Deriving (Store Payload) |]))
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
|
||||
module Dodge.Data.PosEvent where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data PosEventType = SparkSpawner
|
||||
| HackPosEventType
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data PosEvent = PosEvent
|
||||
@@ -21,3 +25,5 @@ data PosEvent = PosEvent
|
||||
makeLenses ''PosEvent
|
||||
deriveJSON defaultOptions ''PosEventType
|
||||
deriveJSON defaultOptions ''PosEvent
|
||||
$($(derive [d| instance Deriving (Store PosEventType) |]))
|
||||
$($(derive [d| instance Deriving (Store PosEvent) |]))
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
module Dodge.Data.PressPlate where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import Picture
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data PressPlateEvent
|
||||
= PressPlateId
|
||||
@@ -27,3 +30,5 @@ data PressPlate = PressPlate
|
||||
makeLenses ''PressPlate
|
||||
deriveJSON defaultOptions ''PressPlateEvent
|
||||
deriveJSON defaultOptions ''PressPlate
|
||||
$($(derive [d| instance Deriving (Store PressPlateEvent) |]))
|
||||
$($(derive [d| instance Deriving (Store PressPlate) |]))
|
||||
|
||||
@@ -9,6 +9,8 @@ import Data.Aeson.TH
|
||||
import Dodge.Data.Item.Use.Consumption.Ammo
|
||||
import Geometry.Data
|
||||
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
data Proj
|
||||
= Shell
|
||||
{ _prjPos :: Point2
|
||||
@@ -29,3 +31,4 @@ data Proj
|
||||
|
||||
makeLenses ''Proj
|
||||
deriveJSON defaultOptions ''Proj
|
||||
$($(derive [d| instance Deriving (Store Proj) |]))
|
||||
|
||||
@@ -12,6 +12,8 @@ import Geometry.Data
|
||||
import qualified Quaternion as Q
|
||||
import Shape.Data
|
||||
import ShapePicture.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Prop
|
||||
= PropZ
|
||||
@@ -75,3 +77,7 @@ deriveJSON defaultOptions ''PropDraw
|
||||
deriveJSON defaultOptions ''PropUpdate
|
||||
deriveJSON defaultOptions ''PrWdLsLs
|
||||
deriveJSON defaultOptions ''Prop
|
||||
$($(derive [d| instance Deriving (Store PropDraw) |]))
|
||||
$($(derive [d| instance Deriving (Store PropUpdate) |]))
|
||||
$($(derive [d| instance Deriving (Store PrWdLsLs) |]))
|
||||
$($(derive [d| instance Deriving (Store Prop) |]))
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
module Dodge.Data.RadarBlip where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data RadarBlip = RadarBlip
|
||||
{ _rbColor :: Color
|
||||
@@ -20,3 +23,4 @@ data RadarBlip = RadarBlip
|
||||
|
||||
makeLenses ''RadarBlip
|
||||
deriveJSON defaultOptions ''RadarBlip
|
||||
$($(derive [d| instance Deriving (Store RadarBlip) |]))
|
||||
|
||||
@@ -6,11 +6,14 @@ module Dodge.Data.RadarSweep (
|
||||
module Dodge.Data.ObjectType,
|
||||
) where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.ObjectType
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data RadarSweep = RadarSweep
|
||||
{ _rsPos :: Point2
|
||||
@@ -22,3 +25,4 @@ data RadarSweep = RadarSweep
|
||||
|
||||
makeLenses ''RadarSweep
|
||||
deriveJSON defaultOptions ''RadarSweep
|
||||
$($(derive [d| instance Deriving (Store RadarSweep) |]))
|
||||
|
||||
@@ -8,6 +8,8 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ShockwaveDirection = OutwardShockwave | InwardShockwave
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
@@ -28,3 +30,5 @@ data Shockwave = Shockwave
|
||||
makeLenses ''Shockwave
|
||||
deriveJSON defaultOptions ''ShockwaveDirection
|
||||
deriveJSON defaultOptions ''Shockwave
|
||||
$($(derive [d| instance Deriving (Store ShockwaveDirection) |]))
|
||||
$($(derive [d| instance Deriving (Store Shockwave) |]))
|
||||
|
||||
@@ -6,6 +6,8 @@ module Dodge.Data.SoundOrigin where
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Material
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data SoundOrigin
|
||||
= InventorySound
|
||||
@@ -40,3 +42,4 @@ instance ToJSONKey SoundOrigin
|
||||
instance FromJSONKey SoundOrigin
|
||||
|
||||
deriveJSON defaultOptions ''SoundOrigin
|
||||
$($(derive [d| instance Deriving (Store SoundOrigin) |]))
|
||||
|
||||
@@ -3,12 +3,15 @@
|
||||
|
||||
module Dodge.Data.Spark where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Damage.Type
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Spark = Spark
|
||||
{ _skVel :: Point2
|
||||
@@ -22,3 +25,4 @@ data Spark = Spark
|
||||
|
||||
makeLenses ''Spark
|
||||
deriveJSON defaultOptions ''Spark
|
||||
$($(derive [d| instance Deriving (Store Spark) |]))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
module Dodge.Data.Terminal where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
@@ -10,6 +11,8 @@ import Data.Aeson.TH
|
||||
import qualified Data.Map.Strict as M
|
||||
import qualified Data.Text as T
|
||||
import Dodge.Data.WorldEffect
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data TerminalStatus = TerminalOff | TerminalBusy | TerminalReady
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
@@ -128,3 +131,15 @@ deriveJSON defaultOptions ''BlBl
|
||||
deriveJSON defaultOptions ''EffectArguments
|
||||
deriveJSON defaultOptions ''TerminalCommandEffect
|
||||
deriveJSON defaultOptions ''TerminalCommand
|
||||
$($(derive [d| instance Deriving (Store TerminalStatus) |]))
|
||||
$($(derive [d| instance Deriving (Store TerminalInput) |]))
|
||||
$($(derive [d| instance Deriving (Store TerminalBootProgram) |]))
|
||||
$($(derive [d| instance Deriving (Store Terminal) |]))
|
||||
$($(derive [d| instance Deriving (Store TerminalLineString) |]))
|
||||
$($(derive [d| instance Deriving (Store TmTm) |]))
|
||||
$($(derive [d| instance Deriving (Store TerminalLine) |]))
|
||||
$($(derive [d| instance Deriving (Store TerminalToggle) |]))
|
||||
$($(derive [d| instance Deriving (Store BlBl) |]))
|
||||
$($(derive [d| instance Deriving (Store EffectArguments) |]))
|
||||
$($(derive [d| instance Deriving (Store TerminalCommandEffect) |]))
|
||||
$($(derive [d| instance Deriving (Store TerminalCommand) |]))
|
||||
|
||||
@@ -3,12 +3,15 @@
|
||||
|
||||
module Dodge.Data.TeslaArc where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.ArcStep
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data TeslaArc = TeslaArc
|
||||
{ _taPoints :: [Point2]
|
||||
@@ -20,3 +23,4 @@ data TeslaArc = TeslaArc
|
||||
|
||||
makeLenses ''TeslaArc
|
||||
deriveJSON defaultOptions ''TeslaArc
|
||||
$($(derive [d| instance Deriving (Store TeslaArc) |]))
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
module Dodge.Data.TractorBeam where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data TractorBeam = TractorBeam
|
||||
{ _tbPos :: Point2
|
||||
@@ -18,3 +21,4 @@ data TractorBeam = TractorBeam
|
||||
|
||||
makeLenses ''TractorBeam
|
||||
deriveJSON defaultOptions ''TractorBeam
|
||||
$($(derive [d| instance Deriving (Store TractorBeam) |]))
|
||||
|
||||
@@ -6,12 +6,15 @@ module Dodge.Data.Wall (
|
||||
module Dodge.Data.Material,
|
||||
) where
|
||||
|
||||
import LinearHelp
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Material
|
||||
import Geometry
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Wall = Wall
|
||||
{ _wlLine :: (Point2, Point2)
|
||||
@@ -42,6 +45,7 @@ data Opacity
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data WallDraw = DrawForceField
|
||||
| HackWallDraw
|
||||
deriving (Eq, Ord, Show, Read, Enum, Bounded)
|
||||
|
||||
data WallStructure
|
||||
@@ -61,3 +65,7 @@ deriveJSON defaultOptions ''Wall
|
||||
deriveJSON defaultOptions ''Opacity
|
||||
deriveJSON defaultOptions ''WallDraw
|
||||
deriveJSON defaultOptions ''WallStructure
|
||||
$($(derive [d| instance Deriving (Store Wall) |]))
|
||||
$($(derive [d| instance Deriving (Store Opacity) |]))
|
||||
$($(derive [d| instance Deriving (Store WallDraw) |]))
|
||||
$($(derive [d| instance Deriving (Store WallStructure) |]))
|
||||
|
||||
@@ -10,6 +10,8 @@ import Dodge.Data.Item
|
||||
import Dodge.Data.SoundOrigin
|
||||
import Geometry.Data
|
||||
import Sound.Data
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data ItCrWdWd
|
||||
= ItCrWdId
|
||||
@@ -81,3 +83,11 @@ deriveJSON defaultOptions ''WdBl
|
||||
deriveJSON defaultOptions ''WdP2f
|
||||
deriveJSON defaultOptions ''DrWdWd
|
||||
deriveJSON defaultOptions ''TmWdWd
|
||||
$($(derive [d| instance Deriving (Store ItCrWdWd) |]))
|
||||
$($(derive [d| instance Deriving (Store WdWd) |]))
|
||||
$($(derive [d| instance Deriving (Store WdP2) |]))
|
||||
$($(derive [d| instance Deriving (Store MdWdWd) |]))
|
||||
$($(derive [d| instance Deriving (Store WdBl) |]))
|
||||
$($(derive [d| instance Deriving (Store WdP2f) |]))
|
||||
$($(derive [d| instance Deriving (Store DrWdWd) |]))
|
||||
$($(derive [d| instance Deriving (Store TmWdWd) |]))
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
-}
|
||||
module Dodge.GameRoom
|
||||
where
|
||||
import LinearHelp
|
||||
import Geometry
|
||||
import Control.Lens
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data GameRoom = GameRoom
|
||||
{ _grViewpoints :: [Point2]
|
||||
@@ -23,3 +26,4 @@ instance ToJSON GameRoom where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON GameRoom
|
||||
makeLenses ''GameRoom
|
||||
$($(derive [d| instance Deriving (Store GameRoom) |]))
|
||||
|
||||
+32
-2
@@ -6,19 +6,48 @@ module Dodge.Save (
|
||||
writeSaveSlot,
|
||||
readSaveSlot,
|
||||
reloadLevelStart,
|
||||
toJSONSaveSlot,
|
||||
fromJSONSaveSlot,
|
||||
) where
|
||||
|
||||
import qualified Data.Store as Store
|
||||
import Dodge.Concurrent
|
||||
import Control.Lens
|
||||
import Dodge.Data.SaveSlot
|
||||
import Data.Aeson
|
||||
import qualified Data.Aeson.Encode.Pretty as AEP
|
||||
import qualified Data.ByteString.Lazy as BS
|
||||
import qualified Data.ByteString as BSS
|
||||
import Dodge.Data.Universe
|
||||
--import qualified Data.Set as S
|
||||
import System.Directory
|
||||
|
||||
writeSaveSlot :: SaveSlot -> Universe -> IO (Universe -> Maybe Universe)
|
||||
writeSaveSlot ss u = do
|
||||
putStrLn $ "Saving " ++ saveSlotPath ss
|
||||
createDirectoryIfMissing True "saveSlot"
|
||||
BSS.writeFile (saveSlotPath ss) $
|
||||
Store.encode
|
||||
(u ^. uvWorld . cWorld)
|
||||
return Just
|
||||
|
||||
readSaveSlot :: SaveSlot -> IO (Universe -> Maybe Universe)
|
||||
readSaveSlot ss = do
|
||||
fExists <- doesFileExist $ saveSlotPath ss
|
||||
if fExists
|
||||
then do
|
||||
bsstr <- BSS.readFile $ saveSlotPath ss
|
||||
cwstr <- Store.decodeIO $ bsstr
|
||||
case cwstr of
|
||||
Nothing -> putStrLn "loadSaveSlot failed to read saved file" >> return removescreenlayers
|
||||
Just cw -> return $ \uv -> Just $ uv & uvWorld . cWorld .~ cw
|
||||
& uvScreenLayers .~ []
|
||||
else putStrLn "loadSaveSlot failed to find saved file" >> return removescreenlayers
|
||||
where
|
||||
removescreenlayers = Just . (uvScreenLayers .~ [])
|
||||
|
||||
toJSONSaveSlot :: SaveSlot -> Universe -> IO (Universe -> Maybe Universe)
|
||||
toJSONSaveSlot ss u = do
|
||||
putStrLn $ "Saving " ++ saveSlotPath ss
|
||||
createDirectoryIfMissing True "saveSlot"
|
||||
BS.writeFile (saveSlotPath ss) $
|
||||
@@ -27,8 +56,9 @@ writeSaveSlot ss u = do
|
||||
(u ^. uvWorld . cWorld)
|
||||
return Just
|
||||
|
||||
readSaveSlot :: SaveSlot -> IO (Universe -> Maybe Universe)
|
||||
readSaveSlot ss = do
|
||||
|
||||
fromJSONSaveSlot :: SaveSlot -> IO (Universe -> Maybe Universe)
|
||||
fromJSONSaveSlot ss = do
|
||||
fExists <- doesFileExist $ saveSlotPath ss
|
||||
if fExists
|
||||
then do
|
||||
|
||||
@@ -11,6 +11,7 @@ module Geometry.ConvexPoly
|
||||
, convexPolysOverlap
|
||||
, pointInPolyPoints
|
||||
) where
|
||||
import LinearHelp
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Geometry.Data
|
||||
@@ -20,6 +21,8 @@ import Geometry.Intersect
|
||||
import Geometry.Polygon
|
||||
|
||||
import Control.Lens
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
--import qualified Control.Foldl as L
|
||||
data ConvexPoly = ConvexPoly
|
||||
{ _cpPoints :: [Point2]
|
||||
@@ -78,3 +81,4 @@ pairPolyPointsIntersect _ _ _ = False
|
||||
|
||||
|
||||
makeLenses ''ConvexPoly
|
||||
$($(derive [d| instance Deriving (Store ConvexPoly) |]))
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
module LinearHelp where
|
||||
import Data.Store
|
||||
import Data.Store.TH
|
||||
import TH.Derive
|
||||
import Linear.V2
|
||||
import Linear.V3
|
||||
import Linear.V4
|
||||
|
||||
|
||||
$($(derive [d|
|
||||
instance (Store a => Deriving (Store (V2 a)))
|
||||
|]))
|
||||
$($(derive [d|
|
||||
instance (Store a => Deriving (Store (V3 a)))
|
||||
|]))
|
||||
$($(derive [d|
|
||||
instance (Store a => Deriving (Store (V4 a)))
|
||||
|]))
|
||||
@@ -1,10 +1,13 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
module MaybeHelp where
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import GHC.Generics
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Maybe' a = Just' {__Just' :: a} | Nothing'
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
@@ -34,3 +37,4 @@ toggleJust Nothing = Just ()
|
||||
toggleJust _ = Nothing
|
||||
|
||||
makeLenses ''Maybe'
|
||||
$($(derive [d| instance (Store a => Deriving (Store (Maybe' a))) |]))
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
module Picture.Data where
|
||||
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Geometry.Data
|
||||
import Streaming
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
|
||||
data Verx = Verx
|
||||
{ _vxPos :: !Point3
|
||||
@@ -88,3 +91,6 @@ makeLenses ''Verx
|
||||
deriveJSON defaultOptions ''Verx
|
||||
deriveJSON defaultOptions ''Layer
|
||||
deriveJSON defaultOptions ''ShadNum
|
||||
$($(derive [d| instance Deriving (Store Verx) |]))
|
||||
$($(derive [d| instance Deriving (Store Layer) |]))
|
||||
$($(derive [d| instance Deriving (Store ShadNum) |]))
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
--{-# LANGUAGE StandaloneDeriving #-}
|
||||
--{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{- |
|
||||
WARNING: orphan instances concerning Aeson classes and Linear.Quaternion datatypes have been introduced.
|
||||
The warnings have been disabled.
|
||||
@@ -15,6 +17,9 @@ import Geometry.Data
|
||||
import Geometry.Vector3D
|
||||
import qualified Linear.Quaternion as Q
|
||||
import Linear.Quaternion
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import LinearHelp
|
||||
|
||||
instance ToJSON a => ToJSON (Q.Quaternion a) where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
@@ -35,3 +40,7 @@ vToQuat a b
|
||||
| otherwise = Q.axisAngle cprod (angleVV3 a b)
|
||||
where
|
||||
cprod = crossProd a b
|
||||
|
||||
$($(derive [d|
|
||||
instance (Store a => Deriving (Store (Quaternion a)))
|
||||
|]))
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
|
||||
module Shape.Data
|
||||
where
|
||||
import LinearHelp
|
||||
import Geometry.Data
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Control.Lens
|
||||
import Streaming
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
type Shape' = Stream (Of ShapeObj) IO ()
|
||||
type Shape = [ShapeObj]
|
||||
|
||||
@@ -47,3 +50,6 @@ pairToSV :: (Point3,Point4) -> ShapeV
|
||||
pairToSV = uncurry ShapeV
|
||||
makeLenses ''ShapeV
|
||||
makeLenses ''ShapeObj
|
||||
$($(derive [d| instance Deriving (Store ShapeV) |]))
|
||||
$($(derive [d| instance Deriving (Store ShapeObj) |]))
|
||||
$($(derive [d| instance Deriving (Store ShapeType) |]))
|
||||
|
||||
+10
-8
@@ -3,6 +3,9 @@
|
||||
|
||||
module Sound.Data where
|
||||
|
||||
import TH.Derive
|
||||
import Data.Store
|
||||
import LinearHelp
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
@@ -18,8 +21,6 @@ data SoundStatus = SoundStatus
|
||||
}
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
|
||||
|
||||
-- TODO make this more sensible (use product rather than union in some cases)
|
||||
data PlayStatus
|
||||
= JustStartedPlaying
|
||||
@@ -29,13 +30,9 @@ data PlayStatus
|
||||
| ToStop
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
|
||||
|
||||
newtype SoundID = SoundID {_getSoundID :: Int}
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
|
||||
|
||||
newtype SoundData = SoundData
|
||||
{ _loadedChunks :: IM.IntMap Mix.Chunk
|
||||
}
|
||||
@@ -50,8 +47,6 @@ data ToPlaySound = ToPlaySound
|
||||
}
|
||||
deriving (Eq, Show)
|
||||
|
||||
|
||||
|
||||
data Sound = Sound
|
||||
{ _soundTime :: Maybe Int
|
||||
, _soundStatus :: SoundStatus
|
||||
@@ -72,3 +67,10 @@ deriveJSON defaultOptions ''SoundStatus
|
||||
deriveJSON defaultOptions ''PlayStatus
|
||||
deriveJSON defaultOptions ''SoundID
|
||||
deriveJSON defaultOptions ''ToPlaySound
|
||||
|
||||
{- FOURMOLU_DISABLE -}
|
||||
$($(derive [d| instance Deriving (Store SoundStatus) |]))
|
||||
$($(derive [d| instance Deriving (Store PlayStatus) |]))
|
||||
$($(derive [d| instance Deriving (Store SoundID) |]))
|
||||
$($(derive [d| instance Deriving (Store ToPlaySound) |]))
|
||||
{- FOURMOLU_ENABLE -}
|
||||
|
||||
Reference in New Issue
Block a user