diff --git a/eslint.config.mjs b/eslint.config.mjs index 462ea73..544b98e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -31,6 +31,7 @@ export default [ ActiveEffect: `readonly`, Dialog: `readonly`, renderTemplate: `readonly`, + TextEditor: `readonly`, }, }, }, @@ -42,6 +43,7 @@ export default [ languageOptions: { globals: { Logger: `readonly`, + taf: `readonly`, }, }, rules: { diff --git a/src/consts.mjs b/src/consts.mjs index 0c13482..e69de29 100644 --- a/src/consts.mjs +++ b/src/consts.mjs @@ -1,3 +0,0 @@ -export const FEATURE_FLAGS = Object.freeze({ - ROLLMODECONTENT: `Roll Mode Message Content`, -}); diff --git a/src/hooks/renderChatMessage.mjs b/src/hooks/renderChatMessage.mjs index 15f70a0..496a135 100644 --- a/src/hooks/renderChatMessage.mjs +++ b/src/hooks/renderChatMessage.mjs @@ -1,5 +1,3 @@ -import { FEATURE_FLAGS } from "../consts.mjs"; - Hooks.on(`renderChatMessage`, (msg, html) => { // Short-Circuit when the flag isn't set for the message @@ -7,13 +5,12 @@ Hooks.on(`renderChatMessage`, (msg, html) => { return; } - const featureFlags = game.settings.get(game.system.id, `flags`); - const featureFlagEnabled = featureFlags.includes(FEATURE_FLAGS.ROLLMODECONTENT); + const featureFlagEnabled = taf.FEATURES.ROLL_MODE_CONTENT; const contentElement = html.find(`.message-content`)[0]; let content = contentElement.innerHTML; if (featureFlagEnabled && msg.blind && !game.user.isGM) { - content = content.replace(/-=.*?=-/gm, `???`); + content = content.replace(/-=.*?=-/gm, `??`); } else { content = content.replace(/-=|=-/gm, ``); } diff --git a/src/settings/world_settings.mjs b/src/settings/world_settings.mjs index db4d7ed..eb3aad7 100644 --- a/src/settings/world_settings.mjs +++ b/src/settings/world_settings.mjs @@ -1,24 +1,2 @@ -import { FEATURE_FLAGS } from "../consts.mjs"; - export function registerWorldSettings() { - game.settings.register(game.system.id, `flags`, { - name: `Feature Flags`, - hint: `World-based feature flags that are used to enable/disable specific behaviours`, - scope: `world`, - type: new foundry.data.fields.SetField( - new foundry.data.fields.StringField( - { - empty: false, - trim: true, - options: Object.values(FEATURE_FLAGS), - }, - ), - { - required: false, - initial: new Set(), - }, - ), - config: true, - requiresReload: true, - }); }; diff --git a/src/utils/feature_flags/rollModeMessageContent.mjs b/src/utils/feature_flags/rollModeMessageContent.mjs index 059852a..67ed613 100644 --- a/src/utils/feature_flags/rollModeMessageContent.mjs +++ b/src/utils/feature_flags/rollModeMessageContent.mjs @@ -1,8 +1,5 @@ -import { FEATURE_FLAGS } from "../../consts.mjs"; - export function hideMessageText(content) { - const featureFlags = game.settings.get(game.system.id, `flags`); - const hideContent = featureFlags.includes(FEATURE_FLAGS.ROLLMODECONTENT); + const hideContent = taf.FEATURES.ROLL_MODE_CONTENT; if (hideContent) { return `-=${content}=-`; } diff --git a/src/utils/globalTaf.mjs b/src/utils/globalTaf.mjs index 3ed03fe..e038c4d 100644 --- a/src/utils/globalTaf.mjs +++ b/src/utils/globalTaf.mjs @@ -1,11 +1,11 @@ -import { FEATURE_FLAGS } from "../consts.mjs"; import { hideMessageText } from "./feature_flags/rollModeMessageContent.mjs"; globalThis.taf = Object.freeze({ - utils: { + utils: Object.freeze({ hideMessageText, - }, - const: { - FEATURE_FLAGS, + }), + FEATURES: { + ROLL_MODE_CONTENT: false, + STORABLE_SHEET_SIZE: false, }, }); diff --git a/system.json b/system.json index 712924d..d1561a6 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "taf", "title": "Text-Based Actors", "description": "", - "version": "1.2.0", + "version": "2.0.0", "download": "https://github.com/Oliver-Akins/Text-Actors-Foundry/releases/latest/download/dotdungeon.zip", "manifest": "https://github.com/Oliver-Akins/Text-Actors-Foundry/releases/latest/download/system.json", "url": "https://github.com/Oliver-Akins/Text-Actors-Foundry",