Cataclysm-dda: Pocket category whitelist doesn't work

Created on 8 Aug 2020  路  1Comment  路  Source: CleverRaven/Cataclysm-DDA

Describe the bug

Pocket category whitelist doesn't seems to work. For example, with whitelisted "Magazines" category on army pants pockets P320 mag goes into backpack on pickup, instead of pants. Even if mag inserted into pants manually, it'd go to rucksack on gun reload.
Desired use-case scenario: to define "battle gear" with only essentials in pockets to keep encumbrance down, with mags going into fastest pockets, whereas rest of the loot goes into backpack and can be quickly ditched.

Steps To Reproduce

  1. Spawn army pants, military rucksack, P320 9x19 mag
  2. Wear pants & rucksack
  3. Set category whitelist on all pants pockets to "Magazines"
  4. pick up P320 mag, it'll go to rucksack instead of pants
  5. Fiddle with pocket priorities (set higher for pants, lower for rucksack), repeat test, still goes into rucksack
  6. drop mag, remove category whitelist
  7. pick up mag, it goes into pants as expected
  8. set item whitelist on pants pockets to "p320 mag"
  9. pick up mag, it goes into pants as expected

Expected behavior

With category whitelist set to "magazines" on pants P320 mag to go into army pants instead of rucksack.

Versions and configuration

  • OS: Windows

    • OS Version: 10.0 1903

  • Game Version: 0.E-4920-g6a34646 [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Blaze Industries [blazeindustries],
    No Fungal Monsters [No_Fungi],
    Stats Through Skills [StatsThroughSkills]
    ]
<Bug> Containers

Most helpful comment

Looks like there's some overeager logic in the better_pocket code which will ignore all other factors if any whitelist/blacklist data is set. If both pockets can contain the item, it will return exclusively based on priority (and it's not a stable sort either, so it's kind of random what happens here)

Will refactor it and add some tests later today.

>All comments

Looks like there's some overeager logic in the better_pocket code which will ignore all other factors if any whitelist/blacklist data is set. If both pockets can contain the item, it will return exclusively based on priority (and it's not a stable sort either, so it's kind of random what happens here)

Will refactor it and add some tests later today.

Was this page helpful?
0 / 5 - 0 ratings