fix not detecting other mods
This commit is contained in:
parent
657fb6bb3b
commit
0f65f98c0a
|
|
@ -11,30 +11,38 @@ for (let elementName in elements) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let modDescriptions = {};
|
runAfterLoad(function() {
|
||||||
|
let modDescriptions = {};
|
||||||
|
|
||||||
let fetchPromises = enabledMods.map(mod => {
|
let fetchPromises = enabledMods.map(mod => {
|
||||||
return fetch(mod)
|
return fetch(mod)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(`Loaded mod: ${mod}`);
|
console.log(`Loaded mod: ${mod}`);
|
||||||
modDescriptions[mod] = data;
|
modDescriptions[mod] = data;
|
||||||
})
|
})
|
||||||
.catch(error => console.error('Error fetching the mod file: ', error));
|
.catch(error => console.error('Error fetching the mod file: ', error));
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(fetchPromises).then(() => {
|
Promise.all(fetchPromises).then(() => {
|
||||||
Object.keys(elements).forEach(function(elementName) {
|
Object.keys(elements).forEach(function(elementName) {
|
||||||
let element = elements[elementName];
|
let element = elements[elementName];
|
||||||
|
let elementMod = "Sandboxels (Vanilla)";
|
||||||
|
|
||||||
|
for (let mod of enabledMods) {
|
||||||
|
if (modDescriptions[mod].includes(elementName)) {
|
||||||
|
elementMod = mod;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (let mod of enabledMods) {
|
|
||||||
if (element.desc && typeof element.desc === 'string' && element.desc.trim() !== '') {
|
if (element.desc && typeof element.desc === 'string' && element.desc.trim() !== '') {
|
||||||
if (!element.desc.includes("This Element is from")) {
|
if (!element.desc.includes("This Element is from")) {
|
||||||
element.desc += `\nThis Element is from ${mod}`;
|
element.desc += `\nThis Element is from ${elementMod}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
element.desc = `This Element is from ${mod}`;
|
element.desc = `This Element is from ${elementMod}`;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue