fvtt-fria-ligan/twilight2000-foundry-vtt

Token Options generates an error with Player Crew present

Opened this issue · 1 comments

Describe the Bug

A rendering error is generated when you try to access a vehicle token's Gear icon options if players are in the crew slots.

Severity

  • Medium (minor functional impact)

Context

Trying to open options for a token with a vehicle with crew.

To Reproduce

  1. Steps to reproduce the behavior:
  2. Start a new world.
  3. Load the T2K4E Core Modules.
  4. Begin Import.
  5. Close Welcome Journal Entry.
  6. Select Actors Sidebar.
  7. Expand Core Set folder.
  8. Expand Vehicles folder.
  9. Expand US Military Vehicles folder.
  10. Scroll down to M998 HMMWV, right click and Duplicate.
  11. Drag Actor M998 HMMWV (Copy) to the Welcome to Twilight: 2000 Scene.
  12. Create Actor - Player Character with any name.
  13. Create Actor - Player Character with any other name.
  14. Open M998 HMMWV (Copy) Actor Sheet and drag both Player Actors onto the Crew tab.
  15. Drag the M998 HMMWV (Copy) Actor Sheet to the Scene to create a Token.
  16. Right click on the Token and click the Gear for Token Options.
  17. The RangeError: an error occurred while rendering error will appear after a few seconds.

Double click the Token and remove the Player Actors.
Now you're able to access Token Options again.

This happens if the Token is Unlinked or Linked Actor Data status. If the Players are placed in the Vehicle Actor Sheet via Token or Sidebar.

I was able to replicate this several times in initial testing

Eventually testing this locked up Foundry entirely resulting in a "Render process gone" error and complete crash of Foundry.

After I restarted Foundry and loaded back into the game I was unable to replicate the issue, even with a new vehicle or the pre-configured vehicle! Argh.

Expected Behavior

Able to open the token options panel without error.

Screenshots

https://cdn.discordapp.com/attachments/751202281172762675/910401726081802250/unknown.png
https://cdn.discordapp.com/attachments/751202281172762675/910401961982066738/unknown.png
https://cdn.discordapp.com/attachments/751202281172762675/910402480628703282/unknown.png

Additional Context

Thanks @kylania for your detailed report.

I can also reproduce the bug, but after insisting multiple times and clicking more buttons (visibility toggle, status effects, etc).. it disappeared.

The getTrackedAttributes function is native from Foundry. It gets an Array of attribute choices which could be tracked for Actors in the Combat Tracker.

I think the problem lies in that this function looks for tracked attributes in the whole vehicle data, including occupants, but it looks like that's too much inception for this function.

I'll report the bug to Foundry to see if it's an unexpected behavior from their native function and how I can prevent that from happening with the vehicle system.