Skip to content

Conversation

@GabrielSibley
Copy link

Summary

Interface "Rework inventory capacity summary"

Purpose of change

Improve the inventory capacity summary displayed in the top right of many inventory screens. I want to increase readability for new-comers, expose more information at a glance for experienced players, and remove information that seems unimportant or inaccurate.

In pursuing this I tried to make some volume-related functions clearer in purpose.

Additionally, this fixes at least a few minor bugs, of which I've confirmed:
Total Capacity displayed when 'e'xamining an item from the inventory screen is affected by the player disabling pockets, when it most likely should describe the physical state of the item.
Original Bug Repro: Disable some of an items pockets, then 'e'xamine the item from the inventory screen. "Total Capacity" is now no longer the sum of all pocket's capacities. Disabling all pockets removes the "total capacity" section entirely.

When using the insert menu, if the target item has holster pockets with contents, the weight of those contents is double-counted.
Original Bug Repro: hold or wear an item with holster and non-holster pockets, and put another item into one of the holsters. Open the 'insert' menu for the item. Note that reported weight capacity is (2X) / Y instead of X / Y.

When using the insert menu, selecting items which count by charges and have more than one charge report an incorrect adjustment to the volume carried post-insert.
Original Bug Repro: Spawn scrap metal (50). Using the insert menu, select the entire stack of scrap metal as the item to be inserted. Note that the volume display now reads 62.50 L / X, rather than the actual volume of the stack, 1.25 L.

When using the insert menu, the target item's volume capacity is reported with disabled pockets deducted. However, the disabled state of pockets is ignored when manually inserting into an item with this menu, so this is not accurate or useful.
Original Bug Repro: Disable all the pockets of an item and then open the insert menu for the item. Volume is reported as 0/0 L.

I strongly suspect but have not confirmed that this fixes an issue where disabling an item's pockets would make it more likely to burst when thrown.

Describe the solution

Interface changes

This replaces the right-hand text block fed in to the header drawn for most inventory_selectors. Inventory selectors which had custom draw code (e.g. scanning books) are passed through an adapter and are displayed the same as before.
The header stats block can now consist of more than 3 lines. Each line can contain "tab stops". Adjacent lines which contain the same number of tab stops will be padded to align those tab stops.

In the main inventory screen, pickup screen, and drop screen, the character's volume capacity is now summarized as "Bulk Volume", which is basically the volume of packing peanuts they can pick up -- it includes spaces inside rigid pockets, and ignores 'holster' pockets and pockets with most kinds of restrictions on what can be put in them . If you are going around looting lots of regular-sized items, this is a roughly accurate measurement of your overall capacity.

In the insert and open screens, the capacity shown accounts for only pockets on that item. The spaces listed on this screen are only those on the item. If the item is nested and has flexible pockets, the capacities are diminished if the outer pocket cannot expand sufficiently.

In screens where you select multiple items, a sum of the weight and volume of the selected items is displayed instead of trying to emulate, and show, the post-action state.

Additionally, in these screens, the largest and longest free space present is displayed, along with the size of the largest / longest pocket. This is followed by a summary of up to three other large free spaces. This replaces the "Free Volume" and "Longest Length" parts of the old status display. Pockets which are not restricted (e.g. to a sheathe or clip-on item) are prioritized for these displays.

Minor gameplay change

The hoarder morale penalty no longer applies the "small pocket allowance" to the overall volume carried, rather it is per-pocket, i.e. you do not get extra penalty reduction for having a small pocket that is more than 75% full, you just stop getting penalized for that pocket once it is 75% full.

About code changes

