grandseiken / foundryvtt-multilevel-tokens

Multilevel tokens for Foundry VTT
MIT License
41 stars 20 forks source link

Numerous errors with other modules when cloning tokens across different scenes #145

Open GambetTV opened 1 year ago

GambetTV commented 1 year ago

When I set up an area for Token Cloning, where the Source is on Scene A and the Target is on Scene B, I get multiple console errors revealing incompatibilities with other modules. This occurs on both v10 and v11 of Foundry.

The modules it has issues with is About Face, Template Macro, and Token Attacher. You can disable any one or two of these modules and the error will remain for whatever's left, so it's not an issue between those three macros, the source is Multilevel Tokens.

This error occurs in v10 when a token first steps onto a drawing set to Source:

TypeError: Error thrown in hooked function '' for hook 'createToken'. Cannot read properties of null (reading 'name') [Detected 1 package: about-face] at drawAboutFaceIndicator (logic.js:188:78) at Object.fn (about-face.js:46:61) at #call (foundry.js:724:20) at Hooks.callAll (foundry.js:681:17) at ClientDatabaseBackend.callback (foundry.js:12613:13) at foundry.js:12594:43 at Array.map () at ClientDatabaseBackend._handleCreateEmbeddedDocuments (foundry.js:12594:33) at ClientDatabaseBackend._createEmbeddedDocuments (foundry.js:12499:17) at async TokenDocument5e.createDocuments (commons.js:6110:23)

This error occurs in the same circumstances, but on v11:

TypeError: Error thrown in hooked function 'bound _onCreateToken' for hook 'createToken'. Cannot set property actor of # which has only a getter [Detected 1 package: multilevel-tokens] at MultilevelTokens._onCreateToken (multilevel.js:1524:19) at #call (foundry.js:730:20) at Hooks.callAll (foundry.js:687:17) at ClientDatabaseBackend.callback (foundry.js:13538:13) at foundry.js:13510:43 at Array.map () at #handleCreateDocuments (foundry.js:13510:33) at async TokenDocument5e.createDocuments (commons.js:7849:23)

These errors occur in v10 when a token is already in a Source drawing area, and moves or adjusts its facing:

foundry.js:747 TypeError: Error thrown in hooked function '' for hook 'updateToken'. Cannot read properties of null (reading 'name') [Detected 1 package: about-face] at drawAboutFaceIndicator (logic.js:188:78) at Object.fn (about-face.js:47:70) at #call (foundry.js:724:20) at Hooks.callAll (foundry.js:681:17) at ClientDatabaseBackend.callback (foundry.js:12824:13) at foundry.js:12804:43 at Array.map () at ClientDatabaseBackend._handleUpdateEmbeddedDocuments (foundry.js:12804:33) at ClientDatabaseBackend._updateEmbeddedDocuments (foundry.js:12672:17) at async TokenDocument5e.updateDocuments (commons.js:6153:23) onError @ foundry.js:747 🎁call_wrapped @ libWrapper-wrapper.js:507 🎁Hooks.onError#lib-wrapper @ listeners.js:138 🎁Hooks.onError#0 @ libWrapper-wrapper.js:187

call @ foundry.js:728

callAll @ foundry.js:681 callback @ foundry.js:12824 (anonymous) @ foundry.js:12804 _handleUpdateEmbeddedDocuments @ foundry.js:12804 _updateEmbeddedDocuments @ foundry.js:12672 await in _updateEmbeddedDocuments (async) update @ commons.js:6795 await in update (async) updateDocuments @ commons.js:6153 updateEmbeddedDocuments @ commons.js:6346 🎁call_wrapped @ libWrapper-wrapper.js:507 updateEmbeddedDocuments @ terrain-main.js:97 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Scene.prototype.updateEmbeddedDocuments#0 @ libWrapper-wrapper.js:189 (anonymous) @ multilevel.js:791 Promise.then (async) _execute @ multilevel.js:791 batched @ multilevel.js:847 _queueAsync @ multilevel.js:855 _onUpdateToken @ multilevel.js:1563

call @ foundry.js:724

