mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 12:41: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;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
characterTokenData: new fields.SchemaField({
|
characterTokenData: new fields.SchemaField({
|
||||||
|
usesDynamicToken: new fields.BooleanField({ initial: false }),
|
||||||
tokenImg: new fields.FilePathField({
|
tokenImg: new fields.FilePathField({
|
||||||
categories: ['IMAGE'],
|
categories: ['IMAGE'],
|
||||||
base64: false,
|
base64: false,
|
||||||
|
|
@ -49,6 +50,7 @@ export default class BeastformEffect extends BaseEffect {
|
||||||
src: this.characterTokenData.tokenImg
|
src: this.characterTokenData.tokenImg
|
||||||
},
|
},
|
||||||
ring: {
|
ring: {
|
||||||
|
enabled: this.characterTokenData.usesDynamicToken,
|
||||||
subject: {
|
subject: {
|
||||||
texture: this.characterTokenData.tokenRingImg
|
texture: this.characterTokenData.tokenRingImg
|
||||||
}
|
}
|
||||||
|
|
@ -58,6 +60,7 @@ export default class BeastformEffect extends BaseEffect {
|
||||||
const updateToken = token => ({
|
const updateToken = token => ({
|
||||||
...baseUpdate,
|
...baseUpdate,
|
||||||
'texture': {
|
'texture': {
|
||||||
|
enabled: this.characterTokenData.usesDynamicToken,
|
||||||
src: token.flags.daggerheart.beastformTokenImg
|
src: token.flags.daggerheart.beastformTokenImg
|
||||||
},
|
},
|
||||||
'ring': {
|
'ring': {
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ export default class DHBeastform extends BaseDataItem {
|
||||||
],
|
],
|
||||||
system: {
|
system: {
|
||||||
characterTokenData: {
|
characterTokenData: {
|
||||||
|
usesDynamicToken: this.parent.parent.prototypeToken.ring.enabled,
|
||||||
tokenImg: this.parent.parent.prototypeToken.texture.src,
|
tokenImg: this.parent.parent.prototypeToken.texture.src,
|
||||||
tokenRingImg: this.parent.parent.prototypeToken.ring.subject.texture,
|
tokenRingImg: this.parent.parent.prototypeToken.ring.subject.texture,
|
||||||
tokenSize: {
|
tokenSize: {
|
||||||
|
|
|
||||||
|
|
@ -251,6 +251,12 @@ export const adjustRange = (rangeVal, decrease) => {
|
||||||
return range[rangeKeys[newIndex]];
|
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) => {
|
export const updateActorTokens = async (actor, update, updateToken) => {
|
||||||
await actor.prototypeToken.update({ ...update });
|
await actor.prototypeToken.update({ ...update });
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue