Distinguish between selected item and root-selected item

This commit is contained in:
2024-09-21 21:59:53 +01:00
parent 2154abfb1d
commit 31b5db6e9e
33 changed files with 313 additions and 281 deletions
+4 -4
View File
@@ -46,7 +46,7 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
_ -> w
where
rbscrollmax = fromMaybe 1 $ do
invid <- you w ^? crManipulation . manObject . inInventory . ispItem
invid <- you w ^? crManipulation . manObject . inInventory . imSelectedItem
esite <- you w ^? crInv . ix invid . itUse . equipEffect . eeSite
return $ length $ equipSiteToPositions esite
y = fromIntegral yi
@@ -111,15 +111,15 @@ scrollRBOption dy ymax
| otherwise = id
moveTweakSel :: Int -> World -> World
moveTweakSel i w = case yourItem w ^? _Just . itTweaks . tweakParams of
moveTweakSel i w = case yourSelectedItem w ^? _Just . itTweaks . tweakParams of
Just l -> moveSubSel i (length l) w
_ -> w
changeTweakParam :: Maybe Int -> Int -> World -> World
changeTweakParam mi i w = fromMaybe w $ do
curpos <- you w ^? crManipulation . manObject . inInventory . ispItem
curpos <- you w ^? crManipulation . manObject . inInventory . imSelectedItem
paramid <- mi
params <- yourItem w ^? _Just . itTweaks . tweakParams . ix paramid
params <- yourSelectedItem w ^? _Just . itTweaks . tweakParams . ix paramid
let x = (_tweakVal params + i) `mod` _tweakMax params
return $
w & cWorld . lWorld . creatures . ix 0 . crInv . ix curpos