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] (Maybe). api.canSee returns true when rolled by a player, but false when rolled by a GM #41

Closed tposney closed 2 years ago

tposney commented 2 years ago

Module Version: v0.6.6

Before open any issue

When using midi-qol to check invisible/hidden advantage I use

game.modules.get('conditional-visibility')?.api?.canSee(target, token)

to check if the target can see the attacking token. This check returns false when the player is a GM, but true when a player rolls the attack. These are the exact same tokens, the only difference being the user doing the roll.

Am I doing something wrong?

p4535992 commented 2 years ago

@tposney No i made a big mistake when i rewrite the api methods, now it should be fine.

If you found more useful there is a method for pass only the token ids now (can be more usful for some macro). game.modules.get('conditional-visibility').api.canSeeFromTokenIds(sourceTokenIdOrName: string, targetTokenIdOrName: string)

Let me know for any other error.

Brimcon commented 2 years ago

As the one who issued the bug report to Midi, as of Conditional Visibility 0.6.9 and Midi 0.9.56 the error still occurs.

p4535992 commented 2 years ago

Can you enable the "Debug" module settings of the CV module, and pass to me the logs from the GM side and the player side ?

Brimcon commented 2 years ago

Here we go. GM View CV-1654537856392.log

Player Character CV-1654537803403.log

As an aside, the Hidden/Stealth Condition is not being removed upon attack by either Player or GM. Might be a Midi issue? @tposney

p4535992 commented 2 years ago

I'm not good enough for this kind of modules ...Made some bug fix again... hope to have solved this...

try out 0.6.10 and let me know it.

As an aside, the Hidden/Stealth Condition is not being removed upon attack by either Player or GM. Might be a Midi issue

no midi cannot know what effects to remove, it should check every single condition on the token, there is api method for that, but is a pain in the ass.

game.modules.get('conditional-visibility').api.canSeeWithData(sourceTokenIdOrName: string, targetTokenIdOrName: string) ⇒ CVResultData

in the current configuration @tposney use the canSee for check a boolean value, but maybe he can call for the 'unhide' feature the api method:

game.modules.get('conditional-visibility').api.unHide(tokens:Token[])

to force the array of tokens to be visible without know what kind of condition is hiding the token and wihout remove any effects (this is the advisable way because everyone can click by mistake and remove a bunch of effects) after a attack the token is setted with the flag "Force to be visible" and so it will visible until the checkbox is disabled on the token configuration.

Brimcon commented 2 years ago

Negative. STill prints this on Player's Debug

lib.js:113 DEBUG | conditional-visibility | (2) Is true, 'Acolyte' can see 'Gree' 
backend.mjs:306 Foundry VTT | Created ChatMessage with id [rLgIOY6xGuc9TLTJ]
lib.js:113 DEBUG | conditional-visibility | (2) Is true, 'Acolyte' can see 'Gree' 
p4535992 commented 2 years ago

@Brimcon for me is correct from what i read on the logs , export the two actos with the effects and i will check on my side, my discord account is 4535992#1766

p4535992 commented 2 years ago

@Brimcon k you are right, there it was a use case i miss, now it should work like expected on 0.6.11

Brimcon commented 2 years ago

It works! Thank you for fixing this. Now to find out why its not unhiding on attack but as you said before I think thats on Midi, not you! Bug fixed!

p4535992 commented 2 years ago

@Brimcon yea for that i open a ticket for a better integratrion with midi https://gitlab.com/tposney/midi-qol/-/issues/873