mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
264 - Action Feature Swap (#265)
* Removed action fields on Adversary/Environment in favor of using Feature Items * Added drag/drop for features onto adversary/environment settings * Added Drag of features from Adversary/Environment settings to anywhere in Foundry * Updated all item types except Class/Subclass * Added for Class/Subclass * Items now copy over their features to Character * Corrected back to actions for right items * Fixed adversary/environment features display * PR Fixes
This commit is contained in:
parent
eac58c1386
commit
e9ad9c539a
58 changed files with 1146 additions and 1114 deletions
|
|
@ -3,12 +3,7 @@ import DHBaseItemSheet from '../api/base-item.mjs';
|
|||
export default class BeastformSheet extends DHBaseItemSheet {
|
||||
/**@inheritdoc */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ['beastform'],
|
||||
dragDrop: [{ dragSelector: null, dropSelector: '.drop-section' }],
|
||||
actions: {
|
||||
editFeature: this.editFeature,
|
||||
removeFeature: this.removeFeature
|
||||
}
|
||||
classes: ['beastform']
|
||||
};
|
||||
|
||||
/**@override */
|
||||
|
|
@ -40,26 +35,4 @@ export default class BeastformSheet extends DHBaseItemSheet {
|
|||
|
||||
return context;
|
||||
}
|
||||
|
||||
static editFeature(event) {
|
||||
const target = event.target.closest('[data-action="editFeature"]');
|
||||
const feature = this.document.system.features[target.dataset.index];
|
||||
feature.sheet.render({ force: true });
|
||||
}
|
||||
|
||||
static async removeFeature(_, target) {
|
||||
const current = this.document.system.features.map(x => x.uuid);
|
||||
await this.document.update({
|
||||
'system.features': current.filter((_, index) => index !== Number(target.dataset.index))
|
||||
});
|
||||
}
|
||||
|
||||
async _onDrop(event) {
|
||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||
const item = await fromUuid(data.uuid);
|
||||
if (item.type === 'feature') {
|
||||
const current = this.document.system.features.map(x => x.uuid);
|
||||
await this.document.update({ 'system.features': [...current, item.uuid] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue