LootContainer is Lacking Some Important Things

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
Sluggy
Posts: 20
Joined: Tue Aug 23, 2022 9:28 pm

LootContainer is Lacking Some Important Things

Post by Sluggy »

I'm working on a mod that requires the ability to monitor a loot container's contents and sync this with another source of data. However, I am finding no end of issues related to some lacking public interfaces. They are as follows:

1) There is no efficient way to get a list of all items in a container. Sure, I can search for each ItemGroup but this seems excessive to have to traverse through the whole collection for each type of item when all I really want is ALL items. not the biggest issue ever but certainly not great.

2) Some events being triggered when the container's inventory is updated would be nice. Even if it passes no data as parameters it would at least give moders a better option than to simply iterate through every item multiple times every frame and then compare to every item in another list to see if they match.

3) Some events for when the container opens and closes is badly needed! This is the one that hurts the most because I desperately need this and it even looks like this feature was started but never fully implemented. There are two empty functions in there that are even called by the inventory UI but they do nothing and there is no way for the outside world to know if that container is currently open or closed.

I think adding all three of these features would be highly beneficial to the moding community, would be trivial to implement or fix, and would have zero risk of causing regressions or stability issues for the game in its current state.

User avatar
Magicono43
Posts: 1139
Joined: Tue Nov 06, 2018 7:06 am

Re: LootContainer is Lacking Some Important Things

Post by Magicono43 »

This might be useful to you, it's from my most recently released mod: https://github.com/magicono43/DFU-Mod_L ... in.cs#L838

So basically it's a somewhat hacky way I was able to detect when a specific loot-pile/inventory loot interface was opened and then closed. Depending on what you are trying to do, this may help somewhat atleast.

Post Reply