p4535992 / conditional-visibility

a FoundryVTT module to hide tokens from some players, but not from others
MIT License
5 stars 8 forks source link

[BUG] Tokens winking in and out crazily #26

Closed ctbritt closed 2 years ago

ctbritt commented 2 years ago

Module Version: v0.5.21

Before open any issue

If the problem is related to the sight check so for questions like "i can't see" or "i can see" this or that please apply the following steps

1) Enable the module setting "Enable debugging" 2) Click F12 go to the console tab 3) make the test you want and replicate the error 4) Go to the tab console open on point 2) and just right click and click 'Save as' and 'Save'. 5) attach the text file on the github issue

Describe the bug Clicking on various player tokens causes other tokens to disappear. Clicking on other tokens causes a different set of tokens to disappear.

To Reproduce Steps to reproduce the behavior:

  1. Put several tokens on canvas
  2. Click on a token
  3. Watch the show.

Expected behavior Tokens don't disappear

Screenshots

https://user-images.githubusercontent.com/4516034/160966156-70162876-d344-4c01-ac44-98e30c562fc9.mov

Browser:

Foundry Version: 9.255 Game System: DnD5e 1.5.7 Additional context This happens with only CV, libwrapper, ATL, and socketlib running. Disabling CV restores normal functionality.

p4535992 commented 2 years ago

@ctbritt sorry for the inconvenience, the last release was a heavy rewrite of some parts of the code try version 0.5.23 and tell me if you still have problems.

ctbritt commented 2 years ago

alas, same issue with 0.5.24. And if I click the same token some other tokens disappear. I deselect that token and they come back. I click it again, and another set of tokens disappears. (It seems to be random as to which ones vanish and which ones stick around.) Same effect in both DM view and player view. Very strange bug.

ctbritt commented 2 years ago

I'm also getting a warning in the console:

[Violation] 'requestAnimationFrame' handler took 215ms
dae.js:136 dae | @data.key is deprecated, use @key instead @data.attributes.movement.walk
applyDaeEffects @ dae.js:136
prepareData @ DAEdnd5e.js:724
_prepareOnUseMacroData @ patching.js:514
prepareDerivedResources @ module.js:131
🎁CONFIG.Actor.documentClass.prototype.prepareData#0 @ libWrapper-wrapper.js:187
_postUpdateDocumentCallbacks @ foundry.js:10311
_handleUpdateDocuments @ foundry.js:10240
_updateDocuments @ foundry.js:10121
await in _updateDocuments (async)
update @ backend.mjs:154
await in update (async)
updateDocuments @ document.mjs:373
update @ document.mjs:456
🎁call_wrapped @ libWrapper-wrapper.js:511
prePreUpdateActor @ module.js:197
🎁CONFIG.Actor.documentClass.prototype.update#0 @ libWrapper-wrapper.js:187
unsetFlag @ document.mjs:621
getConditionsFromTokenFast @ lib.js:1146
shouldIncludeVisionV2 @ lib.js:2034
sightLayerPrototypeTestVisibilityHandler @ libwrapper.js:281
🎁SightLayer.prototype.testVisibility#0 @ libWrapper-wrapper.js:187
_levelsTokenIsVisible @ helpers.js:252
🎁call_wrapper @ libWrapper-wrapper.js:595
🎁Token.prototype.isVisible#getter @ libWrapper-wrapper.js:368
restrictVisibility @ foundry.js:30449
🎁SightLayer.prototype.refresh#perfect-vision @ sight.js:254
🎁SightLayer.prototype.refresh#0 @ libWrapper-wrapper.js:187
_update @ foundry.js:33300
(anonymous) @ foundry.js:33272
setTimeout (async)
_update @ foundry.js:33272
schedule @ foundry.js:33199
🎁LightingLayer.prototype.refresh#perfect-vision @ lighting.js:253
🎁LightingLayer.prototype.refresh#0 @ libWrapper-wrapper.js:187
_update @ foundry.js:33297
schedule @ foundry.js:33199
_onElevationChangeUpdate @ levels.js:716
(anonymous) @ helpers.mjs:36
setTimeout (async)
(anonymous) @ helpers.mjs:35
(anonymous) @ main.js:102
_call @ foundry.js:294
callAll @ foundry.js:253
control @ foundry.js:21658
_onClickLeft @ foundry.js:21881
_onClickLeft @ foundry.js:38965
🎁call_wrapped @ libWrapper-wrapper.js:511
_tokenOnClickLeft @ smartTarget.js:20
🎁Token.prototype._onClickLeft#0 @ libWrapper-wrapper.js:187
callback @ foundry.js:24202
_handleClickLeft @ foundry.js:24389
_handleMouseDown @ foundry.js:24369
🎁call_wrapped @ libWrapper-wrapper.js:511
_handleMouseDown_Wrapper @ zoom-pan-options.js:213
🎁MouseInteractionManager.prototype._handleMouseDown#zoom-pan-options @ zoom-pan-options.js:430
🎁MouseInteractionManager.prototype._handleMouseDown#0 @ libWrapper-wrapper.js:187
a.emit @ index.js:181
r.dispatchEvent @ interaction.min.js:8
r.processPointerDown @ interaction.min.js:8
t.recursiveFindHit @ interaction.min.js:8
t.recursiveFindHit @ interaction.min.js:8
t.recursiveFindHit @ interaction.min.js:8
t.recursiveFindHit @ interaction.min.js:8
t.recursiveFindHit @ interaction.min.js:8
t.recursiveFindHit @ interaction.min.js:8
t.recursiveFindHit @ interaction.min.js:8
t.recursiveFindHit @ interaction.min.js:8
t.findHit @ interaction.min.js:8
r.processInteractive @ interaction.min.js:8
r.onPointerDown @ interaction.min.js:8
ctbritt commented 2 years ago