callAll @ foundry.js:681 callback @ foundry.js:12824 (anonymous) @ foundry.js:12804 _handleUpdateEmbeddedDocuments @ foundry.js:12804 _updateEmbeddedDocuments @ foundry.js:12672 await in _updateEmbeddedDocuments (async) update @ commons.js:6795 await in update (async) updateDocuments @ commons.js:6153 updateEmbeddedDocuments @ commons.js:6346 🎁call_wrapped @ libWrapper-wrapper.js:507 updateEmbeddedDocuments @ terrain-main.js:97 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Scene.prototype.updateEmbeddedDocuments#0 @ libWrapper-wrapper.js:189 animateEntities @ foundry_imports.js:94 moveEntities @ foundry_imports.js:47 await in moveEntities (async) onEntityDragLeftDrop @ main.js:176 🎁Token.prototype._onDragLeftDrop#drag-ruler @ main.js:81 🎁call_wrapper @ libWrapper-wrapper.js:616 onDragLeftDrop @ terrain-main.js:503 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Token.prototype._onDragLeftDrop#0 @ libWrapper-wrapper.js:189 callback @ foundry.js:27813 _handleDragDrop @ foundry.js:28214 _handleMouseUp @ foundry.js:28184 a.emit @ index.js:181 r.dispatchEvent @ interaction.min.mjs:8 r.processPointerUp @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.findHit @ interaction.min.mjs:8 r.processInteractive @ interaction.min.mjs:8 r.onPointerComplete @ interaction.min.mjs:8 r.onPointerUp @ interaction.min.mjs:8 token-attacher.js:562 Uncaught (in promise) TypeError: undefined. Cannot read properties of undefined (reading 'document') [Detected 1 package: token-attacher] at TokenAttacher.UpdateAttachedOfToken (token-attacher.js:562:24) at Object.fn (token-attacher.js:233:81) at #call (foundry.js:724:20) at Hooks.callAll (foundry.js:681:17) at ClientDatabaseBackend.callback (foundry.js:12824:13) at foundry.js:12804:43 at Array.map () at ClientDatabaseBackend._handleUpdateEmbeddedDocuments (foundry.js:12804:33) at ClientDatabaseBackend._updateEmbeddedDocuments (foundry.js:12672:17) at async TokenDocument5e.updateDocuments (commons.js:6153:23) UpdateAttachedOfToken @ token-attacher.js:562 (anonymous) @ token-attacher.js:233

call @ foundry.js:724

callAll @ foundry.js:681 callback @ foundry.js:12824 (anonymous) @ foundry.js:12804 _handleUpdateEmbeddedDocuments @ foundry.js:12804 _updateEmbeddedDocuments @ foundry.js:12672 await in _updateEmbeddedDocuments (async) update @ commons.js:6795 await in update (async) updateDocuments @ commons.js:6153 updateEmbeddedDocuments @ commons.js:6346 🎁call_wrapped @ libWrapper-wrapper.js:507 updateEmbeddedDocuments @ terrain-main.js:97 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Scene.prototype.updateEmbeddedDocuments#0 @ libWrapper-wrapper.js:189 (anonymous) @ multilevel.js:791 Promise.then (async) _execute @ multilevel.js:791 batched @ multilevel.js:847 _queueAsync @ multilevel.js:855 _onUpdateToken @ multilevel.js:1563

call @ foundry.js:724

callAll @ foundry.js:681 callback @ foundry.js:12824 (anonymous) @ foundry.js:12804 _handleUpdateEmbeddedDocuments @ foundry.js:12804 _updateEmbeddedDocuments @ foundry.js:12672 await in _updateEmbeddedDocuments (async) update @ commons.js:6795 await in update (async) updateDocuments @ commons.js:6153 updateEmbeddedDocuments @ commons.js:6346 🎁call_wrapped @ libWrapper-wrapper.js:507 updateEmbeddedDocuments @ terrain-main.js:97 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Scene.prototype.updateEmbeddedDocuments#0 @ libWrapper-wrapper.js:189 animateEntities @ foundry_imports.js:94 moveEntities @ foundry_imports.js:47 await in moveEntities (async) onEntityDragLeftDrop @ main.js:176 🎁Token.prototype._onDragLeftDrop#drag-ruler @ main.js:81 🎁call_wrapper @ libWrapper-wrapper.js:616 onDragLeftDrop @ terrain-main.js:503 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Token.prototype._onDragLeftDrop#0 @ libWrapper-wrapper.js:189 callback @ foundry.js:27813 _handleDragDrop @ foundry.js:28214 _handleMouseUp @ foundry.js:28184 a.emit @ index.js:181 r.dispatchEvent @ interaction.min.mjs:8 r.processPointerUp @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.recursiveFindHit @ interaction.min.mjs:8 t.findHit @ interaction.min.mjs:8 r.processInteractive @ interaction.min.mjs:8 r.onPointerComplete @ interaction.min.mjs:8 r.onPointerUp @ interaction.min.mjs:8 hooks.mjs:28 Uncaught (in promise) TypeError: undefined. Cannot read properties of null (reading 'animationName') [Detected 1 package: templatemacro] at Object._updateToken [as fn] (hooks.mjs:28:54) at #call (foundry.js:724:20) at Hooks.callAll (foundry.js:681:17) at ClientDatabaseBackend.callback (foundry.js:12824:13) at foundry.js:12804:43 at Array.map () at ClientDatabaseBackend._handleUpdateEmbeddedDocuments (foundry.js:12804:33) at ClientDatabaseBackend._updateEmbeddedDocuments (foundry.js:12672:17) at async TokenDocument5e.updateDocuments (commons.js:6153:23)

