Open jjhritz opened 10 months ago
Thanks for the issue. This is one that has been plaguing me for a while. It's hard to know what is actually desired when tokens can sometimes be an instance of a character (gangster) and sometimes refer to a named character (Inquisitor Graves). I have been wondering if there should be a flag on a character sheet to say if it's a 'type' -- so damage only goes to the token vs going to the character sheet. Alternatively, I should just make the code smarter to try and figure out the desired result based on if there is linked actor data or not.
The Link Actor Data toggle is supposed to control whether changes made to the token propagate back to the actor the token represents. I haven't yet found any API documentation to say specifically how to make sure that happens, but looking at code samples from other games, I think if you perform your operations on a "token" rather than an "actor", the LAD toggle will manage that behavior for you.
Either that, or you need to have the represented "actor" as a data member of the token. I'm not sure if that's default behavior (or, if it's not, why it wouldn't be).
My programming background is in C, not JS, so constructs like Promises and async are difficult for me to follow just reading looking at the code.
Yeah, I believe you are correct. Although I am unsure if it actually propagates exactly as you expect. There have been some recent changes that I was unaware of as well: https://foundryvtt.com/article/v11-actor-delta/
There is now an token.actor
and token.baseActor
to distinguish between the clone and the source. I will make some updates to try and update the token first and confirm that it does indeed propagate to the actor if linked.
Targeting a token linked to actor data works fine; wounds are deducted, critical damage is applied. It's only when targeting unlinked tokens that this error comes up.
Error occurs at https://github.com/mrkeathley/dark-heresy-2nd-vtt/blob/fb589eac717e68950c5d4148c3746c58a7d9f335/src/module/prompts/assign-damage-prompt.mjs#L26
Is it possible https://github.com/mrkeathley/dark-heresy-2nd-vtt/pull/18 missed referencing a uuid somewhere and is instead trying to reference actor data?
Foundry 11.308 Dark Heresy 2nd version: 1.7.1
Console output: