Skip to content

Commit

Permalink
Fixed compatibility with token mold
Browse files Browse the repository at this point in the history
  • Loading branch information
javieros105 committed Sep 24, 2021
1 parent 57935f4 commit 36dc15a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Binary file modified token-hud-wildcard.zip
Binary file not shown.
13 changes: 6 additions & 7 deletions token-hud-wildcard/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ const WildcardDefault = {
return flag
},
_hookPreTokenCreate () {
Hooks.on('preCreateToken', (token, data, options, userId) => {
const actor = token.actor
const defaultValue = data.flags['token-hud-wildcard'] ? data.flags['token-hud-wildcard'].default : ''

if (defaultValue !== '' && actor?.data.token.randomImg) {
const dimensions = getTokenDimensions(token, defaultValue)
Hooks.on('createToken', (parent, options, userId) => {
const defaultValue = parent?.actor?.data?.token?.flags['token-hud-wildcard'] ? parent.actor.data.token.flags['token-hud-wildcard'].default : ''

if (defaultValue !== '' && parent?.actor?.data?.token?.randomImg) {
const dimensions = getTokenDimensions(parent, defaultValue)
let updateInfo = { img: defaultValue, ...dimensions }
token.data.update(updateInfo)
parent.object.document.update(updateInfo)
}
})
},
Expand Down
4 changes: 2 additions & 2 deletions token-hud-wildcard/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "token-hud-wildcard",
"title": "Token HUD Wildcard",
"description": "This module adds a button to the Token HUD if the token has wildcard set and detects more than 1 image to choose from. Pressing the button displays a panel on the right side of the HUD with buttons for each image, pressing one of these allows to change the token image.",
"version": "1.4.0",
"version": "1.5.0",
"minimumCoreVersion": "0.6.0",
"compatibleCoreVersion": "0.8.8",
"compatibleCoreVersion": "0.8.9",
"author": "Javieros",
"scripts": ["main.js"],
"styles": ["./css/token-hud-wildcard.css"],
Expand Down

0 comments on commit 36dc15a

Please sign in to comment.