Start moving creature properties out of records

This commit is contained in:
2025-06-06 08:46:27 +01:00
parent bae75a1e60
commit 4ae7c6ebd6
32 changed files with 609 additions and 672 deletions
+13 -11
View File
@@ -1,12 +1,12 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Bullet
( module Dodge.Data.Bullet
, module Dodge.Data.Damage
)where
module Dodge.Data.Bullet (
module Dodge.Data.Bullet,
module Dodge.Data.Damage,
) where
import Control.Lens
import Data.Aeson
@@ -17,18 +17,20 @@ import Geometry.Data
data Bullet = Bullet
{ _buEffect :: BulletEffect
, _buPayload :: BulletPayload
-- , _buTrajectory :: BulletTrajectory
, _buVel :: Point2
, -- , _buTrajectory :: BulletTrajectory
_buVel :: Point2
, _buDrag :: Float
, _buPos :: Point2
, _buOldPos :: Point2
, _buWidth :: Float
-- , _buTimer :: Int
, _buDamages :: [Damage]
}
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data EnergyBallType = IncBall | TeslaBall | ConcBall
data EnergyBallType
= IncBall
| TeslaBall
| ConcBall
| FlashBall
deriving (Show, Eq, Ord, Enum, Bounded, Read) --Generic, Flat)
@@ -38,8 +40,8 @@ data BulletEffect
| PenetrateBullet
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
data BulletPayload
= BulBall {_spawnEBT :: EnergyBallType}
data BulletPayload
= BulBall {_spawnEBT :: EnergyBallType}
| BulSpark
| BulFlak
| BulFrag
+1 -7
View File
@@ -36,10 +36,8 @@ data Creature = Creature
{ _crPos :: Point2
, _crOldPos :: Point2
, _crDir :: Float
, _crOldDir :: Float
, _crMvDir :: Float
, _crMvAim :: Float
-- , _crTwist :: Float
, _crType :: CreatureType
, _crID :: Int
, _crRad :: Float
@@ -52,7 +50,6 @@ data Creature = Creature
, _crInvLock :: Bool
, _crEquipment :: M.Map EquipSite Int
, _crState :: CreatureState
, _crCorpse :: CreatureCorpse --Creature -> Corpse -> SPic
, _crMaterial :: Material
, _crPastDamage :: Int
, _crStance :: Stance
@@ -70,8 +67,6 @@ data Creature = Creature
, _crDeathTimer :: Int
}
data CreatureCorpse = MakeDefaultCorpse
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Intention = Intention
@@ -88,7 +83,6 @@ makeLenses ''Intention
concat
<$> mapM
(deriveJSON defaultOptions)
[ ''CreatureCorpse
, ''Creature
[ ''Creature
, ''Intention
]
+14 -7
View File
@@ -68,19 +68,26 @@ data Pulse = PulseStatus
data CreatureType
= Avatar
{ _skinHead :: Color
, _skinUpper :: Color
, _skinLower :: Color
, _avatarPulse :: Pulse
-- { _skinHead :: Color
-- , _skinUpper :: Color
-- , _skinLower :: Color
{ _avatarPulse :: Pulse
}
| Humanoid
| AvatarDead
| ChaseCrit
| SwarmCrit
| AutoCrit
| BarrelCrit{_barrelType :: BarrelType}
| LampCrit {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int}
data CreatureShape
= Humanoid
{ _skinHead :: Color
, _skinUpper :: Color
, _skinLower :: Color
, _humanoidAI :: HumanoidAI
}
| Barreloid {_barrelType :: BarrelType}
| Lampoid {_lampHeight :: Float, _lampColor :: Point3, _lampLSID :: Maybe Int}
| Barreloid
| NonDrawnCreature
deriving (Eq, Ord, Show, Read) --Generic, Flat)
-1
View File
@@ -42,7 +42,6 @@ data Item = Item
, _itType :: ItemType
, _itID :: NewInt ItmInt
, _itLocation :: ItemLocation
-- , _itEffect :: ItEffect
, _itTargeting :: ItemTargeting
, _itParams :: ItemParams
, _itScroll :: ItemScroll
+2
View File
@@ -10,8 +10,10 @@ module Dodge.Data.Item.Use (
module Dodge.Data.GenFloat,
module Dodge.Data.Item.Scope,
module Dodge.Data.Item.BulletMod,
module Dodge.Data.Payload
) where
import Dodge.Data.Payload
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
+1 -23
View File
@@ -1,26 +1,12 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Use.Consumption.Ammo (
module Dodge.Data.Item.Use.Consumption.Ammo,
module Dodge.Data.Bullet,
module Dodge.Data.Payload,
-- module Dodge.Data.Payload,
) where
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.Bullet
import Dodge.Data.Payload
data ProjectileUpdate
= ThrustPU {_pjuStart :: Int, _pjuEnd :: Int}
| StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int}
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data ForceFieldType = DefaultForceField
deriving (Eq, Ord, Show, Read) --Generic, Flat)
@@ -30,11 +16,3 @@ data GasFuel = ChemFuel
data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
makeLenses ''ProjectileUpdate
--makeLenses ''AmmoType
deriveJSON defaultOptions ''GasFuel
deriveJSON defaultOptions ''ProjectileUpdate
deriveJSON defaultOptions ''GasCreate
deriveJSON defaultOptions ''ForceFieldType
--deriveJSON defaultOptions ''AmmoType
+37 -33
View File
@@ -1,56 +1,59 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Projectile where
import Dodge.Data.Wall.Structure
import Dodge.Data.Item.Location
import NewInt
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.Item.Use.Consumption.Ammo
import Dodge.Data.Item.Location
import Dodge.Data.Wall.Structure
import Geometry.Data
import NewInt
import Dodge.Data.Payload
data Projectile
= Shell
{ _pjPos :: Point2
, _pjVel :: Point2
, _pjDir :: Float
, _pjSpin :: Float
, _pjSpinFactor :: Float
, _pjID :: Int
, _pjPayload :: Payload
, _pjTimer :: Int
, _pjZ :: Float
, _pjZVel :: Float
, _pjUpdates :: [ProjectileUpdate]
, _pjType :: ProjectileType
, _pjDetonatorID :: Maybe (NewInt ItmInt)
, _pjScreenID :: Maybe (NewInt ItmInt)
}
data Projectile = Shell
{ _pjPos :: Point2
, _pjVel :: Point2
, _pjDir :: Float
, _pjSpin :: Float
, _pjSpinFactor :: Float
, _pjID :: Int
, _pjPayload :: Payload
, _pjTimer :: Int
, _pjZ :: Float
, _pjZVel :: Float
, _pjUpdates :: [ProjectileUpdate]
, _pjType :: ProjectileType
, _pjDetonatorID :: Maybe (NewInt ItmInt)
, _pjScreenID :: Maybe (NewInt ItmInt)
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data ProjectileUpdate
= ThrustPU {_pjuStart :: Int, _pjuEnd :: Int}
| StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int}
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data ProjectileType
= Grenade
{ _gnHitEffect :: GrenadeHitEffect
}
| Rocket
{_rkHoming :: RocketHoming
,_rkSmoke :: Maybe RocketSmoke
= Grenade { _gnHitEffect :: GrenadeHitEffect }
| Rocket
{ _rkHoming :: RocketHoming
, _rkSmoke :: Maybe RocketSmoke
}
| RetiredProjectile
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data RocketHoming
= NoHoming
data RocketHoming
= NoHoming
| HomeUsingRemoteScreen {_phRemoteID :: NewInt ItmInt}
| HomeUsingTargeting {_phTargetingID :: NewInt ItmInt}
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data GrenadeHitEffect
data GrenadeHitEffect
= GBounce {_bounceTolerance :: Float}
| GStick
| GStuckCreature {_stuckCrID :: Int, _stuckCrOffset :: Point2, _stuckCrRot :: Float}
@@ -58,14 +61,15 @@ data GrenadeHitEffect
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data RocketSmoke
= ReducedRocketSmoke
= ReducedRocketSmoke
deriving (Show, Eq, Ord, Read) --Generic, Flat)
makeLenses ''ProjectileUpdate
makeLenses ''Projectile
makeLenses ''ProjectileType
makeLenses ''RocketHoming
makeLenses ''GrenadeHitEffect
deriveJSON defaultOptions ''ProjectileUpdate
deriveJSON defaultOptions ''GrenadeHitEffect
deriveJSON defaultOptions ''RocketHoming
deriveJSON defaultOptions ''RocketSmoke