ds4/src/module/settings.ts

51 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-06-26 22:02:00 +02:00
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
2021-07-07 19:22:35 +02:00
import { getGame } from "./helpers";
export function registerSystemSettings(): void {
/**
2021-01-20 22:11:53 +01:00
* Track the migrations version of the latest migration that has been applied
*/
2021-07-07 19:22:35 +02:00
getGame().settings.register("ds4", "systemMigrationVersion", {
name: "System Migration Version",
scope: "world",
config: false,
2021-01-20 22:11:53 +01:00
type: Number,
default: -1,
});
2021-03-18 08:52:02 +01:00
2021-07-07 19:22:35 +02:00
getGame().settings.register("ds4", "useSlayingDiceForAutomatedChecks", {
2021-03-18 08:52:02 +01:00
name: "DS4.SettingUseSlayingDiceForAutomatedChecksName",
hint: "DS4.SettingUseSlayingDiceForAutomatedChecksHint",
scope: "world",
config: true,
type: Boolean,
default: false,
});
2021-05-13 15:41:00 +02:00
2021-07-07 19:22:35 +02:00
getGame().settings.register("ds4", "showSlayerPoints", {
2021-05-13 15:41:00 +02:00
name: "DS4.SettingShowSlayerPointsName",
hint: "DS4.SettingShowSlayerPointsHint",
scope: "world",
config: true,
type: Boolean,
default: false,
});
}
2021-06-30 13:42:20 +02:00
export interface DS4Settings {
2021-05-13 15:41:00 +02:00
systemMigrationVersion: number;
useSlayingDiceForAutomatedChecks: boolean;
showSlayerPoints: boolean;
}
export function getDS4Settings(): DS4Settings {
return {
2021-07-07 19:22:35 +02:00
systemMigrationVersion: getGame().settings.get("ds4", "systemMigrationVersion"),
useSlayingDiceForAutomatedChecks: getGame().settings.get("ds4", "useSlayingDiceForAutomatedChecks"),
showSlayerPoints: getGame().settings.get("ds4", "showSlayerPoints"),
2021-05-13 15:41:00 +02:00
};
}