In v11 the errors are similar:

foundry.js:753 TypeError: Error thrown in hooked function '' for hook 'updateToken'. Cannot read properties of null (reading 'actor') [Detected 1 package: about-face] at drawAboutFaceIndicator (logic.js:146:9) at Object.fn (about-face.js:71:70) at #call (foundry.js:730:20) at Hooks.callAll (foundry.js:687:17) at ClientDatabaseBackend.callback (foundry.js:13670:13) at foundry.js:13643:43 at Array.map () at #handleUpdateDocuments (foundry.js:13643:33) at async TokenDocument5e.updateDocuments (commons.js:7892:23) 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 callback @ foundry.js:13670 (anonymous) @ foundry.js:13643

handleUpdateDocuments @ foundry.js:13643

await in #handleUpdateDocuments (async) _updateDocuments @ foundry.js:13392 await in _updateDocuments (async) update @ commons.js:8568 await in update (async) updateDocuments @ commons.js:7892 updateEmbeddedDocuments @ commons.js:8124 🎁call_wrapped @ libWrapper-wrapper.js:507 updateEmbeddedDocuments @ terrain-main.js:97 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Scene.prototype.updateEmbeddedDocuments#0 @ libWrapper-wrapper.js:189 (anonymous) @ multilevel.js:791 Promise.then (async) _execute @ multilevel.js:791 batched @ multilevel.js:847 _queueAsync @ multilevel.js:855 _onUpdateToken @ multilevel.js:1563

call @ foundry.js:730

callAll @ foundry.js:687 callback @ foundry.js:13670 (anonymous) @ foundry.js:13643

handleUpdateDocuments @ foundry.js:13643

await in #handleUpdateDocuments (async) _updateDocuments @ foundry.js:13392 await in _updateDocuments (async) update @ commons.js:8568 await in update (async) updateDocuments @ commons.js:7892 updateEmbeddedDocuments @ commons.js:8124 🎁call_wrapped @ libWrapper-wrapper.js:507 updateEmbeddedDocuments @ terrain-main.js:97 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Scene.prototype.updateEmbeddedDocuments#0 @ libWrapper-wrapper.js:189 animateEntities @ foundry_imports.js:94 moveEntities @ foundry_imports.js:47 await in moveEntities (async) onEntityDragLeftDrop @ main.js:176 🎁Token.prototype._onDragLeftDrop#drag-ruler @ main.js:81 🎁call_wrapper @ libWrapper-wrapper.js:616 onDragLeftDrop @ terrain-main.js:503 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Token.prototype._onDragLeftDrop#0 @ libWrapper-wrapper.js:189 callback @ foundry.js:31311

handleDragDrop @ foundry.js:31715

handleMouseUp @ foundry.js:31691

notifyListeners @ earcut.js:128 notifyTarget @ earcut.js:128 mapPointerUp @ earcut.js:128 mapEvent @ earcut.js:128 onPointerUp @ earcut.js:128 token-attacher.js:562 Uncaught (in promise) TypeError: undefined. Cannot read properties of undefined (reading 'document') [Detected 1 package: token-attacher] at TokenAttacher.UpdateAttachedOfToken (token-attacher.js:562:24) at Object.fn (token-attacher.js:233:81) at #call (foundry.js:730:20) at Hooks.callAll (foundry.js:687:17) at ClientDatabaseBackend.callback (foundry.js:13670:13) at foundry.js:13643:43 at Array.map () at #handleUpdateDocuments (foundry.js:13643:33) at async TokenDocument5e.updateDocuments (commons.js:7892:23) UpdateAttachedOfToken @ token-attacher.js:562 (anonymous) @ token-attacher.js:233

call @ foundry.js:730

callAll @ foundry.js:687 callback @ foundry.js:13670 (anonymous) @ foundry.js:13643

handleUpdateDocuments @ foundry.js:13643

await in #handleUpdateDocuments (async) _updateDocuments @ foundry.js:13392 await in _updateDocuments (async) update @ commons.js:8568 await in update (async) updateDocuments @ commons.js:7892 updateEmbeddedDocuments @ commons.js:8124 🎁call_wrapped @ libWrapper-wrapper.js:507 updateEmbeddedDocuments @ terrain-main.js:97 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Scene.prototype.updateEmbeddedDocuments#0 @ libWrapper-wrapper.js:189 (anonymous) @ multilevel.js:791 Promise.then (async) _execute @ multilevel.js:791 batched @ multilevel.js:847 _queueAsync @ multilevel.js:855 _onUpdateToken @ multilevel.js:1563

