Merge branch 'feature/action-areas' of https://github.com/Foundryborne/daggerheart into feature/action-areas

This commit is contained in:
WBHarry 2026-04-21 22:27:10 +02:00
commit cb999d3d48
4 changed files with 7 additions and 5 deletions

View file

@ -57,7 +57,7 @@ export default class ActionSelectionDialog extends HandlebarsApplicationMixin(Ap
/** @inheritDoc */ /** @inheritDoc */
async _prepareContext(options) { async _prepareContext(options) {
const actions = this.#item.system.actions.map(action => ({ const actions = this.#item.system.actionsList.map(action => ({
...action.toObject(), ...action.toObject(),
id: action.id, id: action.id,
img: action.baseAction ? action.parent.parent.img : action.img img: action.baseAction ? action.parent.parent.img : action.img
@ -72,7 +72,7 @@ export default class ActionSelectionDialog extends HandlebarsApplicationMixin(Ap
static async #onChooseAction(event, button) { static async #onChooseAction(event, button) {
const { actionId } = button.dataset; const { actionId } = button.dataset;
this.action = this.item.system.actions.find(a => a._id === actionId); this.action = this.item.system.actionsList.find(a => a._id === actionId);
Object.defineProperty(this.event, 'shiftKey', { Object.defineProperty(this.event, 'shiftKey', {
get() { get() {
return event.shiftKey; return event.shiftKey;

View file

@ -17,7 +17,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
this.action = this.action =
config.data.attack?._id == config.source.action config.data.attack?._id == config.source.action
? config.data.attack ? config.data.attack
: this.item.system.actions?.find(a => a.id === config.source.action); : this.item.system.actionsList?.find(a => a.id === config.source.action);
} }
} }

View file

@ -84,7 +84,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
]; ];
default: default:
const item = actionActor.items.get(this.source.item); const item = actionActor.items.get(this.source.item);
return item ? item.system.actions?.find(a => a.id === this.source.action) : null; return item ? item.system.actionsList?.find(a => a.id === this.source.action) : null;
} }
} }

View file

@ -109,7 +109,9 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
get actionsList() { get actionsList() {
// No actions on non-characters // No actions on non-characters
if (this.actor && this.actor.type !== 'character') return []; if (this.metadata.isInventoryItem && this.actor && this.actor.type !== 'character') {
return [];
}
return this.actions; return this.actions;
} }