Closed azurespear closed 2 years ago
I actually found why this issue is happening, it has to do with the document update trough the game emit, when it's updated it only considers one of the updated variables from the array because it's on the same id, to be more clear what's hapenning is:
if (effect.parent.isOwner) {
ConditionalVisibility.INSTANCE.actorUpdates.push({
_id: effect.parent.id,
[baseflag + status.visibilityId]: false,
});
}
if (Array.from(this.effectsByCondition().values()).filter((e) => effect.parent.getFlag(CONDITIONAL_VISIBILITY_MODULE_NAME, e.visibilityId) ?? false).length == 1) {
if (effect.parent.isOwner) {
ConditionalVisibility.INSTANCE.actorUpdates.push({ //we shouldn't add another item to our array with the same id
_id: effect.parent.id,
[baseflag + 'hasEffect']: false,
});
}
Instead I'd suggest we do something like:
if (effect.parent.isOwner) {
if (Array.from(this.effectsByCondition().values()).filter((e) => effect.parent.getFlag(CONDITIONAL_VISIBILITY_MODULE_NAME, e.visibilityId) ?? false).length == 1) {
if (effect.parent.isOwner) {
ConditionalVisibility.INSTANCE.actorUpdates.push({
_id: effect.parent.id,
[baseflag + status.visibilityId]: false,[baseflag + 'hasEffect']: false //adding the two conditions on the same push
});
}
setTimeout(() => {
effect.parent.getActiveTokens()?.forEach((e) => {
e.alpha = 1;
e.visible = true;
e.data.hidden = false;
});
}, 350);
}
else{
ConditionalVisibility.INSTANCE.actorUpdates.push({
_id: effect.parent.id,
[baseflag + status.visibilityId]: false,
});
}}
This issue is closed, because the new series 0.4.X is just to different, checkout the last version of the module.
I'm running the 0.3.4 version and the invisible function still has issue Still can't set back the token to be visible when set "Link Actor data". This time there is no error message in the console![image](https://user-images.githubusercontent.com/48429790/149644550-57f4db19-b4e0-4516-baa4-35b3c6aee2c7.png)