This commit is contained in:
2024-11-25 16:30:38 +00:00
parent 32f0d287e8
commit 83bcf3c0f7
4 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -1 +1 @@
All good (594 modules, at 15:45:51) All good (594 modules, at 16:25:03)
+1 -1
View File
@@ -117,7 +117,7 @@ updateCloseObjects w =
where where
g oldbts = intersect oldbts cbts `union` cbts g oldbts = intersect oldbts cbts `union` cbts
f olditems = intersect olditems citems `union` citems f olditems = intersect olditems citems `union` citems
cbts = fmap _btID $ filter (isclose . _btPos) activeButtons cbts = _btID <$> filter (isclose . _btPos) activeButtons
citems = citems =
fmap _flItID fmap _flItID
. filter (isclose . _flItPos) . filter (isclose . _flItPos)
+3 -4
View File
@@ -99,12 +99,11 @@ getRootItemBounds i inv = do
y <- locLeftmost root ^? locLDT . ldtValue . cItem . itLocation . ilInvID y <- locLeftmost root ^? locLDT . ldtValue . cItem . itLocation . ilInvID
return (x, y) return (x, y)
-- this should display while dragging a single inv item
drawMouseOver :: Configuration -> World -> Picture drawMouseOver :: Configuration -> World -> Picture
drawMouseOver cfig w = drawMouseOver cfig w =
concat concat
( invsel <|> combinvsel ( invsel <|> combinvsel
<|> drawDragSelect cfig w <|> drawDragSelecting cfig w
) )
<> concat (drawDragSelected cfig w) <> concat (drawDragSelected cfig w)
where where
@@ -141,8 +140,8 @@ drawDragSelected cfig w = do
. IS.foldr f mempty . IS.foldr f mempty
$ ys $ ys
drawDragSelect :: Configuration -> World -> Maybe Picture drawDragSelecting :: Configuration -> World -> Maybe Picture
drawDragSelect cfig w = do drawDragSelecting cfig w = do
OverInvDragSelect (i, j) mselend <- w ^? input . mouseContext OverInvDragSelect (i, j) mselend <- w ^? input . mouseContext
(a, b) <- mselend (a, b) <- mselend
guard $ i == a guard $ i == a
+7 -6
View File
@@ -121,14 +121,15 @@ tryPickupSelected k mpos w = do
let nfreeslots = crNumFreeSlots cr let nfreeslots = crNumFreeSlots cr
xs <- w ^? hud . hudElement . diSelectionExtra xs <- w ^? hud . hudElement . diSelectionExtra
let itmstopickup = mapMaybe g $ IS.toList xs let itmstopickup = mapMaybe g $ IS.toList xs
let slotsneeded = alaf Sum foldMap (_itInvSize . _flIt) $ itmstopickup let slotsneeded = alaf Sum foldMap (_itInvSize . _flIt) itmstopickup
guard $ nfreeslots >= slotsneeded guard $ nfreeslots >= slotsneeded
return $ case mpos of return $ case mpos of
Nothing -> foldl' (flip $ pickUpItem 0) w itmstopickup Nothing -> foldl' (flip $ pickUpItem 0) w itmstopickup
& hud . hudElement . diSelectionExtra .~ mempty & hud . hudElement . diSelectionExtra .~ mempty
Just (_,j) -> foldr (pickUpItemAt j 0) w itmstopickup Just (_,j) -> foldr (pickUpItemAt j 0) w itmstopickup
& hud . hudElement . diSelection ?~ (0,j) & hud . hudElement . diSelection ?~ (0,j)
& hud . hudElement . diSelectionExtra .~ IS.fromDistinctAscList [j..j+IS.size xs-1] & hud . hudElement . diSelectionExtra
.~ IS.fromDistinctAscList [j..j+IS.size xs-1]
where where
g i = do g i = do
NInt j <- w ^? hud . closeItems . ix i NInt j <- w ^? hud . closeItems . ix i
@@ -440,11 +441,11 @@ updateBackspaceRegex w = case di ^? subInventory of
updateEnterRegex :: World -> World updateEnterRegex :: World -> World
updateEnterRegex w = case w ^? hud . hudElement . subInventory of updateEnterRegex w = case w ^? hud . hudElement . subInventory of
Just NoSubInventory{} Just NoSubInventory{}
| secfocus (-1) 0 -> | secfocus [-1,0,1] ->
w & hud . hudElement . diSelection ?~ (-1, 0) w & hud . hudElement . diSelection ?~ (-1, 0)
& hud . hudElement . diInvFilter %~ enterregex & hud . hudElement . diInvFilter %~ enterregex
Just NoSubInventory{} Just NoSubInventory{}
| secfocus 2 3 -> | secfocus [2,3] ->
w & hud . hudElement . diSelection ?~ (2, 0) w & hud . hudElement . diSelection ?~ (2, 0)
& hud . hudElement . diCloseFilter %~ enterregex & hud . hudElement . diCloseFilter %~ enterregex
Just CombineInventory{} -> Just CombineInventory{} ->
@@ -453,9 +454,9 @@ updateEnterRegex w = case w ^? hud . hudElement . subInventory of
_ -> w _ -> w
where where
di = w ^. hud . hudElement di = w ^. hud . hudElement
secfocus a b = fromMaybe False $ do secfocus xs = fromMaybe False $ do
i <- di ^? diSelection . _Just . _1 i <- di ^? diSelection . _Just . _1
return $ i == a || i == b return $ i `elem` xs
enterregex = (<|> Just "") enterregex = (<|> Just "")
pauseGame :: Universe -> Universe pauseGame :: Universe -> Universe