call @ foundry.js:730

callAll @ foundry.js:687 callback @ foundry.js:13670 (anonymous) @ foundry.js:13643

handleUpdateDocuments @ foundry.js:13643

await in #handleUpdateDocuments (async) _updateDocuments @ foundry.js:13392 await in _updateDocuments (async) update @ commons.js:8568 await in update (async) updateDocuments @ commons.js:7892 updateEmbeddedDocuments @ commons.js:8124 🎁call_wrapped @ libWrapper-wrapper.js:507 updateEmbeddedDocuments @ terrain-main.js:97 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Scene.prototype.updateEmbeddedDocuments#0 @ libWrapper-wrapper.js:189 animateEntities @ foundry_imports.js:94 moveEntities @ foundry_imports.js:47 await in moveEntities (async) onEntityDragLeftDrop @ main.js:176 🎁Token.prototype._onDragLeftDrop#drag-ruler @ main.js:81 🎁call_wrapper @ libWrapper-wrapper.js:616 onDragLeftDrop @ terrain-main.js:503 🎁call_wrapper @ libWrapper-wrapper.js:616 🎁Token.prototype._onDragLeftDrop#0 @ libWrapper-wrapper.js:189 callback @ foundry.js:31311

handleDragDrop @ foundry.js:31715

handleMouseUp @ foundry.js:31691

notifyListeners @ earcut.js:128 notifyTarget @ earcut.js:128 mapPointerUp @ earcut.js:128 mapEvent @ earcut.js:128 onPointerUp @ earcut.js:128 hooks.mjs:28 Uncaught (in promise) TypeError: undefined. Cannot read properties of null (reading 'animationName') [Detected 1 package: templatemacro] at Object._updateToken [as fn] (hooks.mjs:28:54) at #call (foundry.js:730:20) at Hooks.callAll (foundry.js:687:17) at ClientDatabaseBackend.callback (foundry.js:13670:13) at foundry.js:13643:43 at Array.map () at #handleUpdateDocuments (foundry.js:13643:33) at async TokenDocument5e.updateDocuments (commons.js:7892:23)

GorgoPrimus commented 1 year ago

I finally found out this was in fact what kept breaking all the auras in my pf2e game, both in V10 and now in V11. It's not playing nice with a lot of stuff there now.

TypeError: Error thrown in hooked function '' for hook 'createToken'. token is null [Detected 1 package: healthEstimate] anonymous https://X.moltenhosting.com/modules/healthEstimate/module/logic.js line 333 > Function:10 breakOverlayRender https://Xmoltenhosting.com/modules/healthEstimate/module/logic.js:343 addCharacter https://X.moltenhosting.com/modules/healthEstimate/lib/HealthMonitor.js:39

https://X.moltenhosting.com/modules/healthEstimate/healthEstimate.js:42 #call https://X.moltenhosting.com/scripts/foundry.js:730 callAll https://X.moltenhosting.com/scripts/foundry.js:687 callback https://X.moltenhosting.com/scripts/foundry.js:13570 documents https://X.moltenhosting.com/scripts/foundry.js:13542 #handleCreateDocuments https://X.moltenhosting.com/scripts/foundry.js:13542 Uncaught TypeError: this.token is null [Detected 1 package: pf2e-target-damage] get mystified https://X.moltenhosting.com/modules/pf2e-target-damage/module/target-damage.js:37 get name https://X.moltenhosting.com/modules/pf2e-target-damage/module/target-damage.js:46 https://X.moltenhosting.com/modules/pf2e-target-damage/module/target-damage.js:822 [target-damage.js:37:24](https://X.moltenhosting.com/modules/pf2e-target-damage/module/target-damage.js) get mystified https://X.moltenhosting.com/modules/pf2e-target-damage/module/target-damage.js:37 get name https://X.moltenhosting.com/modules/pf2e-target-damage/module/target-damage.js:46 https://X.moltenhosting.com/modules/pf2e-target-damage/module/target-damage.js:822

This is what happens whenever a token teleports with MLT to another scene, and all the auras on them break and will no longer update and add/remove effects from tokens that travel through it's range.

Nedrapter commented 1 year ago

Although not exactly the same errors, when I load v11 with multilevel tokens active and other modules, I get super-spammed with these errors: image image While the warning mentions mid-qol, it only happens when multilevel tokens is active.

Cptkirk30 commented 1 month ago

I am likewise receiving very similar errors with Foundry V12 image