Eligarf / stealthy

A FoundryVTT module that adds perception vs stealth testing to Foundry's visibility tests
MIT License
3 stars 3 forks source link

Changing token settings creates extraneous Hidden effect on NPCs when Stealthy and Perceptive both active #132

Closed benjamin-ping-xu closed 6 months ago

benjamin-ping-xu commented 6 months ago

First off, thank you for this module, it is really cool and my players love it.

To be honest, I am not sure whether the origin of this issue is from Perceptive or Stealthy, but since the effect being applied is coming from Stealthy I thought I'd post here first.

Description: When changing certain token settings, a random "Hidden" effect is created with the description "Banked stealth roll", even though no stealth has been rolled.

Steps to recreate bug:

  1. Activate Stealthy and Perceptive modules
  2. In Perceptive module settings, enable 'Stealthy Integration'
  3. Enable 'Bank stealth rolls to actor' in Stealthy module settings
  4. Drag an NPC token onto a scene (does not matter if vision is enabled or not on scene)
  5. Modify the token's Light settings to add a light radius
  6. A 'Hidden' effect is automatically applied to the token image image

Changing token scale can also cause the Hidden effect to be applied. I have not fully tested every setting so this may not be comprehensive. There are also some specific NPC tokens that do not trigger this bug, but after testing for half an hour could not see any difference in the settings between tokens that trigger and do not trigger the bug.

If this Hidden effect is removed, subsequent modifications to token settings no longer trigger this bug. Also, if a Stealth check is made for the token before any token modifications, then changing token settings do not trigger this bug.

Notes:

Workarounds (?): Disabling 'Bank stealth rolls to actor' in Stealthy module settings causes the bug to disappear. Disabling 'Stealthy integration' in Perceptive module settings also causes the bug to disappear.

Eligarf commented 6 months ago

I'm glad the module has pleased some users!

My testing with another user yesterday points at this being an issue with Perceptive, and I'm not sure why it is issuing requests to Stealthy to bank a stealth value in these situations. Stealthy 4.0.7 release added logging to the specific API that Perceptive is using, you could try enabling Stealthy's logging at 'Log level' and then look at the F12 console output to see if you find entries like Stealthy | stealthy.bankStealth, as this function only gets called by things external to Stealthy. It would at least shed some light on the source of the issue. I audited the code yesterday, and as far as I can tell, Stealthy only has two routes to add a Hidden effect: rolling a skill check or receiving a stealthy.bankStealth call from an external source like Perceptive or a macro.

BTW, if you turn off banking stealth to actors, I bet after editing a token that you'll still find stealth values in the lower right of that Token's HUD. It just isn't showing you an effect. If this is not the case than there is a secondary issue inside Stealthy I need to figure out. Primary issue is still being caused by Perceptive I think.

I filed a bug with Perceptive #92

Eligarf commented 6 months ago

This behavior should be fixed with Perceptive v3.6.1