mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
.
This commit is contained in:
parent
496de55a27
commit
ef57b1cb2e
3 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ export default class BeastformEffect extends BaseEffect {
|
|||
const fields = foundry.data.fields;
|
||||
return {
|
||||
characterTokenData: new fields.SchemaField({
|
||||
usesDynamicToken: new fields.BooleanField({ initial: false }),
|
||||
tokenImg: new fields.FilePathField({
|
||||
categories: ['IMAGE'],
|
||||
base64: false,
|
||||
|
|
@ -49,6 +50,7 @@ export default class BeastformEffect extends BaseEffect {
|
|||
src: this.characterTokenData.tokenImg
|
||||
},
|
||||
ring: {
|
||||
enabled: this.characterTokenData.usesDynamicToken,
|
||||
subject: {
|
||||
texture: this.characterTokenData.tokenRingImg
|
||||
}
|
||||
|
|
@ -58,6 +60,7 @@ export default class BeastformEffect extends BaseEffect {
|
|||
const updateToken = token => ({
|
||||
...baseUpdate,
|
||||
'texture': {
|
||||
enabled: this.characterTokenData.usesDynamicToken,
|
||||
src: token.flags.daggerheart.beastformTokenImg
|
||||
},
|
||||
'ring': {
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ export default class DHBeastform extends BaseDataItem {
|
|||
],
|
||||
system: {
|
||||
characterTokenData: {
|
||||
usesDynamicToken: this.parent.parent.prototypeToken.ring.enabled,
|
||||
tokenImg: this.parent.parent.prototypeToken.texture.src,
|
||||
tokenRingImg: this.parent.parent.prototypeToken.ring.subject.texture,
|
||||
tokenSize: {
|
||||
|
|
|
|||
|
|
@ -251,6 +251,12 @@ export const adjustRange = (rangeVal, decrease) => {
|
|||
return range[rangeKeys[newIndex]];
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {DhActor} actor - The actor for which all tokens will run a data update.
|
||||
* @param {string} update - The data update to be applied to all tokens.
|
||||
* @param {func} updateToken - Optional, specific data update for the non-prototype tokens as a function using the token data. Useful to handle wildcard images where each token has a different image but the prototype has a wildcard path.
|
||||
*/
|
||||
export const updateActorTokens = async (actor, update, updateToken) => {
|
||||
await actor.prototypeToken.update({ ...update });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue