Space only picks up filtered close items

This commit is contained in:
2024-11-25 15:47:32 +00:00
parent bbf95c91d8
commit 32f0d287e8
4 changed files with 15 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
All good (594 modules, at 15:18:36)
All good (594 modules, at 15:45:51)
+5 -1
View File
@@ -176,11 +176,15 @@ dropExcept cr invid w =
-- why not a cid (Int)?
dropItem :: Creature -> Int -> World -> World
dropItem cr invid =
rmInvItem (_crID cr) invid
maybeshiftseldown
. rmInvItem (_crID cr) invid
. copyItemToFloor (_crPos cr) itm -- . mayberemoveequip
. soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
where
itm = fromMaybe (error "dropItem cannot find item") $ cr ^? crInv . ix invid
maybeshiftseldown w = fromMaybe w $ do
3 <- w ^? hud . hudElement . diSelection . _Just . _1
return $ w & hud . hudElement . diSelection . _Just . _2 +~ 1
-- | Get your creature to drop the item under the cursor.
youDropItem :: World -> World
+3 -1
View File
@@ -24,7 +24,9 @@ copyItemToFloorID pos it w =
w'
& cWorld . lWorld . floorItems . unNIntMap %~ IM.insert flid theflit
& cWorld . lWorld . itemLocations %~ IM.insert (_unNInt $ _itID it) (OnFloor $ NInt flid)
& hud . closeItems %~ (NInt flid:)
& hud . closeItems %~ (NInt flid:)
-- & hud . hudElement . diSections . ix 3 . ssOffset .~ 0
-- ensures dropped item is at the top of the close item selection list
where
(p', w') = findWallFreeDropPoint (_dimRad $ _itDimension it) pos w
rot = fst . randomR (- pi, pi) $ _randGen w
+6 -4
View File
@@ -100,7 +100,7 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
is <- w ^? hud . hudElement . diSelectionExtra
return $ if concurrentIS is
then shiftInvItems k x ab bn is ss w
else collectInvItems is w
else collectInvItems k is w
_ -> w
where
ldp = invDisplayParams w
@@ -231,8 +231,9 @@ concurrentIS = go . IS.minView
(j, js) <- IS.minView is
return $ i + 1 == j && go (Just (j, js))
collectInvItems :: IS.IntSet -> World -> World
collectInvItems is w = fromMaybe w $ do
collectInvItems :: Int -> IS.IntSet -> World -> World
collectInvItems secid is w = fromMaybe w $ do
guard $ secid == 0
(j, js) <- IS.minView is
return $ h j js w
where
@@ -494,7 +495,8 @@ selCloseObj w = selobj <|> firstcitem <|> firstcbut
fmap Right $ w ^? cWorld . lWorld . buttons . ix k
_ -> Nothing
firstcitem = do
NInt k <- w ^? hud . closeItems . ix 0
k' <- (w ^? hud . hudElement . diSections . ix 3 . ssItems) >>= (fmap fst . IM.lookupMin)
NInt k <- w ^? hud . closeItems . ix k'
fmap Left $ w ^? cWorld . lWorld . floorItems . unNIntMap . ix k
firstcbut = do
k <- w ^? hud . closeButtons . ix 0