Add Store instances

This commit is contained in:
2022-08-21 12:21:05 +01:00
parent 1ce7d4a72d
commit dd62e30026
92 changed files with 465 additions and 255 deletions
+9 -6
View File
@@ -9,6 +9,8 @@ module Dodge.Data.Item.Use.Consumption.Ammo (
module Dodge.Data.Payload,
) where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
@@ -19,11 +21,9 @@ import Dodge.Data.Payload
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary ProjectileDraw
data ProjectileCreate = CreateShell | CreateTrackingShell
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary ProjectileCreate
data ProjectileUpdate
= PJThrust {_pjuStart :: Int, _pjuEnd :: Int}
@@ -37,7 +37,6 @@ data ProjectileUpdate
| PJShellCollisionCheck
| PJRemoteShellCollisionCheck
deriving (Show, Read, Eq, Ord, Generic, Flat)
instance Binary ProjectileUpdate
data AmmoType
= ProjectileAmmo
@@ -61,15 +60,13 @@ data AmmoType
}
| GenericAmmo
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary AmmoType
data ForceFieldType = DefaultForceField
| HackForceFieldType
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ForceFieldType
data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq, Ord, Show, Enum, Bounded, Read, Generic, Flat)
instance Binary GasCreate
makeLenses ''ProjectileUpdate
makeLenses ''AmmoType
@@ -79,3 +76,9 @@ deriveJSON defaultOptions ''ProjectileUpdate
deriveJSON defaultOptions ''AmmoType
deriveJSON defaultOptions ''GasCreate
deriveJSON defaultOptions ''ForceFieldType
$($(derive [d| instance Deriving (Store AmmoType) |]))
$($(derive [d| instance Deriving (Store ProjectileDraw ) |]))
$($(derive [d| instance Deriving (Store ProjectileCreate ) |]))
$($(derive [d| instance Deriving (Store ProjectileUpdate) |]))
$($(derive [d| instance Deriving (Store ForceFieldType ) |]))
$($(derive [d| instance Deriving (Store GasCreate ) |]))
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Use.Consumption.LoadAction where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import Control.Lens
@@ -19,17 +21,14 @@ data LoadAction
| LoadAdd {_actionTime :: Int, _actionSound :: SoundID, _insertMax :: Int}
| LoadPrime {_actionTime :: Int, _actionSound :: SoundID}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LoadAction
data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary InvSel
data InvSelAction
= NoInvSelAction
| ReloadAction {_actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary InvSelAction
makeLenses ''LoadAction
makeLenses ''InvSel
@@ -37,3 +36,6 @@ makeLenses ''InvSelAction
deriveJSON defaultOptions ''LoadAction
deriveJSON defaultOptions ''InvSel
deriveJSON defaultOptions ''InvSelAction
$($(derive [d| instance Deriving (Store LoadAction) |]))
$($(derive [d| instance Deriving (Store InvSelAction) |]))
$($(derive [d| instance Deriving (Store InvSel ) |]))