Files
loop/src/Dodge/Data/Item/Use/Consumption/Ammo.hs
T
2022-08-21 10:58:19 +01:00

82 lines
2.5 KiB
Haskell

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# 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,
) where
import Data.Binary
import Flat
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.Bullet
import Dodge.Data.Payload
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary ProjectileDraw
data ProjectileCreate = CreateShell | CreateTrackingShell
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic, Flat)
instance Binary ProjectileCreate
data ProjectileUpdate
= PJThrust {_pjuStart :: Int, _pjuEnd :: Int}
| PJSpin {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
| PJTrack {_pjuStart :: Int, _pjuEnd :: Int, _pjuITID :: Int}
| PJReduceSpin {_pjuReduceSpin :: Float}
| PJRemoteDirection {_pjuStart :: Int, _pjuEnd :: Int, _pjuCID :: Int, _pjuITID :: Int}
| PJSetScope {_pjuITID :: Int}
| PJRetireRemote {_pjuITID :: Int, _pjuTimer :: Int, _pjuPJID :: Int}
| PJDecTimMvVel
| PJShellCollisionCheck
| PJRemoteShellCollisionCheck
deriving (Show, Read, Eq, Ord, Generic, Flat)
instance Binary ProjectileUpdate
data AmmoType
= ProjectileAmmo
{ _amPayload :: Payload
, _amString :: String
, _amPjDraw :: ProjectileDraw
, _amPjCreation :: ProjectileCreate
}
| BulletAmmo
{ _amString :: String
, _amBullet :: Bullet
}
| DroneAmmo
{_amString :: String}
| GasAmmo
{ _amString :: String
, _amCreateGas :: GasCreate
}
| ForceFieldAmmo
{ _amForceFieldType :: ForceFieldType
}
| GenericAmmo
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary AmmoType
data ForceFieldType = DefaultForceField
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary ForceFieldType
data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq, Ord, Show, Enum, Bounded, Read, Generic, Flat)
instance Binary GasCreate
makeLenses ''ProjectileUpdate
makeLenses ''AmmoType
deriveJSON defaultOptions ''ProjectileDraw
deriveJSON defaultOptions ''ProjectileCreate
deriveJSON defaultOptions ''ProjectileUpdate
deriveJSON defaultOptions ''AmmoType
deriveJSON defaultOptions ''GasCreate
deriveJSON defaultOptions ''ForceFieldType