diff --git a/changelog.md b/changelog.md index 19681bb4..70f739ef 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Item Piles Changelog +## Version 2.5.7 + +- Fixed double-clicking on linked tokens' actor sheets would not open the ephemeral actor sheet that has [Token] instead of [Prototype Token] in the header +- Fixed `removeExistingActorItems` causing the item pile UI to fail to display any new items + ## Version 2.5.6 - Fixed clicking on item pile actors in the sidebar would not open the item pile UI, but the actor sheet diff --git a/src/API/private-api.js b/src/API/private-api.js index 286b2caa..eb679684 100644 --- a/src/API/private-api.js +++ b/src/API/private-api.js @@ -903,9 +903,9 @@ export default class PrivateAPI { if (!foundry.utils.isEmpty(actorUpdates)) { await actor.update(actorUpdates); } + const createdItems = itemsToCreate.length ? await actor.createEmbeddedDocuments("Item", itemsToCreate) : []; if (itemsToUpdate.length) await actor.updateEmbeddedDocuments("Item", itemsToUpdate); if (itemsToDelete.length) await actor.deleteEmbeddedDocuments("Item", itemsToDelete); - const createdItems = itemsToCreate.length ? await actor.createEmbeddedDocuments("Item", itemsToCreate) : []; return createdItems.map(item => item.toObject()); } diff --git a/src/libwrapper.js b/src/libwrapper.js index df80a059..214c24ce 100644 --- a/src/libwrapper.js +++ b/src/libwrapper.js @@ -25,15 +25,14 @@ export default function registerLibwrappers() { return wrapped(event); }, "MIXED"); - libWrapper.register(CONSTANTS.MODULE_NAME, `ActorSheet.prototype.render`, function (wrapped, forced, options) { + libWrapper.register(CONSTANTS.MODULE_NAME, `ActorSheet.prototype.render`, function (wrapped, forced, options, ...args) { if (this && this._state > Application.RENDER_STATES.NONE) { - wrapped(forced, options); - } - if (PileUtilities.isValidItemPile(this.document) && hotkeyActionState.openPileInventory && !options?.bypassItemPiles) { + wrapped(forced, options, ...args); + } else if (PileUtilities.isValidItemPile(this.document) && hotkeyActionState.openPileInventory && !options?.bypassItemPiles) { game.itempiles.API.renderItemPileInterface(this.document, { useDefaultCharacter: true }); return this; } - return wrapped(forced); + return wrapped(forced, options, ...args); }, "MIXED"); }