New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inventory mouse shortcut improvements #13146
Conversation
This is great! This is a massive improvement and one of the best features in years. It's not perfect yet, a few things still feel a bit wrong:
|
The items should be picked up in order from left to right, top to bottom, until the stack is full. The code (here) goes through the list in order, moving items to the selected stack until there is no more room, at which point it stops.
The cursor only holds the remainder, so when the items split evenly the cursor won't be holding anything.
That doesn't sound right... Whatever items you're holding should stay in the cursor when you release the button, in fact nothing at all should change.
Looks like that bug has existed for a while, I checked in 5.4.0 and it happens there too. I'm not sure how to fix that. |
It should still show the item when there is still draggable items available, perhaos with a zero then. As for the 10 items, could this be configurable for games? that would be quite neat, especially with larger stack sizes where another divisor would make sense. |
A conflict should be solved: diff --cc src/client/client.h
index 44a0de719,489a76956..000000000
--- a/src/client/client.h
+++ b/src/client/client.h
@@@ -438,10 -437,8 +438,15 @@@ public
{
return m_env.getLocalPlayer()->formspec_prepend;
}
++<<<<<<< HEAD
+ inline MeshGrid getMeshGrid()
+ {
+ return m_mesh_grid;
+ }
++=======
+
+ bool m_inhibit_inventory_revert = false;
++>>>>>>> OgelGames/inventory_mouse_shortcuts
private:
void loadMods(); I left both How I finally merges:
BTW this PR's markdown description is so good that can be a starting template for all PR creators! |
Both, the only change I made to |
Anyone know what's holding this PR up? It's been 3 months now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code gets more chaotic the more features are added to it. If it is somehow possible to split individual actions into functions, it would be greatly appreciated.
I think that's everything fixed. Ready for review again.
Maybe in another PR, I don't want to do such a big refactor in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few minor code issues. The described item movements worked on my side. I could not find any issues.
Even limited stack movement (e.g. max 10 per movement) did work well. Tested with https://github.com/SmallJoker/minetest_lab/blob/master/init_76_inv_callbacks.lua (attempt to move a stack of 99 with any of the stack movement actions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested it and it works. The concept and its implementation look good, except some code style issues in a few lines. There is a problem with the crafting using Shift when there is no more room, but I think that has other use cases that I can not think of it for now.
My tests:
When using an inventory,
- Other button click is ignored when already a button is being clicked (being held).
When the targetting inventory is full (using Shift + click),
- No transfer is happening.
- No crafting is happening. ⚠
When holding/selecting a stack of items,
- Left-click + drag to distribute items evenly
- Middle-click + drag to put 10 items in each slot
- Right-click + drag to put 1 item in each slot
- Shift + left-click to move all identical stacks to another inventory
- Scroll down to pick 1 identical item from an inventory
- Scroll up to put 1 identical item to an inventory
Over an inventory,
- Shift + left-click + drag to transfer hovered stacks between two inventories
- Shift + middle-click + drag to transfer 10 items of each hovered stack between two inventories
- Shift + right-click + drag to transfer 1 item of each hovered stack between two inventories
- Left-click + drag to pick/get the hovered identical stack in the inventory
- Left-double-click to pick the hovered stack and its all stack identical to it
- Left-click + drag to pick then needing to click again to swap with a non-identical stack
Over the crafting output slot,
- Left-click to craft once
- Middle-click to craft 10 times
- Right-click to craft once
- Shift + left-click to craft once and transfer the result to the player's inventory
- Shift + middle-click to craft 10 times and transfer the results to the player's inventory
- Shift + right-click to craft once and transfer the result to the player's inventory
Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com>
The intended behavior is if the items can't be shifted, they are picked up by the mouse, as if you were not pressing shift. Is it doing something other than that? |
If that is the case, it is fine for me. My first thought was that the crafting with Shift will be cancelled if there are no more rooms in the targetted inventory. (Minecraft cancels the crafting with Shift if the player's inventory is full.) EDIT: Shift |
Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com>
I live this, thank you! :) Concerning that "stacks of 10": The usual stack size is 99. That is divisible by 3, 9 and 11 - but not by 10. After all being obsessed with 10 is just a strange habit of a single species of mammals from a narrow time window ... and here it doesn't fit well ;) |
Seeing as i've made the default stack size configurable if this is changed it should be configurable also, for my game 10 would be fine but 11 wouldn't be. |
Yeah, better to use a nice even number than something specific to a certain stack size. Also, middle click has been 10x for a long time, this PR just extended the functionality a bit ;) |
+1 for configurable amount per game. (many of the bugs and design 'errors' we fix have been there for a long time, mostly that doesn't stop us from changing them to the better) Yes OgelGames, out of the scope of your great PR :D |
Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com>
Re-implementation of #6544 / #7986, with additional features and fixes.
Fixes #5374, fixes #9456, fixes #12596.
Additions
Fixes and changes
See the short video below for a demonstration of most of the new shortcuts:
2023-01-15.17-29-37.mp4
Fixes:
Also link some closed issues:
A note about the shift-clicking from the craft preview: while right-click and middle-click function as they should (crafting 1x and 10x), left click is limited to 1x. Shift-left-click should craft the maximum possible, but with the slow crafting code (see pandorabox-io/pandorabox.io#543, there doesn't seem to be an issue open here yet) that can cause significant lag spikes when crafting large amounts of items, so it must limited until that code is optimized.
To do
This PR is Ready for Review.
How to test