Allow for selection of equipment position
This commit is contained in:
+10
-3
@@ -126,9 +126,10 @@ wheelEvent y w = case _hudElement $ _hud w of
|
||||
-- functions that modify the inventory should be centralised so that
|
||||
-- this lock can be sensibly applied, perhaps
|
||||
| _crInvLock (_creatures w IM.! _yourID w) -> w
|
||||
| rbDown -> case yourItem w ^? _Just . itScroll of
|
||||
Nothing -> closeObjScrollDir y w
|
||||
Just f -> w & creatures . ix 0 . crInv . ix (_crInvSel $ you w) %~ f y (you w)
|
||||
| rbDown -> case (yourItem w ^? _Just . itUse . heldScroll,_rbOptions w) of
|
||||
(_,EquipOptions{}) -> scrollRBOption y w
|
||||
(Nothing,_) -> closeObjScrollDir y w
|
||||
(Just f,_) -> w & creatures . ix 0 . crInv . ix (_crInvSel $ you w) %~ f y (you w)
|
||||
| lbDown -> w & cameraZoom +~ y
|
||||
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ changeSwapInvSel yi w
|
||||
| otherwise -> stopSoundFrom (CrReloadSound 0) $ changeAugInvSel yi w
|
||||
@@ -148,6 +149,12 @@ wheelEvent y w = case _hudElement $ _hud w of
|
||||
lbDown = ButtonLeft `S.member` _mouseButtons w
|
||||
invKeyDown = ScancodeCapsLock `S.member` _keys w
|
||||
|
||||
scrollRBOption :: Float -> World -> World
|
||||
scrollRBOption y w
|
||||
| y < 0 = w & rbOptions . opSel %~ (min (length (_opEquip (_rbOptions w))-1) . (+1))
|
||||
| y > 0 = w & rbOptions . opSel %~ (max 0 . (subtract 1))
|
||||
| otherwise = w
|
||||
|
||||
-- nice idea, but the chain of setters and getters seems prohibitive
|
||||
--scrollOver :: Foldable t
|
||||
-- => ASetter s s Int Int -- index setter
|
||||
|
||||
Reference in New Issue
Block a user