Add a setting to disable the auto tracking
This commit is contained in:
parent
1a4d764a15
commit
dff2455dc7
3 changed files with 22 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ import { Logger } from "../utils/Logger.mjs";
|
|||
import { MemoryDatabase } from "../utils/databases/Memory.mjs";
|
||||
import { registerCustomComponents } from "../Apps/elements/_index.mjs";
|
||||
import { registerMetaSettings } from "../settings/meta.mjs";
|
||||
import { registerWorldSettings } from "../settings/world.mjs";
|
||||
import { StatSidebar } from "../Apps/StatSidebar.mjs";
|
||||
import { StatsViewer } from "../Apps/StatsViewer.mjs";
|
||||
import { TableCreator } from "../Apps/TableCreator.mjs";
|
||||
|
|
@ -25,6 +26,7 @@ Hooks.on(`init`, () => {
|
|||
CONFIG.ui.sidebar.TABS.settings = temp;
|
||||
|
||||
registerMetaSettings();
|
||||
registerWorldSettings();
|
||||
|
||||
CONFIG.stats = {
|
||||
db: UserFlagDatabase,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ import { determinePrivacyFromRollMode } from "../utils/privacy.mjs";
|
|||
Hooks.on(`preCreateChatMessage`, (_message, context, options, author) => {
|
||||
const isNew = options.action === `create`;
|
||||
const hasRolls = context.rolls?.length > 0;
|
||||
if (!isNew || !hasRolls) { return };
|
||||
const autoTracking = game.settings.get(__ID__, `autoTrackRolls`);
|
||||
if (!isNew || !hasRolls || !autoTracking) { return };
|
||||
|
||||
/** An object of dice denomination to rows to add */
|
||||
const rows = {};
|
||||
|
|
|
|||
18
module/settings/world.mjs
Normal file
18
module/settings/world.mjs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
World Settings:
|
||||
- Track rolls automatically
|
||||
- Track inactive rolls (e.g. the "lower" in a "kh" roll)
|
||||
- Track self rolls (defaulta false)
|
||||
*/
|
||||
|
||||
export function registerWorldSettings() {
|
||||
game.settings.register(__ID__, `autoTrackRolls`, {
|
||||
name: `Roll Auto-Tracking`,
|
||||
hint: `Whether or not the module should automatically add rolls made in the chat to the database. This is useful if the system you're using has implemented an integration with the module, or if you only want macros to handle the database additions.`,
|
||||
scope: `world`,
|
||||
type: Boolean,
|
||||
config: true,
|
||||
default: true,
|
||||
requiresReload: true,
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue