BoltsJ / lancer-initiative

Implements Lancer's popcorn style initiative in Foundry VTT
https://foundryvtt.com/packages/lancer-initiative/
Apache License 2.0
4 stars 13 forks source link

Adding Token with conditions causes module lockup and locks out users from loading the scene [V12, PF2e System] #43

Closed Shteb closed 2 months ago

Shteb commented 2 months ago
Basic information - Lancer Initiative version: v28 - Foundry VTT version: v12.330 - Game system and version: Pathfinder Second Edition v6.2.0 - List of modules related to the combat tracker: - None, Lancer Initiative is the only module active on this Foundry instance

Description of the issue

When adding a token that has various PF2e conditions applied to the initiative, either by toggling combat stage or other means, the token is not added and further, the module locks up and ceases to function from then on until foundry reload.

This only occurs if the module in question has conditions applied. Most testing was done using the Unconscious condition.

To Reproduce Steps to reproduce the behaviour:

  1. Create a token.
  2. Place it on the canvas.
  3. Apply conditions to it, in my example Unconscious.
  4. Attempt to add it to initiative.

Expected behavior The token is added to the initiative tracker and appears in the initiative window.

Console output

Error: An error occurred while rendering LancerCombatTracker 29. Cannot read properties of undefined (reading '_id') at Hooks.onError (foundry.js:654:24) at foundry.js:5794:13 Caused by: TypeError: Cannot read properties of undefined (reading '_id') at ActiveEffectPF2e.fromEffect (pf2e.mjs:1580:197124) at pf2e.mjs:1608:47131 at Collection.map (foundry-esm.js:5098:26) at ActorConditions.map (pf2e.mjs:1:1847) at get temporaryEffects (pf2e.mjs:1608:47107) at LancerCombatTracker.getData (foundry.js:90245:45) at async LancerCombatTracker.getData (lancer-combat-tracker.js:29:11) at async LancerCombatTracker._render (foundry.js:5837:18) at async LancerCombatTracker._render (foundry.js:72744:5) onError @ foundry.js:655

Screenshots The below image show the conditions present that appear to be causing the module to fail. image

Additional context It is also worth noting that the canvas will fail to render entirely if trying to render a scene that has this issue currently present. The blow error is thrown when trying to load into a scene with a conditioned token that was attempted to be added to the Lancer Initiative. image

Additional contact info

On Discord as: lollypopunk

Thanks for your time!

BoltsJ commented 2 months ago

Unfortunately, this module isn't compatible with pf2e.

Shteb commented 2 months ago

Damn, appreciated all the same - I'll pray for a pf2e compatibility some day, as far as I can tell the conditions are the only thing broken - but otherwise thanks for replying c:

BoltsJ commented 2 months ago

Sadly, it's not a simple fix because both pf2e and this module are making changes in the same places on the combat stuff. I also can't simply wrap the pf2e implementation as I need to completely rework what happens when the turn is ended for example. At least that was the case last time I looked.