diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index b3775dc9..acd104a7 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -148,10 +148,14 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel : null; } - /** Returns true if the action is usable */ + /** + * Returns true if the action is usable. + * An action is usable on any actor type. For example, an adversary might have a base attack action. + */ get usable() { const actor = this.actor; - return this.isOwner && actor?.type === 'character'; + const pack = actor?.pack ? game.packs.get(actor.pack) : null; + return !pack?.locked && this.isOwner; } static getRollType(parent) { diff --git a/module/documents/item.mjs b/module/documents/item.mjs index 93aa3b28..603ca594 100644 --- a/module/documents/item.mjs +++ b/module/documents/item.mjs @@ -73,8 +73,10 @@ export default class DHItem extends foundry.documents.Item { /** Returns true if the item can be used */ get usable() { const actor = this.actor; - const actionsList = this.system.actionsList; - return this.isOwner && actor?.type === 'character' && (actionsList?.size || actionsList?.length); + const pack = actor?.pack ? game.packs.get(actor.pack) : null; + const hasActions = this.system.actionsList?.size || this.system.actionsList?.length; + const isValidType = actor?.type === 'character' || this.type === 'feature'; + return !pack?.locked && this.isOwner && isValidType && hasActions; } /** @inheritdoc */ diff --git a/templates/sheets/global/partials/inventory-item-compact.hbs b/templates/sheets/global/partials/inventory-item-compact.hbs index daba6721..78eaf087 100644 --- a/templates/sheets/global/partials/inventory-item-compact.hbs +++ b/templates/sheets/global/partials/inventory-item-compact.hbs @@ -5,7 +5,7 @@ (hasProperty item "toChat" ) "toChat" "editDoc" ) }}' {{#unless hideTooltip}} {{#if (eq type 'attack' )}} data-tooltip="#attack#{{item.actor.uuid}}" {{else}} data-tooltip="#item#{{item.uuid}}" {{/if}} {{/unless}}> - {{#if (or item.system.actionsList.size item.system.actionsList.length item.actionType)}} + {{#if item.usable}} {{#if @root.isNPC}} d20 {{else}}