Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Players cannot navigate back to scene with terrain layer after navigating away #126

Open
IHaveThatPower opened this issue Jan 16, 2023 · 4 comments

Comments

@IHaveThatPower
Copy link

Describe the bug
On a Scene with a polygonal terrain layer drawn, players cannot navigate away from the Scene (to another Scene) and then back. When they try to navigate back to the Scene with the terrain layer, they encounter the message:

User <the user's name> lacks permission to update Scene [<scene ID>]

This occurs even when Enhanced Terrain Layer is the only module activated.

To Reproduce
Steps to reproduce the behavior:
0. Use the dnd5e system, if that's relevant.

  1. Create a Scene ("Terrain Scene").
  2. Set the Scene Permissions to "Show In Navigation" and "GM Only" (this setting does not actually change the issue, but is provided for completeness, since this was the setup when the issue was first experienced)
  3. Make "Terrain Scene" the Active scene.
  4. Create a new Scene ("Map Scene")
  5. Set the Scene Permissions to "Show In Navigation" and "All Players"
  6. In Terrain Scene, draw a shape on the Terrain Layer.
  7. Set the shape's cost to 2, Environment Swamp. Leave "Inactive" and "Locked" unchecked. Make no selection for "Obstacle."
  8. Place a player-owned token in the scene.
  9. As a GM, hop back and forth between "Terrain Scene" and "Map Scene", with no issue.
  10. Connect as a player, who owns the player-owned token in "Terrain Scene". Player should load into "Terrain Scene" without issue.
  11. As the player, switch to "Map Scene". Player should switch to "Map Scene" with no issue.
  12. As the player, try to now switch back to "Terrain Scene".

Steps 11-12 may need to be repeated a few times to trigger the issue.

Expected behavior
Player should be able to switch back to the Active scene with a terrain layer, after switching away from it, without being confronted with permission issues.

Please complete as much of the following information as possible:

  • Chrome Version 108.0.5359.124 (Official Build) (64-bit), though other users experienced it with a variety of browsers
  • Foundry Version 10.291
  • System D&D5e 2.1.2
  • Enhanced Terrain Layer version 10.6
  • Console errors noted below
  • Occurs even when Enhanced Terrain Layer is the only active module.

Console Errors

foundry.js:59187 User <user> lacks permission to update Scene [<scene ID>]
fetch @ foundry.js:59187
15:41:12.177 foundry.js:747 Error: <user> lacks permission to update Scene [<scene ID>]
[No packages detected]
    at ServerDatabaseBackend._updateDocuments (<foundry path>/resources/app/dist/database/backend/server-backend.mjs:1:3830)
    at async Semaphore._try (<foundry path>/resources/app/common/utils/semaphore.mjs:101:17)
onError @ foundry.js:747
15:41:12.179 foundry.js:59187 Canvas drawing failed: User <user> lacks permission to update Scene [<scene ID>]
fetch @ foundry.js:59187
15:41:12.209 foundry.js:30889 Uncaught (in promise) TypeError: Cannot set properties of null (setting 'visible')
[Detected 1 package: enhanced-terrain-layer]
    at TerrainLayer._deactivate (foundry.js:30889:26)
    at TerrainLayer._deactivate (terrainlayer.js:414:15)
    at TerrainLayer.deactivate (foundry.js:30474:10)
    at TokenLayer.activate (foundry.js:30438:76)
    at #initializeCanvasLayer (foundry.js:23846:11)
    at #initialize (foundry.js:23796:32)
    at Canvas.draw (foundry.js:23689:29)
    at async Scene.view (foundry.js:20901:7)```
@IHaveThatPower
Copy link
Author

Update: This appears to occur specifically when no color has been defined for the terrain. If one is supplied (e.g. #000000), the error no longer occurs. Perhaps something is attempting to set a default value in the absence of one, even when it does not have permission to do so?

@aWinglessMonkey
Copy link

This occurs for me regardless of whether I provide a colour for the terrain objects (or any other value). It is definitely related, however, to the existence of terrain objects in the scene to which a player is returning, because I've not been able to find another means of avoiding it other than removing all of them.

@aWinglessMonkey
Copy link

aWinglessMonkey commented Apr 10, 2023

Addendum: this bug makes very little sense. After toying with a single bare-bones scene and a few new terrain objects for 15 minutes with no luck, and then cleaning all of them up and putting all the scene settings back to their defaults, that one scene no longer causes issues when it has terrain objects.

Sometimes the bug also doesn't happen when the GM navigates back to an affected scene from another first, before the player does, while the player is logged in. It appears this needs to be done every single time the player navigates away from the affected scene, prior to them navigating back themselves.

Note that this issue can happen even when the GM is pulling a player back into a scene themselves . It doesn't appear to happen when activating a scene, even when pulling to a scene otherwise would (including when the GM is already viewing that scene).

Superfluous edit: also I had it happen to me as the GM once, somehow. I cannot reproduce that and don't really want to.

Yet another edit: sometimes restarting a world stops it from happening for a while entirely. Is this dependent on sever-uptime somehow? Only seems to take a few minutes before some scene or another starts doing it.

@aWinglessMonkey
Copy link

This occurs for me regardless of whether I provide a colour for the terrain objects (or any other value). It is definitely related, however, to the existence of terrain objects in the scene to which a player is returning, because I've not been able to find another means of avoiding it other than removing all of them.

Possible correction to this: it doesn't seem to take effect until a server restart. The player's client restarting is not enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants