FixedSizeItemCollection/empty items not working

rokgin

New member
Am I'm missing something, but it seems that the FixedSizeItemCollection just doesn't work, as it stands, all preconfigured items disappear at runtime and even if I fix that part, 0 quantity items or null items cause errors on many layers of the code, no matter what I try, I cannot get empty items to persist in the collection, and by digging through code it seems it would be easier to just place a dummy placeholder item, than try to get it to work on 0 quantity or null item. Could someone just confirm that that is the case, so I wouldn't be chasing ghosts.

P.S. The purpose for this is a grid style inventory with empty slots being a possibility, if there is something else obvious that I may be missing.
 
No, you are right empty items is not allowed in FixedSizeItemCollection or any other of the built in item collections.
For that purpose I would look into coding your own custom item collection.

If you need help doing so, let me know and I can guide you.
The main thing to be careful about is how you use the ItemStacks within the item collection. And understanding the difference between ItemStacks and ItemInfo is very important too.

ItemStack is a class, they exist only in the item collection and are pooled using the GenericObjectPool class.
ItemInfo is a struct which has an amount, an item, and optionally an itemStack and item collection.

We use ItemInfo to move items around, and ItemStack to store them in an item collection.
 
Oh, that's a shame, hopefully for your next update you can consider implementing it, as for now I have started writing my own collection, but there are so many layers on which systems fails with null items and this not being my code I don't know how many things I will have to change, so for the time being to save time and nerves I have just created an item called "EMPTY-SLOT" and I just check for it in my code.
 
That sounds like a good place holder until we get a fix ready.
Currently the UI is quite limited, which is the reason that we are completely rewriting it for v1.1.
So hopefully you'll be able to do what you want then.
If after v1.1 you are still struggling to implement it then I will look into it and we can come up with a solution that suits you together.

V1.1 should release before the end of the year, it's going to be a huge update.
 
That's good to hear that you are actively working on it, I am using my own UI, but the database and implementations are so convenient that it's worth using Opsive solution even without using your UI system.

Also I have spent a whole day implementing the Inventory system and using placeholder turned out to be very easy and convenient, also unexpectedly it turned out to be a solution to another problem I encountered. I wanted to be able to have multiple equipment slots with the same category, for example two rings and consistently load inventory to correct slot even if one of the slots is empty, so the item wouldn't jump to the first available. Using placeholder let me do that and when I equip a new item from inventory, it swaps the item with the placeholder keeping the inventory properly sized.

I will definitely keep an eye on the updates though, keep up the good work!

P.S. I bought it using your own website and I just noticed that it does not say which version is available for download, so I'm just hoping you will send emails when an update is available, or perhaps write which version is being downloaded.
 
That's good!
We'll be improving equipping in V1.2, which might be in while... so I'm glad you found a work around.

We send emails and post things in discord and the forum whenever there is an update. There should be a Announcement category under Ultimate Inventory System in the forum where you can check what the latest version is at any time.
 
Top