Dragging features from one adversary to another (#788)

This commit is contained in:
Josh Q. 2025-08-10 14:18:01 -04:00 committed by GitHub
parent 5359455050
commit f81d0d250f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 6 deletions

View file

@ -98,11 +98,17 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
async _onDrop(event) {
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
if (data.fromInternal) return;
const item = await fromUuid(data.uuid);
if (item.type === 'feature') {
await this.actor.createEmbeddedDocuments('Item', [item]);
if (item?.type === 'feature') {
if (data.fromInternal && item.parent?.uuid === this.actor.uuid) {
return;
}
const itemData = item.toObject();
delete itemData._id;
await this.actor.createEmbeddedDocuments('Item', [itemData]);
}
}
}