I've tried to improve or streamline several parts of the code related to querying for pockets and volumes. Notably, this changes almost nothing about the logic for actually picking up items.

  • Renamed several functions to make it more clear whether they are/aren't recursive searches.
  • Merged the functionality of item_pocket::max_contains_volume() into volume_capacity(), and removed the former.
  • Removed internal filtering logic in several places in favor of having it passed in by a caller as a predicate, to make results of different functions more likely to be directly comparable.
    • Added a couple of basic item_pocket predicates for use with these.
  • Removed several functions related to the state of the character's "holsters", as they were only used for displaying the old status, and they seemed to be concerned with an outdated concept of "holster".
  • Simplified some call chains by removing some functionality (_with_tweaks() and co) related to emulating the character's inventory state after a drop action, which was only used in the drop menu.

Describe alternatives you've considered

Trying to make the inventory stats display better without changing how it's formatted at a base level or how information is gathered for it.

Testing

  • Checked the new status display in the inventory menu and when picking up or dropping items, inserting items, and having an item 'open', with various inventory configurations including restricted pockets, holster-pockets, disabled pockets, pockets with black and whitelists, all rigid/flexible-in-rigid/flexible combinations, having no pockets, and having only holsters which are full.
  • Checked the "advanced inventory display" is displaying adequately.
  • Checked the hoarder morale penalty is correct (albeit not exactly the same as before in all cases).
  • Checked the "scan books" status header is unchanged.
  • Checked that being over the maximum weight displays the weight in red.
  • Checked that magazines still fill to their listed number of rounds.
  • Checked that attached / MOLLE pouches display correctly.
  • Ran unit test suite as recommended.

Additional context

New interface samples:
Wearing a hiking bag. Note the alignment of values and the display of the minimum length restriction for several of the pockets.
empty-hiking-bag
Wearing a leather belt with a holster clipped to it. Note that bulk volume is 0 because holster-pockets do not contribute to that, as they only hold one item. Note that pockets without flag restrictions (the holster) are prioritized over pockets with restrictions (belt loops), as they're more generally applicable. Pockets with restrictions are flagged with a *.
belt-with-holster
Carrying a bag of jars and bottles. Note that bulk volume is much less than the volume of the items, as they are almost entirely hollow, rigid pockets, so you still have plenty of space. Note also the selected items summary.
bag-o-jars
Inserting into a pair of jeans which are contained in a 3L jar. Note that the capacity of the pockets is constrained by the volume left in the jar. Note that the summary shows "total volume" and "content weight" instead of "bulk volume" and "total weight".
jeans-in-jar

Author note:
I'm aware this is kind of a major change for a first contribution but I hope it's well received and am open to feedback.

Add pocket_constraint and some supporting utility
Fix various compiler errors due to missing args
Clean up hoarder morale
Remove previously commented code
Remove volume-related _with_tweaks
Adjust displayed pockets when only restricted pockets free
Fix capacity displayed in insert & container menu when target has flexible top-level pockets
Improve coloring again
Change weight label for containers, insert menu
@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Info / User Interface Game - player communication, menus, etc. Vehicles Vehicles, parts, mechanics & interactions Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Player Faction Base / Camp All about the player faction base/camp/site Items: Containers Things that hold other things Items: Armor / Clothing Armor and clothing new contributor astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Nov 27, 2025
@GuardianDll
Copy link
Member

For future PRs, please consider splitting it into multiple smaller PRs, it makes it many times easier to review than when all renaming, refactors and bugfixes are crammed into a single, dense PR

I read the PR, and didn't spot any obvious issues other than what was reported by CI, but i am notably not a good code reader

@Fris0uman
Copy link
Contributor

This seem to make the interface very busy and hard to parse, you should probably cut this PR into smaller parts. First PRs for the bug fixes, and then another one that contains just the change in UI so that it can be discussed separatly.

@GabrielSibley
Copy link
Author

Yes, it's larger than the guidelines recommend, sorry about that, it's like that because the desire to change the UI ended up driving the lower-level changes and it was like pulling a loose thread in a sweater, I thought I was nearly done the whole time. As it is, I'd have to turn the PR inside-out to break it up.
So, questions:

  • Is this really unreviewably large? If so, is it better for me to close this PR and make a new one with a smaller change-set, or rework this one into part 1?
  • Technical elements aside, is the overall premise of the UI change acceptable? I don't have any experience with how much input I should expect on that or how fast.

