oOve / FollowMe

Follow Me is a module for Foundry VTT that allows tokens to follow or be followed by other tokens.
https://github.com/oOve/FollowMe
4 stars 3 forks source link

Console Warnings - Foundry V11 #10

Open ottyn opened 1 year ago

ottyn commented 1 year ago

Testing FollowMe in Foundry v11. Module works with some issues.

Issue 1: No longer get the popup notification on the token about follow distance. The token does correctly follow. Edit: Issue was with the core "Scrolling Text" option

Issue 2: Get the following warnings in console while moving around scene. Not running into walls or other objects. Does not seem to effect token movement, just the depreciated warning. image

ottyn commented 1 year ago

Barring this module being updated to include routinglib for pathfinding, I was able to update the code to work with the new "testCollision" function for V11. I replaced the following code in scripts/followme.mjs and tested in a new world and existing world.

Original followme.mjs: (lines 120-127)

if (game.settings.get(MOD_NAME, 'collisions')){
      let ray = new Ray( follower.center, utils.vAdd(new_pos, { x: follower.bounds.width/2, y: follower.bounds.height/2} ) );
      if (canvas.walls.checkCollision(ray, options={type: "move", mode: "any"})){
        stopFollowing(follower.document, token.name, true);
        // Do not apply update
        continue;
      }    
    }

New followme.mjs: (lines 120-126)

if (game.settings.get(MOD_NAME, 'collisions')){
      if (CONFIG.Canvas.polygonBackends.move.testCollision(follower.center, utils.vAdd(new_pos, { x: follower.bounds.width/2, y: follower.bounds.height/2} ), { type: "move", mode: "any" })) {
        stopFollowing(follower.document, token.name, true);
        // Do not apply update
        continue;
      }    
    }

I also changed the default follow key (line 234) to KeyL since KeyF is is now used by the default system.