Aedif / TokenVariants

GNU General Public License v3.0
18 stars 12 forks source link

The change from token to token._source in evaluateComparator breaks a lot of token properties #178

Open Deatrathias opened 3 days ago

Deatrathias commented 3 days ago

In version 5.1.2, the method evaluateComparator was changed to use token._source instead of the token document directly. This means that it's no longer possible to use certain properties of tokens, like isOwner or hasPlayerOwner. Furthermore, it doesn't take into account certain values, for instance, in the PF2e system, the disposition of a token is not stored, but rather calculated during prepareData depending on the actor's alliance and other factors, so the disposition in the _source is always -1 and it becomes impossible to check the token's actual disposition. Is there a way to change this without cancelling previous bugfixes?

Aedif commented 3 days ago

The issue it was intended to resolve was the way foundry animates certain properties. For example rotation when updated with animation ON will continualy change the token document property between the original and new values, and depending on when evaluateComparator is called it might be checking a transitional value instead of the endpoint value.

I'll give this some thought. I ran into problems with checking actor properties for which I added a patch fix, but a better solution is required.

Aedif commented 2 days ago

Should be fixed in https://github.com/Aedif/TokenVariants/releases/tag/5.1.5

Deatrathias commented 1 day ago

It works for properties that aren't present in the source, but in the case of the token disposition in PF2e for instance, it will return the value from _source, which is always -1 rather than the calculated one in the token. I'm not sure what the best solution is, maybe a way to select whether we want the token value or the source value