Nested containers and fast pickup via volume assignment #34678
Labels
<Enhancement / Feature>
New features, or enhancements on existing
Game: Mechanics Change
Code that changes how major features work
(S3 - Duplicate)
Bug that is duplicate of another one
Problem description
Containers such as duffel bags increase the available volume of your character, but also add encumbrance. As such, it would be useful to be able to quickly drop them and pick them back up before and after combat. However, treating bags as containers that can be opened and have items removed and inserted, such as the Kevlar vest, would make inventory management too awkward.
Proposed solution
Items gain a new internal field indicating the parent container that contains them. When the parent container is moved, all nested items are also moved with it, for free, without losing their parent. (Their encumbrance is accounted for by the parent container's encumbrance.) When picking up an item that has child items in the same inventory, the child items are likewise moved for free.
Additional notes
I'm calling this "volume assignment" because items are assigned to the item which provides the volume that contains them.
It would be logically cleaner to represent contained items as a list of children in the surrounding container. However, this would require all code that handles inventories to be changed. Using a parent field allows for a gradual introduction.
The ability to assign items to containers would be handy, but will not be necessary for the usecase of divesting yourself of encumbrance before combat.
There is no need to represent this in the inventory UI, though it could be done by a gray right-aligned text in the inventory stating the container. Indentation is less useful in the player inventory, because the containing inventories will usually be [W]orn.
When picking up items, the default sort mode should show contained items indented under their parent container, similar to Dwarf Fortress.
Proposed implementation tasks
Each of those tasks could be handled in a separate PR.
Don't forget to assert that parent items are in the same inventory as the child item!
The text was updated successfully, but these errors were encountered: