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
47 stars 25 forks source link

[Request] Register effects #61

Closed dmrickey closed 2 years ago

dmrickey commented 2 years ago

I'd like to be able to register commonly used sequences that I can then call later - generally this would be more useful for mods (but in those cases a mod could basically create a file that houses those sequences), or it could be useful for someone who just has a lot of macros that manually (or via World Scripter or something similar) registers some sequences when they load the browser.

Example use, I run basically the following on every spell, swapping out the animation for the proper school and the color for whatever color I feel best matches the given spell.

        seq.effect()
            .file('jb2a.impact.004.dark_purple')
            .atLocation(casterToken)
            .fadeIn(500);
        seq.effect()
            .file('jb2a.extras.tmfx.runes.circle.simple.illusion')
            .atLocation(casterToken)
            .duration(2000)
            .fadeIn(500)
            .fadeOut(500)
            .scale(0.5)
            .filter("Glow", {
                color: 0x3c1361
            })
            .scaleIn(0, 500, {
                ease: "easeOutCubic"
            })
            .waitUntilFinished(-1000);

So what if I could do something like this

Sequencer.registerEffect('spellSchoolAnimation')
    .file('jb2a.extras.tmfx.runes.circle.simple.{{school}}')
    .duration(2000)
    .fadeIn(500)
    .fadeOut(500)
    .scale(0.5)
    .scaleIn(0, 500, {
        ease: "easeOutCubic"
    })
    .waitUntilFinished(-1000);

So that would register that effect as 'spellSchoolAnimation' and I could pull it out later to play it as is or add-on/modify to it.

seq.effect()
    .file('jb2a.impact.004.dark_purple')
    .atLocation(casterToken)
    .fadeIn(500);
seq.registeredEffect('spellSchoolAnimation')
    .setMustache({ school: 'illusion' })
    .atLocation(casterToken)
    .filter("Glow", {
        color: 0x3c1361
    });

An alternative I also thought about was instead of doing something like Sequencer.registerEffect('name')... you could do something like Sequencer.register('name').effect()... which would probably make it easier to register sounds, animations, etc. But with this it might also be less clear about what's being pulled out of the registry if the "get" method was just registered(name) instead of something like registeredEffect(name).

Haxxer commented 2 years ago

I have evaluated this, and come to the conclusion that it would require a large scale refactor for an arguably small feature. Thank you for the suggestion, but it's not viable at this point.