Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+13 -20
View File
@@ -1,4 +1,3 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
@@ -9,11 +8,15 @@ module Dodge.Data.Creature (
module Dodge.Data.Creature.Perception,
module Dodge.Data.Creature.Memory,
module Dodge.Data.Creature.Stance,
module Dodge.Data.ActionPlan
module Dodge.Data.ActionPlan,
module Dodge.Data.Item,
module Dodge.Data.Material,
module Dodge.Data.Hammer,
) where
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import qualified Data.Map.Strict as M
import Dodge.Data.ActionPlan
import Dodge.Data.Creature.Memory
@@ -24,7 +27,6 @@ import Dodge.Data.Creature.State
import Dodge.Data.Hammer
import Dodge.Data.Item
import Dodge.Data.Material
import GHC.Generics
import Geometry.Data
import qualified IntMapHelp as IM
@@ -68,32 +70,23 @@ data Creature = Creature
, _crStatistics :: CreatureStatistics
, _crCamouflage :: CamouflageStatus
}
deriving (Eq, Show, Read, Generic)
instance ToJSON Creature where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Creature
deriving (Eq, Show, Read)
data CreatureCorpse = MakeDefaultCorpse
deriving (Eq, Ord, Show, Read, Generic)
instance ToJSON CreatureCorpse where
toEncoding = genericToEncoding defaultOptions
instance FromJSON CreatureCorpse
deriving (Eq, Ord, Show, Read)
data Intention = Intention
{ _targetCr :: Maybe Creature
, _mvToPoint :: Maybe Point2
, _viewPoint :: Maybe Point2
}
deriving (Eq, Show, Read, Generic)
deriving (Eq, Show, Read)
instance ToJSON Intention where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Intention
crSel :: Creature -> Int
crSel = _iselPos . _crInvSel
makeLenses ''Creature
makeLenses ''Intention
deriveJSON defaultOptions ''Creature
deriveJSON defaultOptions ''CreatureCorpse
deriveJSON defaultOptions ''Intention