From 3f7f3b6dc1bb76d385b094952730d6944d26d307 Mon Sep 17 00:00:00 2001 From: Haxxer Date: Sun, 3 Mar 2024 11:53:14 +0000 Subject: [PATCH] Fixed containers not updating image when the contents of the item pile changed --- changelog.md | 1 + src/helpers/pile-utilities.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 1d022cae..8405cc4d 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ - Fixed merchant activity log events being incorrectly displayed - Fixed custom categories not being applied on items when populating merchants - Fixed issue with item piles not updating the amount of visible currency when taking 1 unit of currency at a time +- Fixed containers not updating image when the contents of the item pile changed ## Version 2.8.20 diff --git a/src/helpers/pile-utilities.js b/src/helpers/pile-utilities.js index 033d962d..a701e8f8 100644 --- a/src/helpers/pile-utilities.js +++ b/src/helpers/pile-utilities.js @@ -533,9 +533,12 @@ export function getItemPileName(target, { data = false, items = false, currencie } export function shouldEvaluateChange(target, changes) { - const flags = getActorFlagData(target, getProperty(changes, CONSTANTS.FLAGS.PILE) ?? {}); + const baseFlags = getProperty(changes, CONSTANTS.FLAGS.PILE) ?? false; + const flags = getActorFlagData(target, baseFlags ? foundry.utils.deepClone(baseFlags) : baseFlags); if (!isValidItemPile(target, flags)) return false; - return (flags.type === CONSTANTS.PILE_TYPES.CONTAINER && (flags.closedImage || flags.emptyImage || flags.openedImage || flags.lockedImage)) || flags.displayOne || flags.showItemName || flags.overrideSingleItemScale; + return (flags.type === CONSTANTS.PILE_TYPES.CONTAINER + && (flags.closedImage || flags.emptyImage || flags.openedImage || flags.lockedImage)) + || flags.displayOne || flags.showItemName || flags.overrideSingleItemScale; } function getRelevantTokensAndActor(target) {