about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2022-05-01T19·58-0400
committerclbot <clbot@tvl.fyi>2022-05-14T15·59+0000
commitb5105034791a2af1bd9370aeb0aa741300e0641b (patch)
tree3500f873653d7a6d1c9e56b4f4b2f5987850549c /users
parent1ce67611b54871c7541396399da35e0b8d69f2f5 (diff)
fix(grfn/xanthous): Don't remove items on cancel r/4070
Only remove items selected to wield from the inventory once they're
actually going to be wielded, to avoid cancelling the hand selection
from causing the item to disappear

Change-Id: I3c4010058ae18b205a68b035d5e189a10ffbd12c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5510
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Autosubmit: grfn <grfn@gws.fyi>
Diffstat (limited to 'users')
-rw-r--r--users/grfn/xanthous/src/Xanthous/App.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/users/grfn/xanthous/src/Xanthous/App.hs b/users/grfn/xanthous/src/Xanthous/App.hs
index 32f03e8392ef..4ae549d15983 100644
--- a/users/grfn/xanthous/src/Xanthous/App.hs
+++ b/users/grfn/xanthous/src/Xanthous/App.hs
@@ -297,8 +297,10 @@ handleCommand DescribeInventory = do
 
 handleCommand Wield = do
   hs <- use $ character . inventory . wielded
-  selectItem $ \(MenuResult (item :: WieldedItem)) -> do
+  selectItem $ \(MenuResult (invPos, (item :: WieldedItem))) -> do
     selectHand hs $ \(MenuResult hand) -> do
+      character . inventory
+        %= removeItemFromPosition invPos (asWieldedItem # item)
       prevItems <- character . inventory . wielded %%= wieldInHand hand item
       character . inventory . backpack
         <>= fromList (map (view wieldedItem) prevItems)
@@ -308,7 +310,7 @@ handleCommand Wield = do
   continue
   where
     selectItem =
-      takeItemFromInventory_ ["wield", "menu"] Cancellable asWieldedItem
+      selectItemFromInventory_ ["wield", "menu"] Cancellable asWieldedItem
         (say_ ["wield", "nothing"])
     selectHand hs = menu_ ["wield", "hand"] Cancellable $ handsMenu hs
     itemsInHand (Hands i _) LeftHand       = toList i