fantasycalendar / FoundryVTT-ItemPiles

Other
33 stars 54 forks source link

[BUG] - [Item Piles] - itemPileFlags not setting flag #626

Closed Ikabodo closed 1 month ago

Ikabodo commented 1 month ago

Are you on the latest version of Item Piles? Yes

Have you tried to reset Item Piles' system settings? No

Describe the bug

const itemUUID = "Compendium.world.aederin-magical-items.Item.raHuGpySjm4kircr";

let item = await fromUuid(itemUUID);

if (!item) {
  ui.notifications.error("Item not found.");
  return;
}

let itemData = duplicate(item.toObject());
itemData.system.quantity = 15; 

const tokenImageUrl = "FA_Mapmaking_Pack/Decor/Clutter/Arranged_Clutter/Table_Arrangement_E28_2x2.png";

let pile = await game.itempiles.API.createItemPile({
  position: {
    x: token.x,
    y: token.y
  },
  tokenOverrides: {
    img: tokenImageUrl,
    width: 1,
    height: 1,
    name: "Bland Food & Water"
  },
  itemPileFlags: {
    "deleteWhenEmpty": true,
    "displayOne": false,
    "showItemName": false
  },
  items: [
    {
      item: itemData,
      quantity: 15
    }
  ]
});

I use this code as an item macro. As far as I can see, it SHOULD set the itemPileFlags as above on the pile that is being created. But for some reason the pile is instead just using the default pile settings.

It can be run directly as macro too, with token selected.

To Reproduce Run above as item macro. Pile is created as expected, but the flags aren't being set.

Expected behavior itemPileFlags should be set instead of default item pile flags?

Setup:

Active modules:

Haxxer commented 1 month ago

Fixed in 3.0.10