ironmonk88 / monks-combat-details

GNU General Public License v3.0
11 stars 7 forks source link

[Bug] When Passing a Turn While having the Foundry "Select Targets Tool" Selected, Provides Players Vision from selected targets in their turns. #71

Open Linruat opened 8 months ago

Linruat commented 8 months ago

When Passing a Turn While having the Foundry "Select Targets Tool" Selected, Provides Players Vision from selected targets on those targets' turns.

Steps to reproduce the behavior:

  1. As a player, select a target with the foundry select target tool during combat
  2. Pass the turn
  3. See what you shouldn't be able to see

Expected behavior Regardless of target selection method, the player should NOT gain the vision of the selected target

Screenshots What the character Should See: image

What the player can see, but shouldn't: image

Please complete as much of the following information as possible:

Additional context -Verified Players do NOT have any permissions for the suspect token -This issue does NOT occur if you have any tool other than "Select Targets" tool selected when you pass your turn.

ironmonk88 commented 7 months ago

Combat Details doesn't really mess around with visibility. It sounds like that might be a bug with Foundry.

Wolkei commented 7 months ago

One of my players had the exact same issue and we also narrowed it down to Combat Details using Find the Culprit.

The issue isn't related to vision itself, but rather the module selecting the token of the next person in combat upon passing the turn, even if you don't have access to that token. On top of being able to see that token's vision, this allows you to write in chat as their character and even use their features and spells through modules like Argon HUD.

I managed to reproduce the issue after I realized that this bug report and my player both use the targeting tool instead of pressing T on tokens.

Jragghen commented 7 months ago

I can verify this bug - we'd been seeing it for a while, so not sure when it's introduced, but I reproduced it in a world with no modules enabled except for this one and Action Pack, mostly because it's the easiest way to demonstrate the problem.

In this combat, Akra is the player, and Quillathe is the GM/enemy. Combat has started, and everything is as expected. The player does their turn, and it's still as expected.

Before

However, if the player has anything else targeted, when they end their turn, the selection focuses upon the new character which is not the player, and this (if using Action Pack) reveals their stats, etc in the left-hand tray. They can't DO anything from it (although they can see the inventory and abilities), although they CAN prematurely end the turn by clicking End Turn.

After

Other modules can similarly expose it (Always HP is one that comes to mind) but unless you've got something like these which retains information on the screen, the only real way to notice it is that the visibility swaps to the other person. If I were to add a wall between the two:

Vision

Akra will see with Quillathe's visibility when it goes to Quillathe's turn

I played around with it when doing this demonstration, and it's specifically the "Select Combatants" option (which is available to each user, not just the GM). It's selecting combatants they don't have ownership to, apparently if they're targeted. Toggling that option off in the player's session appears to disable the problem.

Jragghen commented 7 months ago

We tried a quick change:

            if (combat && combat.started && setting('select-combatant')) {
                combat?.combatant?.token?._object?.control();
            }

To:

            if (combat && combat.started && combat?.combatant?.token?.isOwner && setting('select-combatant')) {
                combat?.combatant?.token?._object?.control();
            }

seems to take care of it.