-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inventory_ui: only hide entries added recursively #52709
inventory_ui: only hide entries added recursively #52709
Conversation
Ok good I was looking at this and had come up with scanning for the parent and a terrible "disable it on a per-menu basis", but that turns out to be an equally bad tarpit. Your approach here seems workable. My other thought in this direction is adding a parents field to inventory entry and populating that... somehow. I might be missing something here, but the fact that entries can aggregate across several different items seems problematic, if the first item listed in an entry is hidden, the entire entry is hidden, that seems wrong and difficult to fix. Hopefully I'm just missing something about the preconditions enforced by class construction. |
AFAICT contained items don't aggregate across pockets, but let me know if you have a specific demo case. You're right that the fix wouldn't be easy (I'm specifically trying to avoid looping or building parent links in |
59b8082
to
4e17456
Compare
This comment has been minimized.
This comment has been minimized.
1135b2a
to
634a1c9
Compare
nested items are properly hidden now so there's no need to collapse the entire chain
634a1c9
to
67ebfda
Compare
I just noticed a new bug with (un)collapsing after filtering items. I have a preliminary fix here but I think I'll open a separate PR for it if this is accepted. |
Summary
SUMMARY: None
Purpose of change
Items in collapsed containers are hidden in inventory UIs even if their parent isn't in the list
Fixes: #52706
Items in in nested containers are still shown even if the top container is collapsed
Fixes: #52699
Fixes: #52722
Describe the solution
Track the topmost visible parent and gate visibility checks on its presence in the list.
Describe alternatives you've considered
Looping over all entries in
inventory_selector::prepare_paging()
: I get sick just thinking about thisTesting
For #52706:
Start with a backpack, a loaded flashlight, a 3L jar, a fruit jam, and a bandage. Insert the jam in the 3L jar, then the bandage and 3L jar in the backpack, then collapse the backpack.
E
at menua
ctivate menu, but not in theU
unload menu (unless you un-collapse the backpack first)Try again after dropping the backpack on the floor or stashing it in a vehicle, or in another container.
For #52699:
Start with a backpack and collapse it. Insert a fruit jam into a 3L jar, make sure the jar is not collapsed, then insert the jar into the backpack. The fruit jam should be hidden in the player inventory menu. Both the jam and the jar should show in the
Open item
menu AND you should be able to independently (un)collapse the jar.Additional context
This only works if items are added in a top-down order, which should be the case everywhere at the moment.