diff --git a/scripts/ikonis-data.js b/scripts/ikonis-data.js index 88e8dd9..c9cde24 100644 --- a/scripts/ikonis-data.js +++ b/scripts/ikonis-data.js @@ -1,14 +1,33 @@ export const DEFAULT_AUGMENTS = [ { id: "bonded", name: "Bonded", effect: "Primary module for Ikonis hardware synchronization.", cost: "Cost: None" }, - { id: "force", name: "Kinetic Amplifier", effect: "+1 Damage on Melee attacks.", cost: "Cost: 2 Iron" }, - { id: "fire", name: "Thermal Core", effect: "Deals Fire damage instead of Physical.", cost: "Cost: 1 Blaze Glass" }, - { id: "shield", name: "Reactive Plating", effect: "+1 Armor while equipped.", cost: "Cost: 2 Steel" }, - { id: "range", name: "Long-Range Optics", effect: "Increases Range by 1 step.", cost: "Cost: 1 Lens" } + { id: "force", name: "Force", effect: "+1 Damage on Melee attacks.", cost: "Cost: 2 Iron" }, + { id: "fire", name: "Fire", effect: "Deals Fire damage instead of Physical.", cost: "Cost: 1 Blaze Glass" }, + { id: "shield", name: "Shield", effect: "+1 Armor while equipped.", cost: "Cost: 2 Steel" }, + { id: "range", name: "Range", effect: "Increases Range by 1 step.", cost: "Cost: 1 Lens" } ]; // Global caches for resolved features to keep getters fast const _featureCache = new Map(); +/** + * Injects Ikonis defaults directly into the system configuration. + */ +export function registerIkonisFeatures() { + if (!CONFIG.DH?.ITEM?.weaponFeatures) return; + + for (const aug of DEFAULT_AUGMENTS) { + const nativeId = `ikonis-${aug.id}`; + CONFIG.DH.ITEM.weaponFeatures[nativeId] = { + name: `Ikonis: ${aug.name}`, + img: "systems/daggerheart/assets/icons/documents/items/chip.svg", + description: `

${aug.effect}

${aug.cost}

`, + actions: {}, + effects: [] + }; + } + console.log("DH-Ikonis | Features registered in CONFIG."); +} + /** * Seeds the Daggerheart Homebrew settings with Ikonis defaults if they don't exist. */ @@ -17,7 +36,7 @@ export async function seedIkonisHomebrew() { const homebrewKey = game.settings.settings.has('daggerheart.Homebrew') ? 'Homebrew' : 'homebrew'; const homebrew = foundry.utils.deepClone(game.settings.get('daggerheart', homebrewKey) || {}); - + if (!homebrew.itemFeatures) homebrew.itemFeatures = { weaponFeatures: {}, armorFeatures: {} }; if (!homebrew.itemFeatures.weaponFeatures) homebrew.itemFeatures.weaponFeatures = {}; diff --git a/scripts/main.js b/scripts/main.js index a85cdf2..6a027d1 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -1,4 +1,4 @@ -import { patchDHWeapon, patchIkonisLogic, patchDhCharacter, seedIkonisHomebrew } from './ikonis-data.js'; +import { patchDHWeapon, patchIkonisLogic, patchDhCharacter, seedIkonisHomebrew, registerIkonisFeatures } from './ikonis-data.js'; import { patchIkonisSheet } from './ikonis-sheet.js'; const MODULE_ID = 'dh-ikonis'; @@ -6,6 +6,9 @@ const MODULE_ID = 'dh-ikonis'; Hooks.once('init', () => { console.log(`${MODULE_ID} | Initializing Ikonis Module`); + // Register default features in CONFIG immediately + registerIkonisFeatures(); + // --- Slot Settings --- [1, 2, 3, 4].forEach(tier => { game.settings.register(MODULE_ID, `slotsTier${tier}`, {