v0.2.0: Add setting to disable dynamic borders

The point of the module is to allow multiple functionalities
to support our campaign.
They might not be suited all the time or to all of them.
They might be buggy !

Add a toggle setting to the dynamic borders functionality,
so that we can keep the compendium while it is fixed.
This commit is contained in:
trotFunky 2025-05-28 18:53:59 +01:00
parent 6c3ce53101
commit f617b26fe1
10 changed files with 43 additions and 18 deletions

View file

@ -1,4 +1,4 @@
# The Mill's Fabula - v0.1.0
# The Mill's Fabula - v0.2.0
This little [FoundryVTT](https://foundryvtt.com/) module is a collection of compendiums and functionalities
to power our Fabula Ultima campaigns.
@ -17,9 +17,9 @@ https://git.tfk-astrodome.net/trotFunky/TheMillsFabula/raw/branch/release/module
# Features
This module is an aggregate of different things that are useful for us or that the GM wanted
to play with, so they don't necessarily connect with each other.
to play with, so they don't necessarily connect with each other and can be disabled if wanted.
They are described below in their own secions.
They are described below in their own sections.
## Combat border

View file

@ -4,6 +4,10 @@
"MF": {
"Border": {
"Settings": {
"BorderEnabled": {
"Name": "Enable borders ?",
"Hint": "Should dynamic combat status borders be displayed ?"
},
"BaseBorder": {
"Name": "Base border",
"Hint": "The image to use as a border for player tokens at all times."

View file

@ -4,6 +4,10 @@
"MF": {
"Border": {
"Settings": {
"BorderEnabled": {
"Name": "Activer les bordures ?",
"Hint": "Les bordures de combat dynamiques devraient-elles être affichées ?"
},
"BaseBorder": {
"Name": "Bordure par défaut",
"Hint": "L'image à utiliser comme bordure pour les jetons joueurs, présente en permanence."

View file

@ -2,7 +2,7 @@
"id": "the-mills-fabula",
"title": "Fabula Moletrina",
"description": "A module implementing our idiosyncratic ideas for the Mill's campaigns.",
"version": "0.1.0",
"version": "0.2.0",
"compatibility": {
"minimum": "12",
"verified": "12",
@ -72,5 +72,5 @@
"readme": "README.md",
"url": "https://git.tfk-astrodome.net/trotFunky/TheMillsFabula/src/branch/release",
"manifest": "https://git.tfk-astrodome.net/trotFunky/TheMillsFabula/raw/branch/release/module.json",
"download": "https://git.tfk-astrodome.net/trotFunky/TheMillsFabula/archive/v0.1.0.zip"
"download": "https://git.tfk-astrodome.net/trotFunky/TheMillsFabula/archive/v0.2.0.zip"
}

View file

@ -1 +1 @@
MANIFEST-000068
MANIFEST-000070

View file

@ -1,3 +1,3 @@
2025/05/09-18:11:40.073652 7253c0dec6c0 Recovering log #66
2025/05/09-18:11:40.092496 7253c0dec6c0 Delete type=3 #64
2025/05/09-18:11:40.092522 7253c0dec6c0 Delete type=0 #66
2025/05/28-18:53:04.916656 7f11a31ec6c0 Recovering log #69
2025/05/28-18:53:04.935350 7f11a31ec6c0 Delete type=0 #69
2025/05/28-18:53:04.935382 7f11a31ec6c0 Delete type=3 #68

View file

@ -1,7 +1,3 @@
2025/05/09-17:35:50.464775 7253c1dee6c0 Recovering log #62
2025/05/09-17:35:50.483617 7253c1dee6c0 Delete type=3 #60
2025/05/09-17:35:50.483640 7253c1dee6c0 Delete type=0 #62
2025/05/09-18:11:37.487216 7253ae46b6c0 Level-0 table #67: started
2025/05/09-18:11:37.487234 7253ae46b6c0 Level-0 table #67: 0 bytes OK
2025/05/09-18:11:37.498365 7253ae46b6c0 Delete type=0 #65
2025/05/09-18:11:37.548398 7253ae46b6c0 Manual compaction at level-0 from '!macros!AXWjXCoFJKa5KmSU' @ 72057594037927935 : 1 .. '!macros!AXWjXCoFJKa5KmSU' @ 0 : 0; will stop at (end)
2025/05/09-18:11:40.073652 7253c0dec6c0 Recovering log #66
2025/05/09-18:11:40.092496 7253c0dec6c0 Delete type=3 #64
2025/05/09-18:11:40.092522 7253c0dec6c0 Delete type=0 #66

View file

@ -18,6 +18,7 @@ const SocketMessages = Object.freeze({
})
const BorderSettings = Object.freeze({
BorderEnabled: "borderEnabled",
BaseBorderPath: "baseBorderPath",
PlayedBorderPath: "playedBorderPath",
})
@ -151,11 +152,23 @@ function combat_hook_update_token_borders(combat, data) {
function combat_border_main() {
Hooks.once("init", () => {
game.settings.register(MillsFabula.id, BorderSettings.BorderEnabled, {
name: game.i18n.localize('MF.Border.Settings.BorderEnabled.Name'),
hint: game.i18n.localize('MF.Border.Settings.BorderEnabled.Hint'),
type: Boolean,
config: true,
scope: 'world',
requiresReload: true,
default: true
});
// Only show the settings if the borders are enabled.
let borders_enabled = game.settings.get(MillsFabula.id, BorderSettings.BorderEnabled);
game.settings.register(MillsFabula.id, BorderSettings.BaseBorderPath, {
name: game.i18n.localize('MF.Border.Settings.BaseBorder.Name'),
hint: game.i18n.localize('MF.Border.Settings.BaseBorder.Hint'),
type: String,
config: true,
config: borders_enabled,
scope: 'world',
requiresReload: true,
filePicker: 'image',
@ -166,7 +179,7 @@ function combat_border_main() {
name: game.i18n.localize('MF.Border.Settings.PlayedBorder.Name'),
hint: game.i18n.localize('MF.Border.Settings.PlayedBorder.Hint'),
type: String,
config: true,
config: borders_enabled,
scope: 'world',
requiresReload: true,
filePicker: 'image',
@ -186,6 +199,10 @@ function combat_border_main() {
// Create the borders from defined textures and add them to the tokens when they are first created on canvas.
// FIXME: Does not work on scene change !
Hooks.on("drawToken", (drawn_token) => {
// FIXME: Handle deactivation properly
if (!game.settings.get(MillsFabula.id, BorderSettings.BorderEnabled)) {
return;
}
// Only apply the borders to player tokens
if (drawn_token.actor?.type !== "character")
return;
@ -207,6 +224,10 @@ function combat_border_main() {
Hooks.on("ready", () => {
// FIXME: Handle deactivation properly
if (!game.settings.get(MillsFabula.id, BorderSettings.BorderEnabled)) {
return;
}
// Players cannot run the combat hooks used here, which trigger for the GM no matter what.
// So register them for the GM only, who will execute the updates for players via SocketLib.
if (!game.user?.isGM) {