not a red error, but an amber warning

ctbritt commented 2 years ago

hm. disabled perfect vision and that didn't change anything.

ctbritt commented 2 years ago

update didn't fix, but now ALL OTHER tokens disappear when clicking on a token. If I turn off a token's vision, this bug stops.

ctbritt commented 2 years ago

debug gives these messages when I click on a token:


DEBUG | conditional-visibility | (6) Is false, 'Enna' can see 'undefined' 
lib.js:71 DEBUG | conditional-visibility | target undefined is not visible to sources Enna 
lib.js:71 DEBUG | conditional-visibility | (6) Is false, 'Enna' can see '"Captain" Kaine Strongjaw' 
lib.js:71 DEBUG | conditional-visibility | (6) Is false, 'Enna' can see 'Ander' 
lib.js:71 DEBUG | conditional-visibility | (6) Is false, 'Enna' can see 'Miabella' 
lib.js:71 DEBUG | conditional-visibility | (6) Is false, 'Enna' can see 'Rickvon' 
lib.js:71 DEBUG | conditional-visibility | (6) Is false, 'Enna' can see 'Vellynne' 
lib.js:71 DEBUG | conditional-visibility | (6) Is false, 'Enna' can see 'Avarice' 
lib.js:71 DEBUG | conditional-visibility | (6) Is false, 'Enna' can see 'Itilda' ```
emwhalen commented 2 years ago

I too am experiencing this issue in 0.5.25, and I have isolated it to this module. It's curiously affecting the token of one of my linked actors and not of any others, and I haven't yet been able to determine why.

p4535992 commented 2 years ago

@emwhalen @ctbritt I'm so stupid, sorry for the inconvenience, if god wants I solved it with 0.5.26, but I keep making mistakes a lot. Let me know it. If something still doesn't come back try removing the effect and adding it again.

shinkei13 commented 2 years ago

@p4535992 I'm also experiencing this issue as well in 0.5.27. Something I believe might be somewhat related is the inability to see Doors with the full rewrite of the checker since 0.5.21.

p4535992 commented 2 years ago

@shinkei13 , not sure about the winking issue, but i totally miss the door issue should be solved with 0.5.29 let me know.

emwhalen commented 2 years ago

I am no longer experiencing the token blinking in 0.5.29. I will continue to watch for it just in case.

And for what it's worth, I think you're doing a great job. 👍

shinkei13 commented 2 years ago

100% agreed you're doing fantastic work! Also I can say that I'm still getting the errors (both disappearing tokens and the missing closed doors) with version 0.5.29 and 0.5.30.

https://user-images.githubusercontent.com/33383758/161338596-70dc1f6d-3ef4-4441-a5a2-f2865f1a8aad.mp4

p4535992 commented 2 years ago

@shinkei13 i forgot to test the token vision on the scene... i failed again... should be fixed on 0.5.32, cannot replicate the token disappearing.... can you pass to me the debug log messages and the name of the token that disappears?

shinkei13 commented 2 years ago

The Doors appear! Thanks so much for your diligence @p4535992, cause I love the CV module!

The missing tokens are Akra, Sefris, and Randal from the Starter Heroes compendium. This is my attempt to select Zanna from the same with a Passive Perception of 13. I will also note that Morthos also was hidden previously, but I rerolled their stealth and deleted the hidden condition manually and now they appear again. It looks like their previous stealth flags are somehow not being scrubbed properly.


lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Black Dragon Wyrmling' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Black Dragon Wyrmling' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (5.1) Is true, 'Zanna' can see 'Black Dragon Wyrmling' 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Zanna' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Seiren' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Seiren' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (5.1) Is true, 'Zanna' can see 'Seiren' 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Zanna' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Page' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Page' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (4) Is true, 'Zanna' can see 'Page' 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Zanna' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Sefris' with targetVisionLevels = [
{
         "visionName": "Hidden (CV)",
         "visionIcon": "modules/conditional-visibility/icons/hidden.jpg",
         "visionId": "hidden",
         "visionLevelValue": 20,
         "visionType": "condition",
         "visionIsDisabled": false,
         "visionPath": "",
         "visionElevation": false,
         "visionTargets": [],
         "visionSources": []
     }
 ] 
lib.js:76 DEBUG | conditional-visibility | FINAL => 'Zanna' can't see 'Sefris' 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Zanna' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Randal' with targetVisionLevels = [
    {
        "visionName": "Hidden (CV)",
        "visionIcon": "modules/conditional-visibility/icons/hidden.jpg",
        "visionId": "hidden",
        "visionLevelValue": 19,
        "visionType": "condition",
        "visionIsDisabled": false,
        "visionPath": "",
        "visionElevation": false,
        "visionTargets": [],
        "visionSources": []
    }
 ] 
lib.js:76 DEBUG | conditional-visibility | FINAL => 'Zanna' can't see 'Randal' 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Zanna' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Morthos' with targetVisionLevels = [
   {
        "visionName": "Hidden (CV)",
        "visionIcon": "modules/conditional-visibility/icons/hidden.jpg",
        "visionId": "hidden",
        "visionLevelValue": 3,
        "visionType": "condition",
        "visionIsDisabled": false,
        "visionPath": "",
        "visionElevation": false,
        "visionTargets": [],
        "visionSources": []
    }
] 
lib.js:76 DEBUG | conditional-visibility | (8) Is true, 'Zanna' can see 'Morthos' 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Zanna' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Micah' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Micah' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (4) Is true, 'Zanna' can see 'Micah' 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Zanna' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Aoth' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Aoth' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (4) Is true, 'Zanna' can see 'Aoth' 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Zanna' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Zanna' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Akra' with targetVisionLevels = [
    {
        "visionName": "Hidden (CV)",
        "visionIcon": "modules/conditional-visibility/icons/hidden.jpg",
        "visionId": "hidden",
        "visionLevelValue": 20,
        "visionType": "condition",
        "visionIsDisabled": false,
        "visionPath": "",
        "visionElevation": false,
        "visionTargets": [],
        "visionSources": []
    }
] 
lib.js:76 DEBUG | conditional-visibility | FINAL => 'Zanna' can't see 'Akra' ```
TergusI commented 2 years ago

