Remove old ammo code, add magazines to some test loadouts

This commit is contained in:
2024-06-21 23:24:26 +01:00
parent ecefba21d6
commit 944b40cb56
12 changed files with 182 additions and 165 deletions
+6 -6
View File
@@ -17,7 +17,7 @@ crCancelReloading cr =
updateProgress = fromMaybe id $ do
InInventory (SelItem i _) <- cr ^? crManipulation . manObject
return $
crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams . iaProgress
crInv . ix (i + 1) . itUse . attachParams . ammoLoadStatus . iaProgress
%~ const Nothing
stepReloading :: Creature -> Creature
@@ -27,14 +27,14 @@ stepReloading cr = case cr ^? crManipulation . manObject . inInventory of
cr & crManipulation . manObject . inInventory . iselAction . actionProgress -~ 1
| otherwise ->
cr
& crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams %~ doLoadAction la
& crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams %~ rotateActionProgress
& crInv . ix (i + 1) . itUse . attachParams . ammoLoadStatus %~ doLoadAction la
& crInv . ix (i + 1) . itUse . attachParams . ammoLoadStatus %~ rotateActionProgress
& tryNextLoadAction
_ -> cr
tryNextLoadAction :: Creature -> Creature
tryNextLoadAction cr = case cr ^? crManipulation . manObject . inInventory of
Just (SelItem i _) -> case cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams . iaProgress . _Just . ix 0 of
Just (SelItem i _) -> case cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoLoadStatus . iaProgress . _Just . ix 0 of
Nothing -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
Just la ->
cr & crManipulation . manObject . inInventory . iselAction . actionProgress .~ _actionTime la
@@ -49,7 +49,7 @@ crReload cr = case cr ^? crManipulation . manObject . inInventory . iselAction o
tryStartLoading :: Creature -> Creature
tryStartLoading cr = fromMaybe cr $ do
i <- cr ^? crManipulation . manObject . inInventory . ispItem
ia <- cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams
ia <- cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoLoadStatus
return $ startLoading ia cr
-- case as of
@@ -66,7 +66,7 @@ startLoading ic cr = case ic ^? iaProgress . _Just . ix 0 of
i <- cr ^? crManipulation . manObject . inInventory . ispItem
return $
cr & startLoadingStep la
& crInv . ix i . itUse . attachParams . ammoAttachParams . iaProgress ?~ (la : las)
& crInv . ix i . itUse . attachParams . ammoLoadStatus . iaProgress ?~ (la : las)
startLoadingStep :: LoadAction -> Creature -> Creature
startLoadingStep la cr = cr & crManipulation . manObject . inInventory . iselAction .~ ReloadAction (_actionTime la) la