Skip to content

Commit

Permalink
fix: drag drop duplication issue for consumables on same actor
Browse files Browse the repository at this point in the history
Addresses issue #1729
  • Loading branch information
marvin9257 committed Jan 15, 2025
1 parent afcdd9f commit 065693d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/module/sheets/AbstractTwodsixItemSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ export abstract class AbstractTwodsixItemSheet extends foundry.applications.api.
let itemId: string;
if (this.item.actor?.items.get(itemData._id)) {
itemId = itemData._id;
//Check to see if consumable exists on another item for actor
const previousItem:TwodsixItem = itemData.actor.items.find(it => it.system.consumables.includes(itemId));
if (previousItem) {
await previousItem.removeConsumable(itemId, previousItem.system);
}
} else {
const newItem = await (<TwodsixActor>this.item.actor)?.createEmbeddedDocuments("Item", [foundry.utils.duplicate(itemData)]);
if (!newItem) {
Expand Down

0 comments on commit 065693d

Please sign in to comment.