Allow to equip left click items

This commit is contained in:
2021-11-27 02:01:12 +00:00
parent 774808663a
commit e7ea7377e2
21 changed files with 93 additions and 116 deletions
+3 -13
View File
@@ -104,11 +104,11 @@ wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
Nothing -> closeObjScrollDir y w
Just f -> w & creatures . ix 0 . crInv . ix (_crInvSel $ you w) %~ f y (you w)
| lbDown -> w & cameraZoom +~ y
| invKeyDown -> swapInvDir yi $ dirInvPos yi w
| otherwise -> dirInvPos yi w
| invKeyDown -> swapInvDir yi $ stopSoundFrom (CrReloadSound 0) $ dirInvPos yi w
| otherwise -> stopSoundFrom (CrReloadSound 0) $ dirInvPos yi w
(_, TweakInventory)
| invKeyDown && rbDown -> w & moveYourAmmoSel yi
| invKeyDown -> dirInvPos yi w
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ dirInvPos yi w
| rbDown -> w & moveYourAmmoParam yi
| otherwise -> w & moveYourAmmoSel yi
(_, _) -> w
@@ -132,14 +132,4 @@ moveYourAmmoParam i w = case yourItem w ^? wpAmmo . amPjParams . ix paramid . pj
where
paramid = _amParamSel $ _wpAmmo $ yourItem w
swapInvDir :: Int -> World -> World
swapInvDir k w = w & creatures . ix (_yourID w) . crInv %~ IM.swapKeys (i `mod` n) ((i + k) `mod` n)
where
i = _crInvSel $ you w
n = length $ IM.keys $ _crInv $ _creatures w IM.! _yourID w
dirInvPos :: Int -> World -> World
dirInvPos i w = stopSoundFrom (CrReloadSound 0) $ w
& creatures . ix (_yourID w) . crInvSel %~ (`mod` n) . subtract i
where
n = length $ IM.keys $ _crInv $ _creatures w IM.! _yourID w