Move from store to flat

This commit is contained in:
2022-08-20 17:54:35 +01:00
parent 8571ab9254
commit ff9dbdf068
95 changed files with 793 additions and 748 deletions
+6 -6
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
@@ -8,6 +10,7 @@ module Dodge.Data.Item.Use.Consumption (
module Dodge.Data.Item.Use.Consumption.LoadAction,
) where
import Flat
import TH.Derive
import Data.Store
import Control.Lens
@@ -26,7 +29,7 @@ data HeldConsumption
, _laProgress :: Maybe [LoadAction]
}
| NoConsumption
deriving (Eq, Show, Read)
deriving (Eq, Show, Read, Generic, Flat)
data LeftConsumption
= AutoRecharging
@@ -39,10 +42,10 @@ data LeftConsumption
{ _wpMaxCharge :: Int
, _wpCharge :: Int
}
deriving (Eq, Show, Read)
deriving (Eq, Show, Read, Generic, Flat)
newtype ItAmount = ItAmount {_getItAmount :: Int}
deriving (Eq, Ord, Read, Show, Num, Real, Enum, Integral)
deriving (Eq, Ord, Read, Show, Num, Real, Enum, Integral, Generic, Flat)
makeLenses ''HeldConsumption
makeLenses ''LeftConsumption
@@ -50,6 +53,3 @@ 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) |]))
+9 -13
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
@@ -7,6 +9,7 @@ module Dodge.Data.Item.Use.Consumption.Ammo (
module Dodge.Data.Payload,
) where
import Flat
import TH.Derive
import Data.Store
import Control.Lens
@@ -16,10 +19,10 @@ import Dodge.Data.Bullet
import Dodge.Data.Payload
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
deriving (Show, Read, Eq, Ord, Enum, Bounded)
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
data ProjectileCreate = CreateShell | CreateTrackingShell
deriving (Show, Read, Eq, Ord, Enum, Bounded)
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
data ProjectileUpdate
= PJThrust {_pjuStart :: Int, _pjuEnd :: Int}
@@ -32,7 +35,7 @@ data ProjectileUpdate
| PJDecTimMvVel
| PJShellCollisionCheck
| PJRemoteShellCollisionCheck
deriving (Show, Read, Eq, Ord)
deriving (Show, Read, Eq, Ord, Generic, Flat)
data AmmoType
= ProjectileAmmo
@@ -55,14 +58,13 @@ data AmmoType
{ _amForceFieldType :: ForceFieldType
}
| GenericAmmo
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data ForceFieldType = DefaultForceField
| HackForTemplateForceField
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq, Ord, Show, Enum, Bounded, Read)
deriving (Eq, Ord, Show, Enum, Bounded, Read, Generic, Flat)
makeLenses ''ProjectileUpdate
makeLenses ''AmmoType
@@ -72,9 +74,3 @@ 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) |]))
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Use.Consumption.LoadAction where
import Flat
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -16,15 +19,15 @@ data LoadAction
| LoadInsert {_actionTime :: Int, _actionSound :: SoundID}
| LoadAdd {_actionTime :: Int, _actionSound :: SoundID, _insertMax :: Int}
| LoadPrime {_actionTime :: Int, _actionSound :: SoundID}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data InvSelAction
= NoInvSelAction
| ReloadAction {_actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''LoadAction
makeLenses ''InvSel
@@ -32,6 +35,3 @@ 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) |]))
+5 -4
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
@@ -6,6 +8,7 @@ module Dodge.Data.Item.Use.Equipment (
module Dodge.Data.Item.Use.Equipment,
) where
import Flat
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -22,17 +25,15 @@ data EquipEffect = EquipEffect
, _eeParams :: EquipParams
, _eeViewDist :: Maybe Float
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data EquipParams
= NoEquipParams
| EquipID {_eparamID :: Int}
| EquipCounter {_eparamInt :: Int}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''EquipEffect
makeLenses ''EquipParams
deriveJSON defaultOptions ''EquipEffect
deriveJSON defaultOptions ''EquipParams
$($(derive [d| instance Deriving (Store EquipEffect) |]))
$($(derive [d| instance Deriving (Store EquipParams) |]))