#7 - Manage container

This commit is contained in:
2021-03-22 21:02:56 +01:00
parent 2353ba5ff9
commit baf84bee35
6 changed files with 81 additions and 12 deletions

View File

@@ -382,4 +382,16 @@ export class SoSUtility extends Entity {
defender.applyWounds( flipData );
}
/* -------------------------------------------- */
static async processItemDropEvent(actorSheet, event) {
let dragData = JSON.parse(event.dataTransfer.getData("text/plain"));
let dropID = $(event.target).parents(".item").attr("data-item-id"); // Only relevant if container drop
let objectID = dragData.id || dragData.data._id;
//console.log("drag/drop", dragData, actorSheet.actor._id, dropID, objectID);
if (dragData.type == 'Item' && dropID) {
actorSheet.actor.addObjectToContainer(objectID, dropID );
}
return true;
}
}