Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

u_consume_item work improperly with variable object charges

Open cknight828 opened this issue 1 year ago • 0 comments

Describe the bug

u_consume_item removes items by count, instead of charges, when charges field is set with variable object.

I tested with this mod.

[
  {
    "type": "MOD_INFO",
    "id": "consume_test",
    "name": "consume_test",
    "description": "test",
    "dependencies": [ "dda" ]
  },
  {
    "type": "effect_on_condition",
    "id": "eoc_consume_test",
    "effect": [
      { "u_consume_item": "protein_bar_evac", "count": 1 },
      { "u_consume_item": "water_clean", "charges": 1 }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "eoc_consume_test_var",
    "effect": [
      { "math": [ "tmp_var", "=", "1" ] },
      { "u_consume_item": "protein_bar_evac", "count": { "global_val": "tmp_var" } },
      { "u_consume_item": "water_clean", "charges": { "global_val": "tmp_var" } }
    ]
  }
]

Attach save file

N/A

Steps to reproduce

  1. Create world with the above mod.
  2. Gather protein bars and water.
  3. Run eoc_consume_test_var, remove 1 protein bar and 1 bottle of water.
  4. Run eoc_consume_test, remove 1 protein bar and 1 charge of water, and half of bottle of water remains.

Expected behavior

u_consume_item removes same chareges of item with int and variable object.

Screenshots

No response

Versions and configuration

  • OS: Linux
    • OS Version: Distributor ID: Debian; Description: Debian GNU/Linux 12 (bookworm); Release: 12; Codename: bookworm;
  • Game Version: cdda-experimental-2024-09-10-0532 43dd78a [64-bit]
  • Graphics Version: Tiles
  • Game Language: 日本語 <color_dark_gray>(99.8%) [ja]
  • Mods loaded: [ コア - Dark Days Ahead [dda], 削除 - NPCの欲求 [no_npc_food], 変更 - NPCに無害なポータル嵐 [personal_portal_storms], 変更 - 真菌増殖抑制 [no_fungal_growth], consume_test [consume_test] ]

Additional context

No response

cknight828 avatar Sep 12 '24 05:09 cknight828