This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
foundryvtt-beam-saber/module/blades-clock-sheet.js
jeniankatarn c0599ced37
Change path references from absolute to relative (#128)
- blades.js - toggleable clock status graphic visible again on clock's actor sheet.
- blades-clock-sheet.js - clock status graphic visible again on clock's actor token.
2021-06-16 14:30:00 +03:00

68 lines
1.7 KiB
JavaScript

import { BladesSheet } from "./blades-sheet.js";
/**
* Extend the basic ActorSheet with some very simple modifications
* @extends {BladesSheet}
*/
export class BladesClockSheet extends BladesSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ["blades-in-the-dark", "sheet", "actor"],
template: "systems/blades-in-the-dark/templates/actors/clock-sheet.html",
width: 700,
height: 970,
});
}
/* -------------------------------------------- */
/** @override */
getData() {
var data = super.getData();
data.editable = this.options.editable;
const actorData = data.data;
data.actor = actorData;
data.data = actorData.data;
return data;
}
/* -------------------------------------------- */
/** @override */
async _updateObject(event, formData) {
let image_path = `systems/blades-in-the-dark/styles/assets/progressclocks-svg/Progress Clock ${formData['data.type']}-${formData['data.value']}.svg`;
formData['img'] = image_path;
formData['token.img'] = image_path;
let data = [];
let update = {
img: image_path,
width: 1,
height: 1,
scale: 1,
mirrorX: false,
mirrorY: false,
tint: "",
displayName: 50
};
let tokens = this.actor.getActiveTokens();
tokens.forEach( function( token ) {
data.push(
foundry.utils.mergeObject(
{ _id: token.id },
update
)
);
});
await TokenDocument.updateDocuments( data, { parent: game.scenes.current } )
// Update the Actor
return this.object.update(formData);
}
/* -------------------------------------------- */
}