mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
.
This commit is contained in:
parent
2487c200e5
commit
4dfc18f727
3 changed files with 12 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue