Improve item pickup by dragging
This commit is contained in:
@@ -123,7 +123,12 @@ tryPickupSelected k mpos w = do
|
||||
let itmstopickup = mapMaybe g $ IS.toList xs
|
||||
let slotsneeded = alaf Sum foldMap (_itInvSize . _flIt) $ itmstopickup
|
||||
guard $ nfreeslots >= slotsneeded
|
||||
return $ foldl' (flip $ pickUpItem 0) w itmstopickup
|
||||
return $ case mpos of
|
||||
Nothing -> foldl' (flip $ pickUpItem 0) w itmstopickup
|
||||
& hud . hudElement . diSelectionExtra .~ mempty
|
||||
Just (_,j) -> foldr (pickUpItemAt j 0) w itmstopickup
|
||||
& hud . hudElement . diSelection ?~ (0,j)
|
||||
& hud . hudElement . diSelectionExtra .~ IS.fromDistinctAscList [j..j+IS.size xs-1]
|
||||
where
|
||||
g i = do
|
||||
NInt j <- w ^? hud . closeItems . ix i
|
||||
@@ -134,10 +139,6 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of
|
||||
OverInvDrag k mpos _ _ ->
|
||||
input . mouseContext .~ MouseInGame $
|
||||
fromMaybe w $ tryDropSelected mpos w <|> tryPickupSelected k mpos w
|
||||
-- OverInvDrag i mpos -> fromMaybe (dropSelected w & input . mouseContext .~ MouseInGame) $ do
|
||||
-- j <- mpos
|
||||
-- guard $ fst j == i
|
||||
-- return $ w & input . mouseContext .~ OverInvSelect j
|
||||
OverInvDragSelect _ Nothing ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
& hud . hudElement . diSelectionExtra .~ mempty
|
||||
|
||||
Reference in New Issue
Block a user