mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-23 10:59:54 +02:00
Fixed so that reload button is only shown in chat messages if the underlying item uses reload
This commit is contained in:
parent
26bcc2dddc
commit
cb0d22a9a0
3 changed files with 15 additions and 12 deletions
|
|
@ -76,10 +76,14 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
||||||
return fromUuidSync(this.source.actor);
|
return fromUuidSync(this.source.actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
get actionItem() {
|
get item() {
|
||||||
const actionActor = this.actionActor;
|
const actionActor = this.actionActor;
|
||||||
if (!actionActor || !this.source.item) return null;
|
if (!actionActor || !this.source.item) return null;
|
||||||
|
|
||||||
|
return actionActor.items.get(this.source.item);
|
||||||
|
}
|
||||||
|
|
||||||
|
get actionItem() {
|
||||||
switch (this.source.originItem.type) {
|
switch (this.source.originItem.type) {
|
||||||
case CONFIG.DH.ITEM.originItemType.restMove:
|
case CONFIG.DH.ITEM.originItemType.restMove:
|
||||||
const restMoves = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).restMoves;
|
const restMoves = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).restMoves;
|
||||||
|
|
@ -87,11 +91,14 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
||||||
this.source.originItem.actionIndex
|
this.source.originItem.actionIndex
|
||||||
];
|
];
|
||||||
default:
|
default:
|
||||||
const item = actionActor.items.get(this.source.item);
|
return this.item?.system.actionsList?.find(a => a.id === this.source.action);
|
||||||
return item ? item.system.actionsList?.find(a => a.id === this.source.action) : null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasReload() {
|
||||||
|
return this.item?.system.hasReload;
|
||||||
|
}
|
||||||
|
|
||||||
get action() {
|
get action() {
|
||||||
const { actionActor, actionItem: itemAction } = this;
|
const { actionActor, actionItem: itemAction } = this;
|
||||||
if (!this.source.action) return null;
|
if (!this.source.action) return null;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="roll-buttons">
|
<div class="roll-buttons">
|
||||||
{{#if (eq automationSettings.reload 'button')}}
|
{{#if (and parent.system.hasReload (eq automationSettings.reload 'button'))}}
|
||||||
<button class="roll-reload-check" {{#if needsReload}}disabled{{/if}}>{{localize "DAGGERHEART.ACTIONS.Reload.checkReload"}}</button>
|
<button class="roll-reload-check" {{#if needsReload}}disabled{{/if}}>{{localize "DAGGERHEART.ACTIONS.Reload.checkReload"}}</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if areas.length}}<button class="action-areas end-button"><i class="fa-solid fa-crosshairs"></i></button>{{/if}}
|
{{#if areas.length}}<button class="action-areas end-button"><i class="fa-solid fa-crosshairs"></i></button>{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
<div class="chat-roll">
|
<div class="chat-roll">
|
||||||
<div class="roll-part-title"><span>{{title}}</span></div>
|
<div class="roll-part-title"><span>{{title}}</span></div>
|
||||||
|
|
||||||
{{#if (eq action.type 'attack')}}
|
{{#if (and (eq action.type 'attack') parent.system.needsReload)}}
|
||||||
{{#if needsReload}}
|
<div class="roll-reload-container">
|
||||||
<div class="roll-reload-container">
|
<p class='reload-warning'>{{localize "DAGGERHEART.ACTIONS.Reload.reloadRequired"}}</p>
|
||||||
{{#if needsReload}}
|
</div>
|
||||||
<p class='reload-warning'>{{localize "DAGGERHEART.ACTIONS.Reload.reloadRequired"}}</p>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if actionDescription}}{{> 'systems/daggerheart/templates/ui/chat/parts/description-part.hbs'}}{{/if}}
|
{{#if actionDescription}}{{> 'systems/daggerheart/templates/ui/chat/parts/description-part.hbs'}}{{/if}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue