Commit before rethinking item ammo containers

This commit is contained in:
2024-12-18 19:20:37 +00:00
parent 9bc9dd2a08
commit db8e26b99d
4 changed files with 239 additions and 227 deletions
+3 -5
View File
@@ -116,11 +116,9 @@ startInventory = IM.fromList $ zip [0 ..] startInvList
inventoryX :: Char -> [Item] inventoryX :: Char -> [Item]
inventoryX c = case c of inventoryX c = case c of
'A' -> 'A' ->
[ clickDetector x | x <- [minBound .. maxBound] [ flameThrower
] <> [pulseChecker,battery] <> fold , fuelPack
[ makeTypeCraftNum 1 TRANSFORMER , chemFuelPouch
, makeTypeCraftNum 2 CAN
, makeTypeCraftNum 2 PIPE
] ]
'B' -> 'B' ->
[ wristArmour [ wristArmour
+14 -1
View File
@@ -26,10 +26,21 @@ import Dodge.Data.Item.Scope
import Dodge.Data.Item.Use import Dodge.Data.Item.Use
import NewInt import NewInt
data ItID = ItID deriving (Eq, Ord, Show, Read) data ItID = ItID
deriving (Eq, Ord, Show, Read)
data Consumables
= NoConsumables
| AmmoMag
{ _magLoadStatus :: ReloadStatus
, _magParams :: AmmoParams
, _magType :: AmmoType
}
deriving (Eq, Show, Read)
data Item = Item data Item = Item
{ _itUse :: ItemUse { _itUse :: ItemUse
, _itConsumables :: Consumables
, _itType :: ItemType , _itType :: ItemType
, _itID :: NewInt ItmInt , _itID :: NewInt ItmInt
, _itLocation :: ItemLocation , _itLocation :: ItemLocation
@@ -47,7 +58,9 @@ data ItemTargeting = NoItTargeting
} }
makeLenses ''ItemTargeting makeLenses ''ItemTargeting
makeLenses ''Consumables
makeLenses ''Item makeLenses ''Item
deriveJSON defaultOptions ''Consumables
deriveJSON defaultOptions ''ItemTargeting deriveJSON defaultOptions ''ItemTargeting
deriveJSON defaultOptions ''ItID deriveJSON defaultOptions ''ItID
deriveJSON defaultOptions ''Item deriveJSON defaultOptions ''Item
+6 -3
View File
@@ -8,15 +8,17 @@ module Dodge.Default.Item (
module Dodge.Default.Item.Use, module Dodge.Default.Item.Use,
) where ) where
import qualified Data.IntMap.Strict as IM
import Control.Lens import Control.Lens
import qualified Data.IntMap.Strict as IM
import Dodge.Data.Item import Dodge.Data.Item
import Dodge.Default.Item.Use import Dodge.Default.Item.Use
import Geometry.Data import Geometry.Data
defaultHeldItem :: Item defaultHeldItem :: Item
defaultHeldItem = Item defaultHeldItem =
Item
{ _itType = HELD PISTOL { _itType = HELD PISTOL
, _itConsumables = NoConsumables
, _itEffect = defaultItEffect , _itEffect = defaultItEffect
, _itID = 0 -- should this return an error ? const $ error "itID not correctly initialised" ? , _itID = 0 -- should this return an error ? const $ error "itID not correctly initialised" ?
, _itTargeting = NoItTargeting , _itTargeting = NoItTargeting
@@ -36,7 +38,8 @@ singleAmmo :: a -> IM.IntMap a
singleAmmo x = IM.insert 0 x mempty singleAmmo x = IM.insert 0 x mempty
defaultBulletWeapon :: Item defaultBulletWeapon :: Item
defaultBulletWeapon = defaultHeldItem defaultBulletWeapon =
defaultHeldItem
& itAmmoSlots .~ singleAmmo BulletAmmo & itAmmoSlots .~ singleAmmo BulletAmmo
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet (UseExactly 1)] & itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet (UseExactly 1)]
+216 -218
View File
File diff suppressed because it is too large Load Diff