Css fixes and add the ability to have a different name on the custom-compendium
This commit is contained in:
Vlyan
2023-08-19 12:36:13 +02:00
parent 9fa30444aa
commit b993914dcb
12 changed files with 66 additions and 33 deletions

View File

@@ -2,6 +2,8 @@
* Custom system settings register
*/
export const RegisterSettings = function () {
const isBabeleRegistered = (typeof Babele !== "undefined");
/* ------------------------------------ */
/* User settings */
/* ------------------------------------ */
@@ -36,6 +38,20 @@ export const RegisterSettings = function () {
type: Boolean,
default: false,
});
game.settings.register(CONFIG.l5r5e.namespace, "custom-compendium-name", {
name: "SETTINGS.CustomCompendiumName.Title",
hint: "SETTINGS.CustomCompendiumName.Hint",
scope: "world",
config: isBabeleRegistered,
requiresReload: true,
type: String,
default: "l5r5e-custom-compendiums",
onChange: (name) => {
if (!Babele.get().modules.find((module) => module.module === name)) {
ui.notifications.warn(game.i18n.format("SETTINGS.CustomCompendiumName.Notification", { name }), { permanent: true });
}
}
});
/* ------------------------------------ */
/* Update */
@@ -125,24 +141,4 @@ export const RegisterSettings = function () {
default: [],
onChange: () => game.l5r5e.HelpersL5r5e.refreshLocalAndSocket("l5r5e-gm-monitor"),
});
/* ------------------------------------ */
/* Babele */
/* ------------------------------------ */
const showCustomCompendiumSetting = (typeof Babele !== "undefined");
game.settings.register(CONFIG.l5r5e.namespace, "babele-custom-compendium-name", {
name: "Custom Compendium Name",
hint: "For advanced users that want to change the name of custom compendiums",
scope: "world",
config: showCustomCompendiumSetting,
requiresReload: true,
type: String,
default: "l5r5e-custom-compendiums",
onChange: (value) => {
if(!Babele.get().modules.find((module) => module.module === value))
{
ui.notifications.warn("Unable set Custom Compendium: \"" + value + "\". Is it activated and registered with Babele?", {permanent: true});
}
}
});
};