Add defaultHotbarPage tweak
This commit is contained in:
parent
2adb616701
commit
6bf72b313a
3 changed files with 44 additions and 1 deletions
|
|
@ -17,6 +17,10 @@
|
||||||
"name": "Chat Background",
|
"name": "Chat Background",
|
||||||
"hint": "(v13+) Adds a background to the chat tab of the right-hand sidebar."
|
"hint": "(v13+) Adds a background to the chat tab of the right-hand sidebar."
|
||||||
},
|
},
|
||||||
|
"defaultHotbarPage": {
|
||||||
|
"name": "Default Hotbar Page",
|
||||||
|
"hint": "What page the hotbar will default to when loading into Foundry."
|
||||||
|
},
|
||||||
"hotbarButtonGap": {
|
"hotbarButtonGap": {
|
||||||
"name": "Hotbar Button Gap",
|
"name": "Hotbar Button Gap",
|
||||||
"hint": "(v13+) Allows changing the amount of space between the hotbar buttons."
|
"hint": "(v13+) Allows changing the amount of space between the hotbar buttons."
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
// Settings
|
// Tweaks
|
||||||
import { addGlobalDocReferrer } from "../tweaks/addGlobalDocReferrer.mjs";
|
import { addGlobalDocReferrer } from "../tweaks/addGlobalDocReferrer.mjs";
|
||||||
import { autoUnpauseOnLoad } from "../tweaks/autoUnpauseOnLoad.mjs";
|
import { autoUnpauseOnLoad } from "../tweaks/autoUnpauseOnLoad.mjs";
|
||||||
import { chatImageLinks } from "../tweaks/chatImageLinks.mjs";
|
import { chatImageLinks } from "../tweaks/chatImageLinks.mjs";
|
||||||
import { chatSidebarBackground } from "../tweaks/chatSidebarBackground.mjs";
|
import { chatSidebarBackground } from "../tweaks/chatSidebarBackground.mjs";
|
||||||
|
import { defaultHotbarPage } from "../tweaks/defaultHotbarPage.mjs";
|
||||||
import { hotbarButtonGap } from "../tweaks/hotbarButtonGap.mjs";
|
import { hotbarButtonGap } from "../tweaks/hotbarButtonGap.mjs";
|
||||||
import { hotbarButtonSize } from "../tweaks/hotbarButtonSize.mjs";
|
import { hotbarButtonSize } from "../tweaks/hotbarButtonSize.mjs";
|
||||||
import { preventTokenRotation } from "../tweaks/preventTokenRotation.mjs";
|
import { preventTokenRotation } from "../tweaks/preventTokenRotation.mjs";
|
||||||
|
|
@ -40,6 +41,7 @@ Hooks.on(`setup`, () => {
|
||||||
restricted: false,
|
restricted: false,
|
||||||
type: HotbarSettingsMenu,
|
type: HotbarSettingsMenu,
|
||||||
});
|
});
|
||||||
|
defaultHotbarPage();
|
||||||
hotbarButtonSize();
|
hotbarButtonSize();
|
||||||
hotbarButtonGap();
|
hotbarButtonGap();
|
||||||
repositionHotbar();
|
repositionHotbar();
|
||||||
|
|
|
||||||
37
module/tweaks/defaultHotbarPage.mjs
Normal file
37
module/tweaks/defaultHotbarPage.mjs
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
import { SettingStatusEnum, status } from "../utils/SettingStatus.mjs";
|
||||||
|
import { __ID__ } from "../consts.mjs";
|
||||||
|
import { Logger } from "../utils/Logger.mjs";
|
||||||
|
import { preventTweakRegistration } from "../utils/preRegisterTweak.mjs";
|
||||||
|
import { registerCategorySetting } from "../utils/SubMenuSettings.mjs";
|
||||||
|
|
||||||
|
export const key = `defaultHotbarPage`;
|
||||||
|
|
||||||
|
export function defaultHotbarPage() {
|
||||||
|
status[key] = SettingStatusEnum.Unknown;
|
||||||
|
if (preventTweakRegistration(key)) { return };
|
||||||
|
|
||||||
|
// #region Registration
|
||||||
|
Logger.log(`Registering setting: ${key}`);
|
||||||
|
registerCategorySetting(`hotbar`, __ID__, key, {
|
||||||
|
name: `OFT.setting.${key}.name`,
|
||||||
|
hint: `OFT.setting.${key}.hint`,
|
||||||
|
scope: `user`,
|
||||||
|
type: new foundry.data.fields.NumberField({
|
||||||
|
min: 1,
|
||||||
|
max: 5,
|
||||||
|
step: 1,
|
||||||
|
}),
|
||||||
|
default: 1,
|
||||||
|
config: true,
|
||||||
|
requiresReload: false,
|
||||||
|
});
|
||||||
|
// #endregion Registration
|
||||||
|
|
||||||
|
// #region Implementation
|
||||||
|
Hooks.once(`ready`, () => {
|
||||||
|
ui.hotbar.changePage(game.settings.get(__ID__, key));
|
||||||
|
});
|
||||||
|
// #endregion Implementation
|
||||||
|
|
||||||
|
status[key] = SettingStatusEnum.Registered;
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue