PbtA's initial hooks are async and this can cause issues.
Of note, it can work erratically with Babele's babele.ready hook.
There is also a setTimeout(1000) to attempt to await for changes done to the pbtaSheetConfig hook.
What Changed?
Refactored the pbtaSheetConfig hook to pbta.sheetConfig for consistency with potential new hooks in the future.
Removed the sheetConfigOverride setting.
Removed async from ready hook, fixing some weird behavior caused by it.
Added warning for when 2+ modules that override sheets are active.
Unrelated Changes
Removed async from init hook.
Sheet Configuration button on both the sidebar and the settings config window if a module is overriding it.
Moved Playbook listing to setup.
How It Worked Before
- If an override exists and `sheetConfigOverride` was previously activated, load the override.
- Otherwise, load the original, if any.
- PbtA sets the `sheetConfigOverride` setting to false, calls the `pbtaSheetConfig` hook and awaits 1 second.
- If the setting has been turned on, the override is saved.
- Otherwise, delete any override and restore original config, if any.
- The config is then saved to settings.
How It Works Now
- PbtA checks if any module is flagged to override it.
- If an override exists and a module is flagged to override it, load the override.
- Otherwise, load the original, if any.
- PbtA calls the `pbta.sheetConfig` hook.
- If a module exists, the override is saved.
- Otherwise, delete any override and restore original config, if any.
- The config is then saved to settings.
What Modules Need to Change
Remove the game.settings.set('pbta', 'sheetConfigOverride', true) call that is somewhere in the code.
Why
babele.ready
hook.pbtaSheetConfig
hook.What Changed?
pbtaSheetConfig
hook topbta.sheetConfig
for consistency with potential new hooks in the future.ready
hook, fixing some weird behavior caused by it.Unrelated Changes
init
hook.setup
.How It Worked Before
- If an override exists and `sheetConfigOverride` was previously activated, load the override. - Otherwise, load the original, if any. - PbtA sets the `sheetConfigOverride` setting to false, calls the `pbtaSheetConfig` hook and awaits 1 second. - If the setting has been turned on, the override is saved. - Otherwise, delete any override and restore original config, if any. - The config is then saved to settings.How It Works Now
- PbtA checks if any module is flagged to override it. - If an override exists and a module is flagged to override it, load the override. - Otherwise, load the original, if any. - PbtA calls the `pbta.sheetConfig` hook. - If a module exists, the override is saved. - Otherwise, delete any override and restore original config, if any. - The config is then saved to settings.What Modules Need to Change
Remove the
game.settings.set('pbta', 'sheetConfigOverride', true)
call that is somewhere in the code.On
module.json
, add: