This commit is contained in:
WBHarry 2025-08-28 02:05:00 +02:00
parent 2487c200e5
commit 4dfc18f727
3 changed files with 12 additions and 2 deletions

View file

@ -28,4 +28,13 @@ export default class DHConsumable extends BaseDataItem {
/**@override */
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/round-potion.svg';
async _preUpdate(changes, options, userId) {
const allowed = await super._preUpdate(changes, options, userId);
if (allowed === false) return;
if (changes.system?.quantity !== undefined && Number(changes.system.quantity) === 0) {
this.parent.delete();
return;
}
}
}