YSsssheeran Posted January 5, 2020 Share Posted January 5, 2020 When you pick up an item, it will appear at the far left of your inventory. When you consume an item, it will be consumed from the far left. This is not logical at all. It's like putting a plate from top to bottom, but taking a plate and drawing from below. If you can get the picked items to the far right of the inventory, everything is resolved. You can manually adjust the axe, spear and other items to the far left without worrying about being occupied by newly picked items. You no longer need to adjust the position of resources in your inventory, and there is no problom like 40+3 twigs, after you use 5 twigs, it become 35+3 twigs. Now: after use: \ If the order is changed: use: Anyone agree with that? Hope KLEI notice this. Link to comment https://forums.kleientertainment.com/forums/topic/114791-the-order-of-stack-and-consume-is-not-logical/ Share on other sites More sharing options...
Ultroman Posted January 10, 2020 Share Posted January 10, 2020 (edited) Usually, when coding inventory like this, I go from the back of the inventory (right side of the inventory bar in this case) until I find the first instance. If the first instance is full, I remember it, and keep searching, but now skipping any full stacks (saving a lot of other checks), and if I find a non-full stack I just choose that one, and if I don't find any, I default to the first found instance. That makes the most sense to me. Always the right-most stack, prioritizing non-full stacks. I put all the stuff I want to KEEP at the start of the inventory, so that part is neat, and then the rest of it can be a mess Going from the back also minimizes the number of elements that need to be moved around when removing an item from the middle of an underlying collection of items (at least in C#), but I don't think Lua works like that, and that's probably why Klei's inventory is made the way it is. It's an array of a fixed size, and it's VERY efficient. Edited January 10, 2020 by Ultroman Link to comment https://forums.kleientertainment.com/forums/topic/114791-the-order-of-stack-and-consume-is-not-logical/#findComment-1297952 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now