115 lines
3.0 KiB
Haskell
115 lines
3.0 KiB
Haskell
{-# LANGUAGE DeriveAnyClass #-}
|
|
{-# LANGUAGE DeriveGeneric #-}
|
|
{-# LANGUAGE ScopedTypeVariables #-}
|
|
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.Creature (
|
|
module Dodge.Data.Creature,
|
|
module Dodge.Data.Creature.Misc,
|
|
module Dodge.Data.Creature.State,
|
|
module Dodge.Data.Creature.Perception,
|
|
module Dodge.Data.Creature.Memory,
|
|
module Dodge.Data.Creature.Stance,
|
|
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
|
|
import Dodge.Data.Creature.Misc
|
|
import Dodge.Data.Creature.Perception
|
|
import Dodge.Data.Creature.Stance
|
|
import Dodge.Data.Creature.State
|
|
import Dodge.Data.Hammer
|
|
import Dodge.Data.Item
|
|
import Dodge.Data.Material
|
|
import Geometry.Data
|
|
import qualified IntMapHelp as IM
|
|
|
|
--import MaybeHelp
|
|
|
|
data Creature = Creature
|
|
{ _crPos :: Point2
|
|
, _crOldPos :: Point2
|
|
, _crVel :: Point2
|
|
, _crDir :: Float
|
|
, _crOldDir :: Float
|
|
, _crMvDir :: Float
|
|
, _crMvAim :: Float
|
|
, _crTwist :: Float
|
|
, _crType :: CreatureType
|
|
, _crID :: Int
|
|
, _crRad :: Float
|
|
, _crMass :: Float
|
|
, _crHP :: Int
|
|
, _crMaxHP :: Int
|
|
, _crInv :: IM.IntMap Item
|
|
, _crManipulation :: Manipulation
|
|
, _crInvCapacity :: Int
|
|
, _crInvLock :: Bool
|
|
, _crInvEquipped :: IM.IntMap EquipPosition
|
|
, _crEquipment :: M.Map EquipPosition Int
|
|
, _crInvHotkeys :: IM.IntMap Hotkey
|
|
, _crHotkeys :: M.Map Hotkey Int
|
|
, _crState :: CreatureState
|
|
, _crCorpse :: CreatureCorpse --Creature -> Corpse -> SPic
|
|
, _crMaterial :: Material
|
|
, _crPastDamage :: Int
|
|
, _crStance :: Stance
|
|
, _crActionPlan :: ActionPlan
|
|
, _crMeleeCooldown :: Int
|
|
, _crPerception :: Perception
|
|
, _crMemory :: Memory
|
|
, _crVocalization :: Vocalization
|
|
, _crFaction :: Faction
|
|
, _crGroup :: CrGroup
|
|
, _crIntention :: Intention
|
|
, _crMvType :: CrMvType
|
|
, _crHammerPosition :: HammerPosition
|
|
, _crName :: String
|
|
, _crStatistics :: CreatureStatistics
|
|
, _crCamouflage :: CamouflageStatus
|
|
-- , _crTargeting :: CreatureTargeting
|
|
}
|
|
|
|
--deriving (Eq, Show, Read) --Generic, Flat)
|
|
|
|
data CreatureTargeting = CreatureTargeting
|
|
{ _ctPos :: Maybe Point2
|
|
, _ctType :: Maybe TargetingType
|
|
, _ctID :: Maybe Int
|
|
, _ctActive :: Bool
|
|
}
|
|
|
|
data CreatureCorpse = MakeDefaultCorpse
|
|
|
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data Intention = Intention
|
|
{ _targetCr :: Maybe Creature
|
|
, _mvToPoint :: Maybe Point2
|
|
, _viewPoint :: Maybe Point2
|
|
}
|
|
|
|
--deriving (Eq, Show, Read) --Generic, Flat)
|
|
|
|
makeLenses ''Creature
|
|
makeLenses ''CreatureTargeting
|
|
makeLenses ''Intention
|
|
|
|
concat
|
|
<$> mapM
|
|
(deriveJSON defaultOptions)
|
|
[ ''CreatureCorpse
|
|
, ''Creature
|
|
, ''Intention
|
|
, ''CreatureTargeting
|
|
]
|