Remove inventory selection on item drop/pickup

This commit is contained in:
2024-11-04 19:45:12 +00:00
parent 3f9b31a838
commit 489ff21e12
6 changed files with 17 additions and 20 deletions
+1 -1
View File
@@ -1 +1 @@
All good (594 modules, at 19:29:05)
All good (594 modules, at 19:44:39)
+8 -16
View File
@@ -243,32 +243,24 @@ updateSection sis mcsel availablelines ss =
si <- sis ^? ix csel
let xselsize = length $ _siPictures si
return $ case sum $ fmap (length . _siPictures) . fst . IM.split csel $ sis of
pos
| pos == 0 || length allstrings <= availablelines ->
0
pos
| pos - 1 < oldoffset ->
pos - 1
pos
| maxcsel == csel ->
pos - availablelines + xselsize
pos
| pos + 1 + xselsize - availablelines > oldoffset ->
pos | pos == 0 || length allstrings <= availablelines -> 0
pos | pos - 1 < oldoffset -> pos - 1
pos | maxcsel == csel -> pos - availablelines + xselsize
pos | pos + 1 + xselsize - availablelines > oldoffset ->
pos - availablelines + 1 + xselsize
_
| length allstrings - oldoffset < availablelines ->
_ | length allstrings - oldoffset < availablelines ->
length allstrings - availablelines
_ -> oldoffset
tweakfirst (x : xs)
| offset > 0 =
(color moreupcolor $ text (theindent ++ replicate 15 (toEnum 30))) :
color moreupcolor (text (theindent ++ replicate 15 (toEnum 30))) :
xs
| otherwise = (x : xs)
| otherwise = x : xs
tweakfirst [] = []
moreupcolor = fromMaybe white $ allstrings ^? ix offset . _1
shownitems
| length shownstrings > availablelines =
(map h $ take (availablelines - 1) shownstrings)
map h (take (availablelines - 1) shownstrings)
++ [color moredowncolor . text $ theindent ++ replicate 15 (toEnum 31)]
| otherwise = map h shownstrings
moredowncolor = fromMaybe white $ allstrings ^? ix (offset + availablelines - 1) . _1
+3 -1
View File
@@ -76,13 +76,15 @@ rmInvItem cid invid w =
& pointcid . crInvHotkeys %~ IM.delete invid
& pointcid . crInvHotkeys %~ IM.mapKeys g
& updateselection
& updateselectionextra
& pointcid %~ updateRootItemID
& worldEventFlags . at InventoryChange ?~ ()
where
-- & updateCreatureItemLocations cid
pointcid = cWorld . lWorld . creatures . ix cid
updateselectionextra | cid == 0 = hud . hudElement . diSelectionExtra .~ 0
| otherwise = id
updateselection
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
scrollAugInvSel (-1) . scrollAugInvSel 1 -- . updateInventorySectionItems
+3
View File
@@ -42,9 +42,12 @@ tryPutItemInInv cid flit w = case maybeInvSlot of
-- second for the root/selected item bools
& cWorld . lWorld %~ crUpdateItemLocations cid
& setInvPosFromSS
& updateselectionextra
& cWorld . lWorld %~ crUpdateItemLocations cid
)
where
updateselectionextra | cid == 0 = hud . hudElement . diSelectionExtra .~ 0
| otherwise = id
it = _flIt flit
maybeInvSlot = checkInvSlotsYou it w
-- not sure if the following is necessary
+1 -1
View File
@@ -74,7 +74,7 @@ drawInventory sss w cfig =
curs = invCursorParams w
iextra = fromMaybe mempty $ do
inv <- w ^? cWorld . lWorld . creatures . ix 0 . crInv
guard =<< fmap (not . isFilteringInv) (w ^? hud . hudElement . diSections)
guard . not . isFilteringInv =<< (w ^? hud . hudElement . diSections)
return . inventoryExtra sss cfig w $ invAdj inv
drawRootCursor :: World
+1 -1
View File
@@ -41,7 +41,7 @@ nextInSectionSS ::
IM.IntMap (SelectionSection a) ->
Maybe (Int, Int) ->
Maybe (Int, Int)
nextInSectionSS sss = ssScrollUsing ssLookupNextMax sss
nextInSectionSS = ssScrollUsing ssLookupNextMax
--setFirstPosSelectionSections :: SelectionSections a -> SelectionSections a
--setFirstPosSelectionSections sss = fromMaybe sss $ do