@github-actions
Copy link
Contributor

Hi @GabrielSibley, welcome to CleverRaven! We see that this is your first time commenting here. Check out how development works and be sure to follow the code of conduct! We hope to see you around!

@Zireael07
Copy link
Contributor

I like the direction this is going in, but I agree having this on screen at all time makes the screen very busy

Maybe move this to a separate screen, something like a help menu, press I for more info?

@GabrielSibley
Copy link
Author

GabrielSibley commented Dec 1, 2025

I've made these changes to try to make the display cleaner:
If the "max space" detail is the same as the "free space", the max space is not shown.
hide-one-max
If both max spaces are not shown, the entire column is omitted. This can also be forced, so this column is never shown, with a new interface option.
hide-both-max
If the "largest space" and "longest space" refer to the same pockets, it is collapsed to just the "largest space" line.
hide-same-large-long
The number of entries in the "other spaces" list can be limited with a new interface option. It can be reduced to zero, in which case the line is never shown, and also the "number of spaces of this size" display is hidden for large / long free spaces.
hide-others

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

Hi @GabrielSibley, welcome to CleverRaven! We see that this is your first time commenting here. Check out how development works and be sure to follow the code of conduct! We hope to see you around!

@Maleclypse
Copy link
Member

I think this is really cool. I do wonder if the "Other" pockets should ever be displayed on the first menu. I think Zireal is correct that that should be a note with a button that pushes out to a different menu showing all the pockets. That would possibly be a good spot to break up some of this PR into multiple? I also would suggest if doing that separate menu maybe considering only showing the largest pocket and longest pocket detail So longest pocket: 65 cm Largest pocket: 4 L without showing the total space of the longest pocket and length available to the largest pocket. Their full details could then be visible on the full pocket menu. Both of these actions would improve readability on the first page but provide that appendix level detail on a deeper more focused menu.

The reason for these suggestions in my view is that ideally we want the pockets system to "just work" that ideally the item goes in the correct pocket most of the time and the Player doesn't need to think about it. Hopefully that makes sense.

@GabrielSibley
Copy link
Author

I do wonder if the "Other" pockets should ever be displayed on the first menu.

I'm OK with making the default option being to hide it. To the degree UI like the sidebar is customizable, it seemed like the design pattern was "show everything to start and let users hide stuff if they want".

Most of my motivation for doing this change was being repeatedly frustrated by the old header not showing the volume of my longest pocket (only the length) and the length of my largest pocket (only the volume). These were shown as "Longest Length" and "Free Volume" respectively. I would try to pick up a stick or a gun and be unable to, because my large pockets are too short and my long pockets aren't big enough, or only take clip-on items, or have other things in them, and have to "debug" why I can't pick up the item. The pocket system does just work for collections of smaller items but starts to require more intervention (and more information) when you have Particularly Large or Particularly Long items.

There's already a "show information about all your pockets" menu accessible from the inventory screen (i->i), although it doesn't immediately display all their lengths. Some of this information should probably also be on that screen, but that's definitely a different PR and there's a separate outstanding issue focused on improving that menu

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Hi @GabrielSibley, welcome to CleverRaven! We see that this is your first time commenting here. Check out how development works and be sure to follow the code of conduct! We hope to see you around!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

astyled astyled PR, label is assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Info / User Interface Game - player communication, menus, etc. Items: Armor / Clothing Armor and clothing Items: Containers Things that hold other things json-styled JSON lint passed, label assigned by github actions new contributor NPC / Factions NPCs, AI, Speech, Factions, Ownership Player Faction Base / Camp All about the player faction base/camp/site Vehicles Vehicles, parts, mechanics & interactions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants