fantasycalendar / FoundryVTT-Sequencer

This module implements a basic pipeline that can be used for managing the flow of a set of functions, effects, sounds, and macros.
Other
41 stars 17 forks source link

[BUG] - Sequencer is returning a recursive error when used with warpgate and animated automations #216

Closed VacantFanatic closed 4 months ago

VacantFanatic commented 4 months ago

Describe the bug When automated animations is configured to use a template from warpgate (in CP RED Core). During the attack roll and prior to the OnClick to place the template sequencer gets stuck in a loop and stack size is exceeded by an uncaught error/

To Reproduce Steps to reproduce the behavior:

  1. Install: AA, WG, Sequencer, Advanced Macros and configure grenade ammo in AA
  2. Select a target.
  3. Roll an attack for a grenade (via launcher or thrown weapon).

Expected behavior A roll will take place. User will click a spot on the active scene. a 10x10 square template will display. a thrown grenade animation will play.

Screenshots image-1 image-2 image-3 Screenshot 2024-02-27 081511

Setup:

Active modules: Please see attached screenshots image

Additional context A different error is thrown when other ammunition types are used. Please see screen image-4

WarpgateSquareTemplate macro

const handler = args[1];
const inputData = args[2];
let config = {
  icon: "icons/svg/explosion.svg",
  rememberControlled: true,
  size: inputData.size,
  label: handler.item?.name || handler.animationData.label,
  drawIcon: true,
  drawOutline: true,
}

let position = await warpgate.crosshairs.show(config);

let tempSize = inputData.size * 2;

let hypDist = Math.sqrt((tempSize * tempSize) * 2)
let canvasDist = canvas.dimensions.distance;
let trueWidth = tempSize / canvasDist;
let gridSize = canvas.grid.size;
let trueX = position.x - ((trueWidth / 2) * gridSize);
let trueY = position.y - ((trueWidth / 2) * gridSize);

let templateInfo = {
 angle: 0,
 direction: 45,
 distance: hypDist ,
 fillColor: game.user.color,
 x: trueX,
 y: trueY,
 borderColor: "#000000",
 t: "rect",
}

canvas.scene.createEmbeddedDocuments("MeasuredTemplate", [templateInfo])
VacantFanatic commented 4 months ago

If the macro is only set to observer this won't function. PCs must be set to "Owner" AND the execute must be set to "Everyone"