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 19 forks source link

[BUG] - Unexpected behavior between repeats() and waitUntilFinished() #178

Closed BenIsWassily closed 1 year ago

BenIsWassily commented 1 year ago

Describe the bug Using this macro :

let inRepetitions = 3;
let inRepeatDelayMin = 500;

let target = Array.from(game.user.targets)[0];  
    new Sequence()
    .effect()
    .file("jb2a.side_impact.part.slow.music_note.greenyellow")
    .atLocation(token)
    .rotateTowards(target)
    .scaleToObject(1.5)
    .randomizeMirrorY()
    .repeats(inRepetitions, inRepeatDelayMin)
    .waitUntilFinished(-100000)

.effect()
    .file("jb2a.side_impact.part.shockwave.yellow")
    .atLocation(token)
    .rotateTowards(target)
    .scaleToObject(1.5)
    .repeats(inRepetitions, inRepeatDelayMin)
.play()

I'm trying to play simultaneously two .effect() with the same number of repetitions and delay between repetitions.

Normally .waitUntilFinished(-100000) would not be needed, but I want to create a configurable macros with arguments to call it with automated animations. Setting a huge negative value should "disable" it when not needed (maybe there is a better way to do it?). Unfortunately, it seems to have an undesired side effect with .repeats(). Both .effect() are not playing simultaneously.

Changing the value for inRepeatDelayMin to 0, seems to behave as intended (everything is fired at once), but when a positive value is set, a delay between the two .effect() occurs (it seems to be equal to two times the value set in this case).

01.webm Without .waitUntilFinished(-100000)

02.webm With .waitUntilFinished(-100000) and any positive value set for repeatsDelay

03.webm With .waitUntilFinished(-100000) and repeatsDelay = 0

To Reproduce Steps to reproduce the behavior:

  1. Copy the code and create a macro on FoundryVTT with it.
  2. Select a token a source and target another token.
  3. Execute the macro

Expected behavior I would expect that setting a huge value to .waitUntilFinished() should not change the behavior of the effect .repeats()

Setup:

Active modules:

Haxxer commented 1 year ago

As discussed, won't fix this due to the complex issues surrounding adjusting this in the core waiting code