fix: bundle SLA assets in module and auto-seed missing world content

This commit is contained in:
2026-03-04 17:21:19 +00:00
parent ad1b00efca
commit dc8fc1441f
405 changed files with 300 additions and 11 deletions
@@ -1,5 +1,5 @@
export class SLAAmmoCatalog {
static AMMO_ICON_PATH = "assets/SLA_Assets/Ammo";
static AMMO_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Ammo";
static BASE_CALIBRES = [
{ key: "3mm", label: "3mm", cost: 1, group: "Handgun", typical: "FEN 603, machine pistols" },
@@ -6,7 +6,22 @@ export class SLABPNToolkit {
if (!pickerImpl?.browse) {
throw new Error("FilePicker implementation not available");
}
return pickerImpl.browse("data", path);
const cleanPath = String(path ?? "").trim();
const attempts = [cleanPath];
const modulePrefix = "modules/sla-industries-compendium/assets/SLA_Assets/";
const legacyPrefix = "assets/SLA_Assets/";
if (cleanPath.startsWith(modulePrefix)) {
attempts.push(`${legacyPrefix}${cleanPath.slice(modulePrefix.length)}`);
}
let lastErr = null;
for (const attempt of attempts) {
try {
return await pickerImpl.browse("data", attempt);
} catch (err) {
lastErr = err;
}
}
throw lastErr ?? new Error(`Failed browsing data path: ${cleanPath}`);
}
static MAIN_COLOURS = [
@@ -534,7 +549,7 @@ export class SLABPNToolkit {
static EXTENDED_DATA_JOURNAL_NAME = "BPN RANDOM DATA – EXTENDED";
static COMPLETE_JOURNAL_NAME = "BPN TOOLKIT – COMPLETE";
static EQUIPMENT_JOURNAL_NAME = "SLA GENERAL EQUIPMENT CATALOGUE";
static GEAR_ICON_PATH = "assets/SLA_Assets/Gear";
static GEAR_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Gear";
static _GEAR_ICON_MAP = null;
static RULEBOOK_JOURNAL_NAME = "SLA RULEBOOK – PLAYERS & GMS";
static RULEBOOK_SOURCE_PATH = "systems/sla-industries-brp/SLA_RULEBOOK_FOUNDATION.md";
@@ -1,6 +1,6 @@
export class SLADrugSystem {
static FLAG_KEY = "slaDrugs";
static DRUG_ICON_PATH = "assets/SLA_Assets/Drugs/Generated";
static DRUG_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Drugs/Generated";
static DRUG_DEFINITIONS = {
shatter: {
@@ -9,12 +9,12 @@ export class SLASeedImporter {
static _ebbIconMapCache = null;
static _speciesIconMapCache = null;
static _trainingIconMapCache = null;
static SKILL_ICON_PATH = "assets/SLA_Assets/Skills";
static WEAPON_ICON_PATH = "assets/SLA_Assets/Weapons";
static EBB_ICON_PATH = "assets/SLA_Assets/Ebb";
static SPECIES_ICON_PATH = "assets/SLA_Assets/Species";
static TRAINING_ICON_PATH = "assets/SLA_Assets/Ebb/Training";
static TRAIT_ICON_PATH = "assets/SLA_Assets/Traits";
static SKILL_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Skills";
static WEAPON_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Weapons";
static EBB_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Ebb";
static SPECIES_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Species";
static TRAINING_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Ebb/Training";
static TRAIT_ICON_PATH = "modules/sla-industries-compendium/assets/SLA_Assets/Traits";
static AMMO_ICON_TAGS = new Set(["STD", "AP", "HE", "HEAP"]);
static SLA2_TRAIT_ROWS = [
{ name: "Illness", rank: 3, traitType: "disadvantage", xpCost: -1 },
@@ -83,7 +83,22 @@ export class SLASeedImporter {
if (!pickerImpl?.browse) {
throw new Error("FilePicker implementation not available");
}
return pickerImpl.browse("data", path);
const cleanPath = String(path ?? "").trim();
const attempts = [cleanPath];
const modulePrefix = "modules/sla-industries-compendium/assets/SLA_Assets/";
const legacyPrefix = "assets/SLA_Assets/";
if (cleanPath.startsWith(modulePrefix)) {
attempts.push(`${legacyPrefix}${cleanPath.slice(modulePrefix.length)}`);
}
let lastErr = null;
for (const attempt of attempts) {
try {
return await pickerImpl.browse("data", attempt);
} catch (err) {
lastErr = err;
}
}
throw lastErr ?? new Error(`Failed browsing data path: ${cleanPath}`);
}
static isSLABrpid(brpid = "") {
+39
View File
@@ -204,6 +204,45 @@ Hooks.once("ready", async function () {
console.warn("sla-industries-brp | Failed SLA Traits seed on ready", err);
}
}
// Ensure core SLA world content folders/items exist (important for fresh remote worlds).
if (game.user?.isGM && game.brp?.SLASeedImporter) {
try {
const hasItemFolder = (name) => game.folders.some((f) => f.type === "Item" && f.name === name && !f.folder);
const itemFolderItemCount = (name) => {
const folder = game.folders.find((f) => f.type === "Item" && f.name === name && !f.folder);
if (!folder) return 0;
return game.items.filter((item) => item.folder?.id === folder.id).length;
};
const shouldSeed = (name) => !hasItemFolder(name) || itemFolderItemCount(name) === 0;
if (shouldSeed("SLA Ebb Abilities") && game.brp.SLASeedImporter.importEbbAbilities) {
await game.brp.SLASeedImporter.importEbbAbilities({ overwrite: false });
}
if (
(shouldSeed("SLA Weapons") || shouldSeed("SLA Armour")) &&
game.brp.SLASeedImporter.importEquipment
) {
await game.brp.SLASeedImporter.importEquipment({ overwrite: false });
}
if (shouldSeed("SLA Species") && game.brp.SLASeedImporter.importSpecies) {
await game.brp.SLASeedImporter.importSpecies({ overwrite: false });
}
if (shouldSeed("SLA Training Packages") && game.brp.SLASeedImporter.importTrainingPackages) {
await game.brp.SLASeedImporter.importTrainingPackages({ overwrite: false });
}
if (shouldSeed("SLA Ammo") && game.brp.SLASeedImporter.seedAmmoGear) {
await game.brp.SLASeedImporter.seedAmmoGear({ overwrite: false });
}
if (shouldSeed("SLA Drugs") && game.brp.SLASeedImporter.seedDrugs) {
await game.brp.SLASeedImporter.seedDrugs({ overwrite: false });
}
if (shouldSeed("SLA General Equipment") && game.brp.SLABPNToolkit?.seedWorldGeneralEquipment) {
await game.brp.SLABPNToolkit.seedWorldGeneralEquipment({ overwrite: false, notify: false });
}
} catch (err) {
console.warn("sla-industries-brp | Failed SLA world content completeness pass", err);
}
}
if (game.brp?.SLASeedImporter && !game.brp.SLASeedImporter.seedDrugs) {
try {
const { SLADrugSystem } = await import("./apps/sla-drug-system.mjs");
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Some files were not shown because too many files have changed in this diff Show More