Same issue here. For me, it happens only with tokens that previously had some flags ("hidden", "see invisible", etc)... Even with flags deleted, these tokens remain "disappearing" for the others.

rinnocenti commented 2 years ago

Same issue here in new version becomes more evident when the selected token is viewing a token where there was fog or partial shadow.

https://user-images.githubusercontent.com/3178127/161403713-5aacfa66-cbbf-473b-ba86-8146f5c888ba.mp4

p4535992 commented 2 years ago

@rinnocenti cannot replicate, but i discovered some bugs related to the fog exploration, maybe they stem from the same problem, try out 0.5.34

shinkei13 commented 2 years ago

@p4535992 Unfortunately, it seems that neither 0.5.35 nor 0.5.34 have fixed my issue. Even deleting all Actors and reimporting them from the "Starter Heroes" compendium from dnd5e seems to not solve the issue.

I'm getting the following errors in the console:


lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Perrin' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Morthos' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Perrin' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (4.5) Is false, 'Morthos' can see 'Perrin' 
lib.js:76 DEBUG | conditional-visibility | (20) Target 'Perrin' is not visible to at least one of the following sources [Morthos] 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Morthos' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Merric' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Morthos' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Merric' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (4.5) Is false, 'Morthos' can see 'Merric' 
lib.js:76 DEBUG | conditional-visibility | (20) Target 'Merric' is not visible to at least one of the following sources [Morthos] 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Morthos' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Quillathe' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Morthos' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Quillathe' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (4.5) Is false, 'Morthos' can see 'Quillathe' 
lib.js:76 DEBUG | conditional-visibility | (20) Target 'Quillathe' is not visible to at least one of the following sources [Morthos] 
lib.js:76 DEBUG | conditional-visibility | (3.4) no 'datasenses' found on 'Morthos' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.5) no 'dataconditions' found on 'Akra' you must refresh the senses/conditions on this token, try to modify some CV value, for now we recalculate the value 
lib.js:76 DEBUG | conditional-visibility | (3.6) 'Morthos' with sourceVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (3.7) 'Akra' with targetVisionLevels = [] 
lib.js:76 DEBUG | conditional-visibility | (4.4) Is true, 'Morthos' can see 'Akra' 
lib.js:76 DEBUG | conditional-visibility | (20) Target 'Akra' is visible to at least one of the following sources [Morthos] ```
p4535992 commented 2 years ago

Same issue here in new version becomes more evident when the selected token is viewing a token where there was fog or partial shadow. 2022-04-02_19-37-07.mp4

Hey @rinnocenti can you pass me the scene in question? I have a hard time replicating the error in my tests. If you want you can contact me at my discord account 4535992#1766

TergusI commented 2 years ago

After the last update (v.0.5.38), Conditional Visibility is OK here. No more bugs... Good job @p4535992

p4535992 commented 2 years ago

Thank you all for your patience, it took me longer than expected to understand how foundry works in certain parts of the code. I close this ticket but reopen it if the problem continues to persist.