Add a setting to disable the auto tracking

This commit is contained in:
Oliver-Akins 2025-05-04 22:20:00 -06:00
parent 1a4d764a15
commit dff2455dc7
3 changed files with 22 additions and 1 deletions

View file

@ -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,

View file

@ -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 = {};