mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-04-30 02:31:41 -04:00
37: Fix custom attribute token bars being marked as not editable in token HUD
This commit is contained in:
parent
93d86fc459
commit
e723598a6c
2 changed files with 15 additions and 0 deletions
|
@ -10,6 +10,7 @@ import { SimpleItemSheet } from "./item-sheet.js";
|
|||
import { SimpleActorSheet } from "./actor-sheet.js";
|
||||
import { preloadHandlebarsTemplates } from "./templates.js";
|
||||
import { createWorldbuildingMacro } from "./macro.js";
|
||||
import { SimpleTokenDocument } from "./simpletokendocument.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
|
@ -39,6 +40,9 @@ Hooks.once("init", async function() {
|
|||
// Define custom Document classes
|
||||
CONFIG.Actor.documentClass = SimpleActor;
|
||||
CONFIG.Item.documentClass = SimpleItem;
|
||||
|
||||
// Update TokenDocument with overrided getBarAttribute method
|
||||
CONFIG.Token.documentClass = SimpleTokenDocument;
|
||||
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
|
|
11
module/simpletokendocument.js
Normal file
11
module/simpletokendocument.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
export class SimpleTokenDocument extends TokenDocument {
|
||||
|
||||
/** @inheritdoc */
|
||||
getBarAttribute(barName, {alternative}={}) {
|
||||
const attr = super.getBarAttribute(barName, {alternative});
|
||||
if ( attr === null ) return null;
|
||||
attr.editable = true; // Attribute always editable, super requires attr to exist in actor template
|
||||
return attr;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue