feat: implement purge logic for undefined Ikonis weapon features to ensure data consistency
This commit is contained in:
parent
b7b9a62fcc
commit
f488400e78
1 changed files with 11 additions and 2 deletions
|
|
@ -46,10 +46,19 @@ export async function seedIkonisHomebrew() {
|
||||||
if (!homebrew.itemFeatures.weaponFeatures) homebrew.itemFeatures.weaponFeatures = {};
|
if (!homebrew.itemFeatures.weaponFeatures) homebrew.itemFeatures.weaponFeatures = {};
|
||||||
|
|
||||||
let updates = false;
|
let updates = false;
|
||||||
|
const recognizedIds = DEFAULT_AUGMENTS.map(aug => `ikonis-${aug.id}`);
|
||||||
|
|
||||||
|
// Purge undefined Ikonis features
|
||||||
|
for (const [id, feature] of Object.entries(homebrew.itemFeatures.weaponFeatures)) {
|
||||||
|
if (id.startsWith('ikonis-') && !recognizedIds.includes(id)) {
|
||||||
|
console.log(`DH-Ikonis | Purging undefined feature: ${id}`);
|
||||||
|
delete homebrew.itemFeatures.weaponFeatures[id];
|
||||||
|
updates = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const aug of DEFAULT_AUGMENTS) {
|
for (const aug of DEFAULT_AUGMENTS) {
|
||||||
const nativeId = `ikonis-${aug.id}`;
|
const nativeId = `ikonis-${aug.id}`;
|
||||||
const existing = homebrew.itemFeatures.weaponFeatures[nativeId];
|
|
||||||
|
|
||||||
// Force update to ensure 16-character IDs and correct mechanical effects are synced
|
// Force update to ensure 16-character IDs and correct mechanical effects are synced
|
||||||
console.log(`DH-Ikonis | Seeding/Updating feature: ${aug.name}`);
|
console.log(`DH-Ikonis | Seeding/Updating feature: ${aug.name}`);
|
||||||
homebrew.itemFeatures.weaponFeatures[nativeId] = {
|
homebrew.itemFeatures.weaponFeatures[nativeId] = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue