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
+4 -2
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Creature.Memory where
import Flat
import LinearHelp
import Control.Lens
import Data.Aeson
@@ -15,8 +18,7 @@ data Memory = Memory
{ _soundsToInvestigate :: [Point2]
, _nodesSearched :: [Int]
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Memory
deriveJSON defaultOptions ''Memory
$($(derive [d| instance Deriving (Store Memory) |]))
+9 -15
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
@@ -6,6 +8,7 @@ module Dodge.Data.Creature.Misc (
module Dodge.Data.CamouflageStatus,
) where
import Flat
import TH.Derive
import Data.Store
import Color
@@ -22,7 +25,7 @@ data CreatureStatistics = CreatureStatistics
, _dexterity :: Int
, _intelligence :: Int
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Vocalization
= Mute
@@ -32,7 +35,7 @@ data Vocalization
, _vcMaxCoolDown :: Int
, _vcCoolDown :: Int
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrMvType
= NoMvType
@@ -43,7 +46,7 @@ data CrMvType
, _mvTurnJit :: Float
, _mvAimSpeed :: FloatFloat
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data HumanoidAI
= YourAI
@@ -59,7 +62,7 @@ data HumanoidAI
| MiniGunAI
| LongAI
| MultGunAI
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data CreatureType
= Humanoid
@@ -71,10 +74,10 @@ data CreatureType
| Barreloid {_barrelType :: BarrelType}
| Lampoid {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int}
| NonDrawnCreature
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data BarrelType = PlainBarrel | ExplosiveBarrel
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''CreatureStatistics
makeLenses ''Vocalization
@@ -86,12 +89,3 @@ 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 -}
+9 -12
View File
@@ -1,3 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
@@ -21,6 +23,7 @@ module Dodge.Data.Creature.Perception (
auDist,
) where
import Flat
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -36,18 +39,18 @@ data Perception = Perception
, _cpVision :: Vision
, _cpAudition :: Audition
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Vision = Eyes
{ _viFOV :: FloatFloat
, _viDist :: FloatFloat
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
newtype Audition = Ears
{ _auDist :: FloatFloat
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Vigilance
= Comatose
@@ -55,17 +58,17 @@ data Vigilance
| Lethargic
| Vigilant
| Overstrung
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Attention
= AttentiveTo {_getAttentiveTo :: IM.IntMap Awareness}
| Fixated {_getFixated :: Int}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Awareness
= Suspicious Float
| Cognizant Float
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Perception
makeLenses ''Vision
@@ -77,9 +80,3 @@ 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) |]))
+7 -8
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Creature.Stance where
import Flat
import LinearHelp
import Control.Lens
import Data.Aeson
@@ -16,7 +19,7 @@ data Stance = Stance
, _posture :: Posture
, _strideLength :: Int
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Carriage
= Walking
@@ -27,19 +30,19 @@ data Carriage
| Floating
| Flying
| Boosting Point2
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data FootForward
= LeftForward
| RightForward
| WasLeftForward
| WasRightForward
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Posture
= Aiming
| AtEase
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''Stance
makeLenses ''Carriage
@@ -48,7 +51,3 @@ 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) |]))
+9 -11
View File
@@ -1,13 +1,16 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Creature.State where
import Flat
import Color
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import qualified Data.IntSet as IS
import qualified IntSetHelp as IS
import Dodge.Data.Damage
import Geometry.Data
import TH.Derive
@@ -18,18 +21,18 @@ data CreatureState = CrSt
, _csSpState :: CrSpState
, _csDropsOnDeath :: CreatureDropType
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data CreatureDropType
= DropAll
| DropAmount Int
| DropSpecific [Int]
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrSpState
= Barrel {_piercedPoints :: [Point2]}
| GenCr
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data Faction
= GenericFaction Int
@@ -40,7 +43,7 @@ data Faction
| NoFaction
| ColorFaction Color
| PlayerFaction
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data CrGroup
= LoneWolf
@@ -50,7 +53,7 @@ data CrGroup
}
| CrGroupID {_crGroupID :: Int}
| ShieldGroup
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''CreatureState
makeLenses ''CrSpState
@@ -60,8 +63,3 @@ 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) |]))