caewok / fvtt-token-visibility

Advanced token visibility rules for Foundry VTT
MIT License
4 stars 8 forks source link

Errors when selecting any token on a scene created before 0.6.0 #74

Closed Zamrod closed 7 months ago

Zamrod commented 8 months ago

When I open a scene I created previously and select a token, I am getting the following errors in the console and then it doesn't allow me to select tokens at all anymore in the scene until I switch to a new scene and back again:

undry.js:753 TypeError: Error thrown in hooked function 'initializeVisionSourceShaders' for hook 'initializeVisionSourceShaders'. this.constructor.ALGORITHM_CLASS[algorithm] is not a constructor
[Detected 2 packages: tokenvisibility, lib-wrapper]
    at new LOSCalculator (LOSCalculator.js:76:17)
    at Object.initializeVisionSourceShaders [as fn] (VisionSource.js:28:24)
    at #call (foundry.js:730:20)
    at Hooks.callAll (foundry.js:687:17)
    at #initializeShaders (foundry.js:44005:11)
    at VisionSource._configure (foundry.js:43916:30)
    at VisionSource._configure (foundry.js:44932:18)
    at VisionSource.initialize (foundry.js:43546:10)
    at 🎁call_wrapped [as call_wrapped] (libWrapper-wrapper.js:507:22)
    at VisionSource.initialize (VisionSource.js:20:10)
    at 🎁VisionSource.prototype.initialize#0 (libWrapper-wrapper.js:187:52)
    at Token5e.updateVisionSource (foundry.js:54820:19)
    at CanvasVisibility.initializeSources (foundry.js:38060:13)
    at PerceptionManager.applyRenderFlags (foundry.js:50386:61)
    at #applyRenderFlags (foundry.js:27811:44)
    at nn.emit (index.js:89:1)
    at Dt.update (index.js:89:1)
    at Dt._tick (index.js:89:1)
onError @ foundry.js:753
🎁call_wrapped @ libWrapper-wrapper.js:507
🎁Hooks.onError#lib-wrapper @ listeners.js:138
🎁Hooks.onError#0 @ libWrapper-wrapper.js:187
#call @ foundry.js:734
callAll @ foundry.js:687
#initializeShaders @ foundry.js:44005
_configure @ foundry.js:43916
_configure @ foundry.js:44932
initialize @ foundry.js:43546
🎁call_wrapped @ libWrapper-wrapper.js:507
initialize @ VisionSource.js:20
🎁VisionSource.prototype.initialize#0 @ libWrapper-wrapper.js:187
updateVisionSource @ foundry.js:54820
initializeSources @ foundry.js:38060
applyRenderFlags @ foundry.js:50386
#applyRenderFlags @ foundry.js:27811
emit @ index.js:89
update @ index.js:89
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
requestAnimationFrame (async)
Dt._tick @ index.js:89
libWrapper-wrapper.js:513 Uncaught TypeError: undefined. Cannot read properties of undefined (reading '_updateConfiguration')
[Detected 2 packages: tokenvisibility, lib-wrapper]
    at DetectionModeBasicSight._testLOS (DetectionMode.js:71:11)
    at 🎁DetectionMode.prototype._testLOS#0 (libWrapper-wrapper.js:187:52)
    at DetectionModeBasicSight._testPoint (DetectionModeBasicSight.js:84:13)
    at 🎁DetectionModeBasicSight.prototype._testPoint#0 (libWrapper-wrapper.js:187:52)
    at foundry.js:49652:36
    at Array.some (<anonymous>)
    at DetectionModeBasicSight.testVisibility (foundry.js:49652:18)
    at 🎁call_wrapped [as call_wrapped] (libWrapper-wrapper.js:507:22)
    at DetectionModeBasicSight.testVisibility (DetectionMode.js:37:10)
    at 🎁DetectionMode.prototype.testVisibility#0 (libWrapper-wrapper.js:187:52)
    at CanvasVisibility.testVisibility (foundry.js:38552:39)
    at 🎁call_wrapped [as call_wrapped] (libWrapper-wrapper.js:507:22)
    at CanvasVisibility.testVisibility (CanvasVisibility.js:26:10)
    at 🎁CanvasVisibility.prototype.testVisibility#0 (libWrapper-wrapper.js:187:52)
    at get isVisible [as isVisible] (foundry.js:54639:38)
    at Token5e._refreshVisibility (foundry.js:55052:25)
    at CanvasVisibility.restrictVisibility (foundry.js:38476:9)
    at CanvasVisibility.refresh (foundry.js:38311:10)
    at PerceptionManager.applyRenderFlags (foundry.js:50398:58)
    at #applyRenderFlags (foundry.js:27811:44)
    at nn.emit (index.js:89:1)
    at Dt.update (index.js:89:1)
    at Dt._tick (index.js:89:1)
_
ken.js:39 Uncaught (in promise) TypeError: undefined. Cannot read properties of undefined (reading 'calc')
[Detected 1 package: tokenvisibility]
    at Object.controlTokenDebugHook [as fn] (Token.js:39:50)
    at #call (foundry.js:730:20)
    at Hooks.callAll (foundry.js:687:17)
    at Token5e.release (foundry.js:28685:11)
    at Token5e.control (foundry.js:28640:29)
    at Token5e._onClickLeft (foundry.js:29042:15)
    at Token5e._onClickLeft (foundry.js:56254:11)
    at MouseInteractionManager.callback (foundry.js:31766:17)
    at #handleClickLeft (foundry.js:31954:15)
    at #handleMouseDown (foundry.js:31939:38)
    at Na.notifyListeners (earcut.js:128:75)
    at Na.notifyTarget (earcut.js:128:75)
    at Na.propagate (earcut.js:128:75)
    at Na.dispatchEvent (earcut.js:128:75)
    at Na.mapPointerDown (earcut.js:128:75)
    at Na.mapEvent (earcut.js:128:75)
    at yn.onPointerDown (earcut.js:128:75)
caewok commented 7 months ago

I made a change to catch if the algorithm is not defined in v0.6.1, which might solve the issue? I could not replicate the error, so I am guessing a bit here.