Cataclysm-dda: Encumbrance Doesn't Upon Dropping Items

Created on 17 Aug 2020  路  4Comments  路  Source: CleverRaven/Cataclysm-DDA

Describe the bug

Encumbrance does not update when you drop items from a container. It only updates upon unloading or taking off/re-wearing the container.

Steps To Reproduce

  1. Put items into a worn container such as a backpack
  2. Drop the items, don't unload
  3. Notice the encumbrance did not update upon dropping the items, keeping the encumbrance it had at whatever it was when it was filled up.

Expected behavior

Encumbrance should update as containers are emptied via dropping items from them, as otherwise you'll have an encumbrance 26 backpack with nothing in it.

Screenshots

Versions and configuration

  • OS: Linux

    • OS Version: LSB Version: 1.4; Distributor ID: Arch; Description: Arch Linux; Release: rolling; Codename: n/a;

  • Game Version: 0.E-5060-gd0982ce735 [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Aftershock [aftershock],
    Blaze Industries [blazeindustries],
    C.R.I.T Expansion Mod [crt_expansion],
    Stats Through Kills [stats_through_kills],
    Fuji's Military Profession Pack [fuji_mpp]
    ]

Additional context

(S2 - Confirmed) <Bug> Containers

Most helpful comment

Confirmed as well in 0.E-5236-ge7434cff45

It seems that when a backpack (or other container) has items inserted, its minimum encumbrance is permanently changed. Here I have five leather backpacks that were used to store various amounts of rags, but are now all empty and sitting on the floor. The Wear menu shows they have different "Avg Encumbrance":

image

Edit Starting with a recent overhaul to the encumbrance system, I found that as of commit 8e60922 encumbrance works correctly. I started a git bisect to narrow down where things went wrong since then, and will pursue a fix and new test case(s) if I can locate it.

Bug was introduced in b8080baa6 from #40745

All 4 comments

Confirming. At least it was like this in experimentals a week ago.

Confirmed as well in 0.E-5236-ge7434cff45

It seems that when a backpack (or other container) has items inserted, its minimum encumbrance is permanently changed. Here I have five leather backpacks that were used to store various amounts of rags, but are now all empty and sitting on the floor. The Wear menu shows they have different "Avg Encumbrance":

image

Edit Starting with a recent overhaul to the encumbrance system, I found that as of commit 8e60922 encumbrance works correctly. I started a git bisect to narrow down where things went wrong since then, and will pursue a fix and new test case(s) if I can locate it.

Bug was introduced in b8080baa6 from #40745

Following up, I've learned that a container's encumbrance does correctly get updated when you remove items by these methods:

  • Select the backpack (or pants or whatever), and select Unload
  • Wear another item with pockets, and insert items from the backpack

But the cached encumbrance value is not updated when items are removed from the backpack in these ways:

  • dropping items to the ground
  • multi Drop items to the ground
  • / and drop from advanced inventory manager to the ground

Apparently, during these latter operations, item::on_contents_changed needs to be called, so the cached encumbrance value can be updated.

This issue was partly resolved by #43108 - encumbrance now updates correctly when dropping with d or D.

Unfortunately, the issue still occurs when dropping items with advanced inventory manager.

Was this page helpful?
0 / 5 - 0 ratings