diff --git a/module/dotdungeon.mjs b/module/dotdungeon.mjs index 09f4d39..f49d120 100644 --- a/module/dotdungeon.mjs +++ b/module/dotdungeon.mjs @@ -110,9 +110,6 @@ Hooks.once(`init`, async () => { hbs.registerHandlebarsHelpers(); hbs.preloadHandlebarsTemplates(); registerCustomComponents(); - - CONFIG.CACHE ??= {}; - CONFIG.CACHE.icons = await hbs.preloadIcons(); }); diff --git a/module/handlebars.mjs b/module/handlebars.mjs index de34f62..cdaa1b7 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -43,25 +43,6 @@ export const preAliasedPartials = { "dotdungeon.pc.v2.foil": "actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs", }; -export const icons = [ - `caret-right.svg`, - `caret-down.svg`, - `garbage-bin.svg`, - `chat-bubble.svg`, - `dice/d4.svg`, - `dice/d6.svg`, - `dice/d8.svg`, - `dice/d10.svg`, - `dice/d12.svg`, - `dice/d20.svg`, - `create.svg`, - `close.svg`, - `edit.svg`, - `sheet.svg`, - `minus.svg`, -]; - - export async function registerHandlebarsHelpers() { Handlebars.registerHelper(helpers); }; @@ -97,38 +78,3 @@ export async function preloadHandlebarsTemplates() { console.groupEnd(); return loadTemplates(paths); }; - -/** - * Loads all of the icons that are needed in the handlebars templating to make - * the sheet look nicer. - * - * @returns An object containing icon names to the corresponding HTML data for - * displaying the icon - */ -export async function preloadIcons() { - const pathPrefix = `systems/dotdungeon/assets/` - const parsedIcons = {}; - - for (const icon of icons) { - const iconName = icon.split(`/`).slice(-1)[0].slice(0, -4); - if (icon.endsWith(`.svg`)) { - try { - const response = await fetchWithTimeout(`${pathPrefix}${icon}`); - if (response.status !== 200) { continue }; - const svgData = await response.text(); - parsedIcons[iconName] = svgData; - } catch { - console.error(`.dungeon | Failed to fetch/parse icon: ${icon}`); - continue; - }; - } - else if (icon.endsWith(`.png`)) { - parsedIcons[iconName] = ``; - } - else { - console.warn(`.dungeon | Icon "${icon}" failed to be handled by a loader`) - }; - }; - - return parsedIcons; -}; diff --git a/module/sheets/GenericActorSheet.mjs b/module/sheets/GenericActorSheet.mjs index 50dcada..2010304 100644 --- a/module/sheets/GenericActorSheet.mjs +++ b/module/sheets/GenericActorSheet.mjs @@ -40,7 +40,7 @@ export class GenericActorSheet extends ActorSheet { ctx.actor = this.actor; ctx.config = DOTDUNGEON; - ctx.icons = CONFIG.CACHE.icons; + ctx.icons = {}; return ctx; }; diff --git a/module/sheets/Items/GenericItemSheet.mjs b/module/sheets/Items/GenericItemSheet.mjs index 883050e..31821e1 100644 --- a/module/sheets/Items/GenericItemSheet.mjs +++ b/module/sheets/Items/GenericItemSheet.mjs @@ -32,7 +32,7 @@ export class GenericItemSheet extends ItemSheet { ctx.flags = this.item.flags; ctx.config = DOTDUNGEON; - ctx.icons = CONFIG.CACHE.icons; + ctx.icons = {}; return ctx; };