SalieriC / SWIM

A collection of macros for the SWADE system on Foundry with a focus on immersion (i.e. by using sound effects)
GNU General Public License v3.0
10 stars 12 forks source link

Shape-change token loses elevation setting #58

Closed pmoore603 closed 2 years ago

pmoore603 commented 2 years ago

I was able to retrieve the elevation in the code, and was able to store it in scCopy, but the value is lost after scCopy.createEmbeddedDocument in the update_preset function. My guess is that a token somewhere during this process is PrototypeTokenData (which does NOT have elevation) and is not TokenData (which does have elevation). I can get this to work by getting the elevation at the start of main() and passing it in as an argument to replace_token() and doing this at the end of the function:

let newToken = canvas.tokens.get(newTokenID[0])
await newToken.document.update({'elevation': elevation})
SalieriC commented 2 years ago

I rarely use elevation which is why I forgot about it initially. Done in git. Thanks for the code snippet. =)