Jump to content

Recommended Posts

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:

Old-1.png.2d9add37e19bb5b7f41c0d835a21596a.png

after use:

Old-2.png.dc3daeb46d26be183cd40e1695e5984e.png\

 

If the order is changed:

New-1.png.cbbfdd9db759e5312f254d0c8712ab9b.png

use:

New-2.png.98fae3093b11ddb8e07a52f725ad9e33.png

Anyone agree with that? Hope KLEI notice this.
 

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 by Ultroman

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...