changed setting to a drop down of actor packs

This commit is contained in:
Mike Bloy 2025-06-08 23:26:03 -05:00
parent 59f9022e43
commit b7b8b5c54a
3 changed files with 23 additions and 15 deletions

View File

@ -1,11 +1,19 @@
import { moduleHelpers, settingKeys } from './globals.js'; import { moduleHelpers, settingKeys, log } from './globals.js';
export function registerSettings() { export function registerSettings() {
const choices = {};
const packs = game.packs.filter((p) => p.documentName === 'Actor');
for (const pack of packs) {
choices[pack.metadata.id] = pack.metadata.label;
}
log('found packs', packs);
log('found choices', choices);
moduleHelpers.registerSetting(settingKeys.powerActorsCompendium, { moduleHelpers.registerSetting(settingKeys.powerActorsCompendium, {
name: 'mbhelpers.settings.powerActorsCompendiumName', name: 'mbhelpers.settings.powerActorsCompendiumName',
hint: 'mbhelpers.settings.powerActorsCompendiumHint', hint: 'mbhelpers.settings.powerActorsCompendiumHint',
scope: 'world', scope: 'world',
config: true, config: true,
choices,
requiresReload: false, requiresReload: false,
type: String, type: String,
}); });

View File

@ -26,9 +26,6 @@ Hooks.once('init', async () => {
initVisionModes(); initVisionModes();
// Assign custom classes and constants here // Assign custom classes and constants here
// Register custom module settings
registerSettings();
// Preload Handlebars templates // Preload Handlebars templates
await preloadTemplates(); await preloadTemplates();
}); });
@ -36,6 +33,8 @@ Hooks.once('init', async () => {
// Setup module // Setup module
Hooks.once('setup', async () => { Hooks.once('setup', async () => {
api.registerFunctions(); api.registerFunctions();
// Register custom module settings
registerSettings();
}); });
Hooks.once('ready', async () => { Hooks.once('ready', async () => {

View File

@ -29,29 +29,30 @@
&>label { &>label {
grid-column: 1 / span 1; grid-column: 1 / span 1;
justify-self: end; justify-self: end;
text-align: right;
&::after { &::after {
content: ":"; content: ":";
} }
&.mbcheckbox { // &.mbcheckbox {
grid-column: 2 / span 1; // grid-column: 2 / span 1;
justify-self: start; // justify-self: start;
&::after { // &::after {
content: ""; // content: "";
} // }
} // }
} }
&>input { &>input {
grid-column: 2 / span 1; grid-column: 2 / span 1;
justify-self: start; justify-self: start;
&[type="checkbox"] { // &[type="checkbox"] {
grid-column: 1 / span 1; // grid-column: 1 / span 1;
justify-self: end; // justify-self: end;
} // }
} }
&>fieldset { &>fieldset {