Project Zomboid

Project Zomboid

SpiffUI - Inventory
This topic has been locked
dhert  [developer] 10 Aug, 2022 @ 11:12am
SpiffUI - Inventory v5 -- Release Notes and Discussion
Hello everyone!

Bugs fixed in this release
  • Updated SpiffUI-Inventory rules to no longer override the base "update()" function for the inventory panels. This allows it to be more compatible with other mods with no functionality changes here.
  • Fixed an issue where the "autohide" variable was not being cleared

New Features!
The main goal of this release was to begin adding some new features to the Inventory to help manage your items further.

One of my favorite mods so far is the General Container mod by "trom6one". Unfortunately, this mod has not been updated in some time and also contains some bugs/issues in the newer version of the game. I have taken this idea of merging containers and given it a "new spin" here.

Grouped Player Inventory
A new button is visible in the Player's Inventory Panel which gives access to all items in their inventory, excluding equipped and hotbar items. Items can be transferred from, but not to this inventory.

Grouped Player Loot
A new button is visible in the Player's Loot Panel which gives access to all items in the loot containers. By default, this will exclude items on Zombie Corpses. Items can be transferred from, but not to this inventory.
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=2847279513

Merged Zombie Corpses
Added to the bottom of the Loot Panel is the "Zombie Corpse" button that will contain ALL items from ALL corpses around you in a single button. Items CAN be transferred to this inventory if there is an available body with space to put the item in.
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=2847278789

All of these buttons will appear at the bottom of their respective panels, and can be disabled in the Mod Options.

Ok, but why add this here?
This initially was another mod as this feature does not require anything specific from this mod to work. However, I wanted this feature to be added here to make the inventory changes I make in just 1 mod.

WARNING ABOUT THIS FEATURE:
There are other mods that do this too, and including those mods may cause duplicates to be visible (but not really duplicated) as those containers are added to the container list as well. Its a two-way street here, in that those mods that read the containers provided here would also have the duplicated items. The game seems to handle this properly when you go to use the items, so this is only cosmetic (i.e., it just looks like you have more items). Still, I recommend either removing or disabling other mods that add this feature, or disabling these buttons here in lieu of the others.

Any bugs, features, or feedback let me know!
Last edited by dhert; 10 Aug, 2022 @ 11:26am
< >
Showing 1-7 of 7 comments
I like the way you implemented the containers merge, I'm wondering did you manage to find a workaround about items stopping cooking or freezing when they appear in the merged container?

I have this problem happening to my shared container.
dhert  [developer] 18 Aug, 2022 @ 9:58pm 
Hey @Mx! Thanks for the kind words.

I have found that placing an item in a freezer or stove that is on still applies the temperature no problem. I cooked a steak in my "All Containers" without issue, and then froze it afterwards.

I haven't reviewed how you are merging the inventories, but I am essentially just making a container with:
container = ItemContainer.new(name, nil, nil, 1, 1)
I then iterate over the items in each container button in the "OnRefreshInventoryWindowContainers" event, and add to my custom container with:
if not container:contains(item) then container:AddItemBlind(item) end
That container is then made into a new button. Not the most efficient to iterate over every item, but it works well enough to not be an issue for most usage. Feel free to use anything from this mod in yours if needed.
Last edited by dhert; 18 Aug, 2022 @ 9:59pm
Thank you for the reply, I just noticed that you use `AddItemBlind`, while I use instead `addAll`, I wonder if this happens because I use the addAll

I do also create the Container like this

ItemContainer.new("local", nil, nil, 10, 10)

-- Add All backpacks content except last which is proxInv for i = 1, (#invSelf.backpacks - 1) do local buttonToPatch = invSelf.backpacks
local invToAdd = invSelf.backpacks.inventory
if ProxInv.canBeAdded(invToAdd, playerObj) then
local items = invToAdd:getItems()
proxInvButton.inventory:getItems():addAll(items)
table.insert(ProxInv.containerCache, invToAdd)
end
-- Since I'm looping here I might aswell also take care of patching all the buttons Y position
buttonToPatch:setY(buttonToPatch:getY() + invSelf.buttonSize)
end[/code]
Last edited by Mxswat The Helldriver; 19 Aug, 2022 @ 3:47am
dhert  [developer] 19 Aug, 2022 @ 10:06am 
I do not believe it is due to the way you are adding items to your container by using the Array function instead of the Container functions itself. I updated mine to use the same method as a test, and still no problems. (P.S. You mind if I keep this? It is better. :D)
Instead, I see you're using this in the "ProxInv.OnButtonsAdded" function:
localContainer:removeItemsFromProcessItems()
I don't think its necessary to do this and this seems to be what is stopping the items from cooking and whatnot on refresh of the containers. I commented this out (and set your various "bannedTypes" to false so I could see things) and I could no longer trigger this bug.
You can keep it :P

And thank you! I think you are right, I'll test it soon!
It works! Thank you dude!
dhert  [developer] 19 Aug, 2022 @ 11:45am 
Awesome! Glad I could help!
< >
Showing 1-7 of 7 comments
Per page: 1530 50