Move the tweak prevention into a helper function and rename the module hooks w/ compatibility code

This commit is contained in:
Oliver 2025-12-18 22:32:46 -07:00
parent 3d4376aa81
commit 9c8b6f37f9
20 changed files with 102 additions and 102 deletions

View file

@ -1,15 +1,15 @@
// Settings
import { addGlobalDocReferrer } from "../settings/addGlobalDocReferrer.mjs";
import { autoUnpauseOnLoad } from "../settings/autoUnpauseOnLoad.mjs";
import { chatImageLinks } from "../settings/chatImageLinks.mjs";
import { chatSidebarBackground } from "../settings/chatSidebarBackground.mjs";
import { hotbarButtonGap } from "../settings/hotbarButtonGap.mjs";
import { hotbarButtonSize } from "../settings/hotbarButtonSize.mjs";
import { preventTokenRotation } from "../settings/preventTokenRotation.mjs";
import { preventUserConfigOpen } from "../settings/preventUserConfigOpen.mjs";
import { repositionHotbar } from "../settings/repositionHotbar.mjs";
import { startingSidebarTab } from "../settings/startingSidebarTab.mjs";
import { startSidebarExpanded } from "../settings/startSidebarExpanded.mjs";
import { addGlobalDocReferrer } from "../tweaks/addGlobalDocReferrer.mjs";
import { autoUnpauseOnLoad } from "../tweaks/autoUnpauseOnLoad.mjs";
import { chatImageLinks } from "../tweaks/chatImageLinks.mjs";
import { chatSidebarBackground } from "../tweaks/chatSidebarBackground.mjs";
import { hotbarButtonGap } from "../tweaks/hotbarButtonGap.mjs";
import { hotbarButtonSize } from "../tweaks/hotbarButtonSize.mjs";
import { preventTokenRotation } from "../tweaks/preventTokenRotation.mjs";
import { preventUserConfigOpen } from "../tweaks/preventUserConfigOpen.mjs";
import { repositionHotbar } from "../tweaks/repositionHotbar.mjs";
import { startingSidebarTab } from "../tweaks/startingSidebarTab.mjs";
import { startSidebarExpanded } from "../tweaks/startSidebarExpanded.mjs";
// Apps
import { DevSettingsMenu } from "../apps/DevSettingsMenu.mjs";
@ -51,7 +51,16 @@ Hooks.on(`setup`, () => {
preventTokenRotation();
preventUserConfigOpen();
Hooks.callAll(`oft.settingStatuses`, deepFreeze(status));
// Compatibility Code
if (Hooks.events[`oft.settingStatuses`] != null) {
foundry.utils.logCompatibilityWarning(
`The hook "${__ID__}.settingStatuses" has been renamed "${__ID__}.tweakStatuses".`,
{ since: `v1.2.0`, until: `v2.0.0`, stack: false, once: true },
);
Hooks.callAll(`oft.settingStatuses`, deepFreeze(status));
};
Hooks.callAll(`${__ID__}.tweakStatuses`, deepFreeze(status));
game.modules.get(__ID__).api = deepFreeze({
settings: status,
});