mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Merged with main
This commit is contained in:
commit
843c7c55f9
23 changed files with 170 additions and 92 deletions
|
|
@ -77,10 +77,10 @@ export default class DHItem extends foundry.documents.Item {
|
|||
});
|
||||
}
|
||||
|
||||
async selectActionDialog() {
|
||||
async selectActionDialog(prevEvent) {
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/dialogs/actionSelect.hbs',
|
||||
{ actions: this.system.actions }
|
||||
{ actions: this.system.actionsList }
|
||||
),
|
||||
title = 'Select Action';
|
||||
|
||||
|
|
@ -89,19 +89,25 @@ export default class DHItem extends foundry.documents.Item {
|
|||
content,
|
||||
ok: {
|
||||
label: title,
|
||||
callback: (event, button, dialog) =>
|
||||
this.system.actions.find(a => a._id === button.form.elements.actionId.value)
|
||||
callback: (event, button, dialog) => {
|
||||
Object.defineProperty(prevEvent, 'shiftKey', {
|
||||
get() {
|
||||
return event.shiftKey;
|
||||
}
|
||||
});
|
||||
return this.system.actionsList.find(a => a._id === button.form.elements.actionId.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async use(event) {
|
||||
const actions = this.system.actions;
|
||||
const actions = this.system.actionsList;
|
||||
if (actions?.length) {
|
||||
let action = actions[0];
|
||||
if (actions.length > 1 && !event?.shiftKey) {
|
||||
// Actions Choice Dialog
|
||||
action = await this.selectActionDialog();
|
||||
action = await this.selectActionDialog(event);
|
||||
}
|
||||
if (action) return action.use(event);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue