CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.33k stars 4.14k forks source link

Item in container not visible from [i]nventory, cannot be called by its designated letter #74772

Open HenicTheSodgehog opened 3 months ago

HenicTheSodgehog commented 3 months ago

Describe the bug

Items put into inventory sometimes end up in improbable containers (like tiger claws in a cigarette pack), then when I want to [w]ield them from the inventory by their assigned letter, I can't. Because it's in some unexpanded container, which could be anything from a plastic bottle to aforementioned cigarette pack.

I'm not sure if this is a known bug (couldn't find anything immediately available) or not.

Attach save file

n/a

Steps to reproduce

  1. Have an item.
  2. Assign a letter to it.
  3. Put it into inventory with different containers
  4. There is a chance it will end up in some weird container that isn't expanded (like a plastic bottle or a cigarette pack).
  5. You can't select it by its letter now. You think it's gone.

Expected behavior

Item should not end up in some weird containers.

Item should be reachable by its assigned letter regardless of where it is in your inventory.

Item with assigned letters should always be visible in the inventory, I shouldn't be rummaging through containers for it each time I put it in the inventory.

Screenshots

claws in a cigarette pack

Versions and configuration

Experimental build 2024-06-24-1652 More re less vanilla DDA, no total overhaul mods.

Additional context

No response

natsirt721 commented 3 months ago

Item with assigned letters should always be visible in the inventory

I disagree with this, but only from the inventory screen. They should always be usable from an action menu (wield, eat, etc).

Item should not end up in some weird containers.

This I think is a QoL thing, otherwise you'd have to go in and turn on auto-insert for all your clothing and backpack. Maybe a happy medium would be to have all containers default off, but clothing default on?

In the meantime you can set pocket priority for this item for your backpack or pants so that it ends up somewhere predictable.

HenicTheSodgehog commented 3 months ago

They should always be usable from an action menu (wield, eat, etc).

That sounds reasonable. I'm all for this.

andrei8l commented 3 months ago

/duplicate of #74096, though the confirmation message there is not quite right.

Item should be reachable by its assigned letter regardless of where it is in your inventory.

People ask for contradictory behavior for hidden items fairly frequently. There is no solution that will satisfy everyone. If you want that particular behavior, you can try this:

diff --git a/src/inventory_ui.cpp b/src/inventory_ui.cpp
index bf6bb34472..b91f6d590c 100644
--- a/src/inventory_ui.cpp
+++ b/src/inventory_ui.cpp
@@ -527,6 +527,11 @@ bool inventory_entry::is_hidden( std::optional<bool> const &hide_entries_overrid
     if( hide_entries_override && topmost_parent && topmost_parent->is_container() ) {
         return *hide_entries_override;
     }
+
+    if( get_invlet() != '\0' ) {
+        return false;
+    }
+
     while( item.has_parent() && item != topmost_parent ) {
         if( item.parent_pocket()->settings.is_collapsed() ) {
             return true;

and it's virtually guaranteed to piss someone off in another inventory UI, or even in another situation in the same UI.

The current behavior is simple and consistent everywhere, though perhaps not the most obvious: if the container is collapsed and shows up n the UI, then the contents are hidden. In this case, the cigarette pack is collapsed and can be wielded so it shows up in the wield UI so its contents are hidden in that menu. If you filter for that item, it'll always show up regardless of pocket status.

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.