mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-04-30 02:31:41 -04:00
Merge branch '37-overrided-getBarAttribute' into 'master'
37: Fix custom attribute token bars being marked as not editable in token HUD Closes #37 See merge request foundrynet/worldbuilding!21
This commit is contained in:
commit
7d8eb74ee7
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 { SimpleActorSheet } from "./actor-sheet.js";
|
||||||
import { preloadHandlebarsTemplates } from "./templates.js";
|
import { preloadHandlebarsTemplates } from "./templates.js";
|
||||||
import { createWorldbuildingMacro } from "./macro.js";
|
import { createWorldbuildingMacro } from "./macro.js";
|
||||||
|
import { SimpleTokenDocument } from "./simpletokendocument.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Foundry VTT Initialization */
|
/* Foundry VTT Initialization */
|
||||||
|
@ -40,6 +41,9 @@ Hooks.once("init", async function() {
|
||||||
CONFIG.Actor.documentClass = SimpleActor;
|
CONFIG.Actor.documentClass = SimpleActor;
|
||||||
CONFIG.Item.documentClass = SimpleItem;
|
CONFIG.Item.documentClass = SimpleItem;
|
||||||
|
|
||||||
|
// Update TokenDocument with overrided getBarAttribute method
|
||||||
|
CONFIG.Token.documentClass = SimpleTokenDocument;
|
||||||
|
|
||||||
// Register sheet application classes
|
// Register sheet application classes
|
||||||
Actors.unregisterSheet("core", ActorSheet);
|
Actors.unregisterSheet("core", ActorSheet);
|
||||||
Actors.registerSheet("worldbuilding", SimpleActorSheet, { makeDefault: true });
|
Actors.registerSheet("worldbuilding", SimpleActorSheet, { makeDefault: true });
|
||||||
|
|
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