Work towards adding external ammo sources

This commit is contained in:
2023-05-17 11:01:52 +01:00
parent 63c71c852d
commit 7df81559d9
30 changed files with 246 additions and 196 deletions
+20 -7
View File
@@ -20,17 +20,26 @@ import Dodge.Data.Item.Use.Consumption.LoadAction
data HeldConsumption
= LoadableAmmo
{ _laAmmoType :: AmmoType
, _laMax :: Int
, _laLoaded :: Int
, _laPrimed :: Bool
, _laCycle :: [LoadAction]
, _laProgress :: Maybe [LoadAction]
, _laSource :: AmmoSource
, _laSourceType :: AmmoSourceType
}
| ChargingAmmo { _caCharge :: Int
, _caMax :: Int }
| NoConsumption
deriving (Eq, Show, Read) --Generic, Flat)
data AmmoSource
= InternalSource InternalAmmo
| ExternalSource { _eaAttachment :: Maybe Int }
deriving (Eq, Show, Read) --Generic, Flat)
data InternalAmmo = InternalAmmo
{ _iaMax :: Int
, _iaLoaded :: Int
, _iaPrimed :: Bool
, _iaCycle :: [LoadAction]
, _iaProgress :: Maybe [LoadAction]
}
deriving (Eq, Show, Read) --Generic, Flat)
data LeftConsumption
= AutoRecharging
{ _arLoaded :: Int
@@ -53,6 +62,10 @@ newtype ItAmount = ItAmount {_getItAmount :: Int}
makeLenses ''HeldConsumption
makeLenses ''LeftConsumption
makeLenses ''ItAmount
makePrisms ''AmmoSource
makeLenses ''InternalAmmo
deriveJSON defaultOptions ''InternalAmmo
deriveJSON defaultOptions ''AmmoSource
deriveJSON defaultOptions ''HeldConsumption
deriveJSON defaultOptions ''LeftConsumption
deriveJSON defaultOptions ''ItAmount