ds4/src/settings.js

59 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-06-26 22:02:00 +02:00
// SPDX-FileCopyrightText: 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
2022-11-04 21:47:18 +01:00
import { getGame } from "./utils/utils";
2021-07-07 19:22:35 +02:00
export function registerSystemSettings() {
2021-07-23 00:43:15 +02:00
const game = getGame();
/**
* Track the migration version of the latest migration that has been applied.
*/
2021-07-23 00:43:15 +02:00
game.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-23 00:43:15 +02:00
game.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-23 00:43:15 +02:00
game.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,
});
}
/**
* @typedef DS4Settings
* @property {number} systemMigrationVersion
* @property {boolean} useSlayingDiceForAutomatedChecks
* @property {boolean} showSlayerPoints
*/
2021-05-13 15:41:00 +02:00
/**
* Get the current values for DS4 settings.
* @returns {DS4Settings}
*/
export function getDS4Settings() {
2021-07-23 00:43:15 +02:00
const game = getGame();
2021-05-13 15:41:00 +02:00
return {
2021-07-23 00:43:15 +02:00
systemMigrationVersion: game.settings.get("ds4", "systemMigrationVersion"),
useSlayingDiceForAutomatedChecks: game.settings.get("ds4", "useSlayingDiceForAutomatedChecks"),
showSlayerPoints: game.settings.get("ds4", "showSlayerPoints"),
2021-05-13 15:41:00 +02:00
};
}