SalieriC / SWIM

A collection of macros for the SWADE system on Foundry with a focus on immersion (i.e. by using sound effects)
GNU General Public License v3.0
10 stars 12 forks source link

[FEATURE] Add a setting to disable the Scene Control Buttons #121

Closed mclemente closed 1 year ago

mclemente commented 1 year ago

Please, add a setting to disable the Scene Control Buttons. I don't use them but there's no way to disable them.

Consider these options:

Here's how cluttered my Token Controls is with just 4 modules (Challenge Tracker, SWIM, Hourglass, Sequencer). Of those, I can disable Sequencer's or even move them to their own control button (the last button on the left) image

SalieriC commented 1 year ago

That you call cluttered? 🤣 But I hear ya, The combat setup button will probably go anyway (for now at least) as the code is somewhat buggy and hard to maintain. Then the only button left would be the plus (raise calculator). Would that still be too much for your taste? I'm not sure how easy it would be to add a new setting for this so I need to look into it.

mclemente commented 1 year ago

Considering the default is just the first 3 buttons, it is an issue when every module adds a button to I end up with 9.

For a setting you'd need to move register_settings up to the setup hook and move the Hook to getSceneControlButtons inside it.

Example:

Hooks.on('setup', () => {
  api.registerFunctions();
  register_settings();
  if (game.settings.get("swim", "addHudButtons") {
    Hooks.on('getSceneControlButtons', function (hudButtons) {
      swim_buttons(hudButtons)
    });
  }
})

You could also turn it into a keybind like this:

game.keybindings.register("swim", "raiseCalculator", {
        name: "SWIM.openRaiseCalculatorName",
        hint: "SWIM.openRaiseCalculatorHint",
        onDown: () => {
            // Entire onClick from the Calculator
        },
        restricted: true,
        precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,
    });

If you do, I advise you move the onClick to its own function so you don't duplicate code between the button and the keybind.

SalieriC commented 1 year ago

Well, I do understand your troubles but in the end I gave in as there is no better way in Foundry to handle this. Another category means the left side gets cluttered rather than the right. Regardless, I was also considering using DF Buttons instead but didn't made a decision yet. In general I'd like to reduce the number of dependencies rather than increasing it but I think this is a bit more elegant as it takes that away from the potentially cluttered bar. But since you're obviously capable of writing code, feel free to make a PR and I can add it to the module a lot more timely. =)

SalieriC commented 1 year ago

Done in Git. Thanks a lot for your work. =)