mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[Feature] Actor Directory subtitles (#1332)
* Show subtitles for various actor types in actor directory * Show adversary and environment type * Update companion subtitles * Fallback adversay and environment label to item type label
This commit is contained in:
parent
b4c2034789
commit
630ba5ab7d
6 changed files with 60 additions and 0 deletions
20
module/applications/sidebar/tabs/actorDirectory.mjs
Normal file
20
module/applications/sidebar/tabs/actorDirectory.mjs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
export default class DhActorDirectory extends foundry.applications.sidebar.tabs.ActorDirectory {
|
||||
static DEFAULT_OPTIONS = {
|
||||
renderUpdateKeys: ['system.levelData.level.current', 'system.partner', 'system.tier']
|
||||
};
|
||||
|
||||
static _entryPartial = 'systems/daggerheart/templates/ui/sidebar/actor-document-partial.hbs';
|
||||
|
||||
async _prepareDirectoryContext(context, options) {
|
||||
await super._prepareDirectoryContext(context, options);
|
||||
const adversaryTypes = CONFIG.DH.ACTOR.allAdversaryTypes();
|
||||
const environmentTypes = CONFIG.DH.ACTOR.environmentTypes;
|
||||
context.getTypeLabel = document => {
|
||||
return document.type === 'adversary'
|
||||
? game.i18n.localize(adversaryTypes[document.system.type]?.label ?? 'TYPES.Actor.adversary')
|
||||
: document.type === 'environment'
|
||||
? game.i18n.localize(environmentTypes[document.system.type]?.label ?? 'TYPES.Actor.environment')
|
||||
: null;
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue