Tokenmagic icon indicating copy to clipboard operation
Tokenmagic copied to clipboard

[BUG] Cannot set properties of undefined (setting 'renderable')

Open Kayne opened this issue 1 year ago • 1 comments

Module Version: 0.6.3.1

Before open any issue

I wanted to enable debugging but no such option is available for Token Magic FX module.

Describe the bug When using Animate Dead spell "macro magic" from module Automated Animations, after choosing creature, the gray token appears but cannot be moved and all map canvas is freezed.

The error is raised from Token Magic FX module:

Uncaught TypeError: undefined. Cannot set properties of undefined (setting 'renderable')
[Detected 1 package: tokenmagic]
    at e.<anonymous> (settings.js:616:27)
    at a.emit (index.js:202:33)
    at r.dispatchEvent (interaction.min.mjs:8:12235)
    at r.processPointerMove (interaction.min.mjs:8:17255)
    at t.recursiveFindHit (interaction.min.mjs:8:4098)
    at t.findHit (interaction.min.mjs:8:4157)
    at r.processInteractive (interaction.min.mjs:8:12841)
    at r.onPointerMove (interaction.min.mjs:8:16687)

The original bug report from A-A module: https://github.com/otigon/automated-jb2a-animations/issues/666

To Reproduce Steps to reproduce the behavior:

  1. Use Animate Dead spell
  2. Choose Zombie Shambler for instance, but breaks on every creature
  3. Freeze!
  4. See error in console

Expected behavior No error, token should be placeable.

Browser: Browser & version doesn't matter, same behaviour on all

Foundry Version: 10.291

Game System: PF2e 4.12.9

Additional context Sequencer Version: 3.1.2 Automated Animations version 4.2.62 Hosting Location: nodejs on server

Active modules: Advanced Macros v; Autocomplete Whisper v; Automated Animations v; Award XP v; Cautious Gamemaster's Pack v; Chat Images v; Combat Enhancements v; Dice So Nice! v; Dice Tray v; Drag Ruler v; Enhanced Terrain Layer v; Escape Window v; Foundry VTT Anniversary Dice Set by The Rollsmith v; Health Estimate v; Image Hover v; Initiative Double Click v; Jam and Jax's NPC Ancestry Abilities v; Jam and Jax's NPC Index: Specialists v; Jam and Jax's NPC Index: Spellcaster v; Jam and Jax's NPC Index: Warriors v; JB2A - Patreon Complete Collection v; libWrapper v.0; LiveKit AVClient v; Pathfinder 2e: Abomination Vaults v; Pathfinder Beginner Box v; Pathfinder Token Pack: Bestiaries v; Pathmuncher: Pathbuilder character importer for PF2e v; Perfect Vision v; PF2e Animations v; PF2e Companion Compendia v; PF2e Dorako UI v; PF2e Drag Ruler Integration v; PF2E Exploration Effects v; PF2e Giveth v; pF2E Keybind Menagerie v; Pf2E Modifiers Matter v; PF2e Staves v; PF2e Target Damage v; PF2e Workbench v; Polyglot v; routinglib v; Safety Tools v; Sequencer v; socketlib v; Tidy UI - Game Settings v; Token Action HUD Classic v; Token Info Icons v; Tokenizer v; Token Magic FX v; Token Mold v; Warp Gate v;

Kayne avatar Jul 19 '23 15:07 Kayne

Source:

    Hooks.on("canvasReady", () => {
      canvas.stage.on("mousemove", event => {
        const {x: mx, y: my} = event.data.getLocalPosition(canvas.templates);
        for ( const template of canvas.templates.placeables ) {
          const hl = canvas.grid.getHighlightLayer(`MeasuredTemplate.${template.id}`);
          const opacity = template.document.getFlag("tokenmagic", "templateData")?.opacity ?? 1;
          if ( template.texture && template.texture !== "" ) {
            const {x: cx, y: cy} = template.center;
            const mouseover = template.shape.contains(mx - cx, my - cy);
            hl.renderable = mouseover;
            template.template.alpha = (mouseover ? 0.5 : 1.0) * opacity;
          }
          else {
            hl.renderable = true;
            template.template.alpha = opacity;
          }
        }
      });
    });
  }

and line:

            hl.renderable = true;

fails with Cannot set properties of undefined (setting 'renderable')

Kayne avatar Jul 30 '23 08:07 Kayne