Work on inventory management

This commit is contained in:
2023-02-16 16:12:03 +00:00
parent ff5fa6321a
commit 934dd64704
30 changed files with 129 additions and 111 deletions
+4 -4
View File
@@ -68,7 +68,7 @@ stateUpdate f =
heldAimEffects :: Creature -> World -> World
heldAimEffects cr = fromMaybe id $ do
guard (crIsAiming cr)
ipos <- cr ^? crInvSel . isel . ispItem
ipos <- cr ^? crManipulation . isel . ispItem
itm <- cr ^? crInv . ix ipos
f <- itm ^? itEffect . ieWhileAiming
return $ doInvEffect f itm cr
@@ -263,7 +263,7 @@ itemUpdate cr i = updateAutoRecharge
. (itLocation .~ InInv (_crID cr) i)
. (itIsHeld .~ itmisheld)
where
itmisheld = Just i == (cr ^? crInvSel . isel . ispItem)
itmisheld = Just i == (cr ^? crManipulation . isel . ispItem)
updateAutoRecharge :: Item -> Item
updateAutoRecharge it = case it ^? itUse . leftConsumption of
@@ -279,12 +279,12 @@ crGetTargeting cr = do
where
hastargeting itm = isJust (itm ^? itUse . useTargeting . _Just)
helditem = fromMaybe [] $ do
i <- cr ^? crInvSel . isel . ispItem
i <- cr ^? crManipulation . isel . ispItem
itm <- cr ^? crInv . ix i
return [itm]
weaponReloadSounds :: Creature -> World -> World
weaponReloadSounds cr w = case cr ^? crInvSel . isel . iselAction of
weaponReloadSounds cr w = case cr ^? crManipulation . isel . iselAction of
Just ReloadAction{_reloadAction = la} ->
soundContinue
(CrReloadSound cid)