Make ammo magazines into own item type

This commit is contained in:
2024-06-22 12:03:32 +01:00
parent 35a56eef56
commit 8e127f0603
17 changed files with 258 additions and 255 deletions
+1
View File
@@ -43,6 +43,7 @@ itemEffect cr it w = case it ^. itUse of
(ConsumeUse eff _) -> useC eff it cr $ rmInvItem (_crID cr) itRef w
CraftUse{} -> w
AttachUse{} -> w
AmmoMagUse{} -> w
where
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
hammerTest f = case _crHammerPosition cr of
+1 -1
View File
@@ -174,7 +174,7 @@ reloadOverride :: Creature -> Creature
reloadOverride cr = fromMaybe cr $ do
guard $ cr ^. crStance . posture == Aiming
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
guard $ cr ^? crInv . ix (itRef + 1) . itUse . attachParams . ammoLoadStatus . iaLoaded == Just 0
guard $ cr ^? crInv . ix (itRef + 1) . itUse . amagLoadStatus . iaLoaded == Just 0
return $ cr & crActionPlan . apStrategy .~ StrategyActions Reload reloadActions
where
reloadActions =
+1 -1
View File
@@ -42,7 +42,7 @@ crIsReloading cr = case cr ^? crManipulation . manObject . inInventory . iselAct
crWeaponReady :: Creature -> Bool
crWeaponReady cr = fromMaybe False $ do
i <- cr ^? crManipulation . manObject . inInventory . ispItem
x <- cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoLoadStatus . iaLoaded
x <- cr ^? crInv . ix (i + 1) . itUse . amagLoadStatus . iaLoaded
return (x > 0)
crCanSeeCr :: Creature -> (World, Creature) -> Bool