Partially working change to selected items
This commit is contained in:
@@ -68,7 +68,7 @@ stateUpdate f =
|
||||
heldAimEffects :: Creature -> World -> World
|
||||
heldAimEffects cr = fromMaybe id $ do
|
||||
guard (crIsAiming cr)
|
||||
ipos <- cr ^? crInvSel . iselPos
|
||||
ipos <- cr ^? crInvSel . isel . ispItem
|
||||
itm <- cr ^? crInv . ix ipos
|
||||
f <- itm ^? itEffect . ieWhileAiming
|
||||
return $ doInvEffect f itm cr
|
||||
@@ -258,15 +258,12 @@ createAttachLight cr it = createTorchLightOffset cr it attachoff
|
||||
attachoff = it ^?! itDimension . dimAttachPos
|
||||
|
||||
itemUpdate :: Creature -> Int -> Item -> Item
|
||||
itemUpdate cr i
|
||||
| i == crSel cr = baseupdate True
|
||||
| otherwise = baseupdate False
|
||||
where
|
||||
baseupdate bool =
|
||||
updateAutoRecharge
|
||||
itemUpdate cr i = updateAutoRecharge
|
||||
. (itUse %~ useUpdate)
|
||||
. (itLocation .~ InInv (_crID cr) i)
|
||||
. (itIsHeld .~ bool)
|
||||
. (itIsHeld .~ itmisheld)
|
||||
where
|
||||
itmisheld = Just i == (cr ^? crInvSel . isel . ispItem)
|
||||
|
||||
updateAutoRecharge :: Item -> Item
|
||||
updateAutoRecharge it = case it ^? itUse . leftConsumption of
|
||||
@@ -282,12 +279,12 @@ crGetTargeting cr = do
|
||||
where
|
||||
hastargeting itm = isJust (itm ^? itUse . useTargeting . _Just)
|
||||
helditem = fromMaybe [] $ do
|
||||
i <- cr ^? crInvSel . iselPos
|
||||
i <- cr ^? crInvSel . isel . ispItem
|
||||
itm <- cr ^? crInv . ix i
|
||||
return [itm]
|
||||
|
||||
weaponReloadSounds :: Creature -> World -> World
|
||||
weaponReloadSounds cr w = case cr ^? crInvSel . iselAction of
|
||||
weaponReloadSounds cr w = case cr ^? crInvSel . isel . iselAction of
|
||||
Just ReloadAction{_reloadAction = la} ->
|
||||
soundContinue
|
||||
(CrReloadSound cid)
|
||||
|
||||
Reference in New Issue
Block a user