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 => {
|
||||
return fetch(mod)
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
console.log(`Loaded mod: ${mod}`);
|
||||
modDescriptions[mod] = data;
|
||||
})
|
||||
.catch(error => console.error('Error fetching the mod file: ', error));
|
||||
});
|
||||
let fetchPromises = enabledMods.map(mod => {
|
||||
return fetch(mod)
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
console.log(`Loaded mod: ${mod}`);
|
||||
modDescriptions[mod] = data;
|
||||
})
|
||||
.catch(error => console.error('Error fetching the mod file: ', error));
|
||||
});
|
||||
|
||||
Promise.all(fetchPromises).then(() => {
|
||||
Object.keys(elements).forEach(function(elementName) {
|
||||
let element = elements[elementName];
|
||||
|
||||
for (let mod of enabledMods) {
|
||||
Promise.all(fetchPromises).then(() => {
|
||||
Object.keys(elements).forEach(function(elementName) {
|
||||
let element = elements[elementName];
|
||||
let elementMod = "Sandboxels (Vanilla)";
|
||||
|
||||
for (let mod of enabledMods) {
|
||||
if (modDescriptions[mod].includes(elementName)) {
|
||||
elementMod = mod;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (element.desc && typeof element.desc === 'string' && element.desc.trim() !== '') {
|
||||
if (!element.desc.includes("This Element is from")) {
|
||||
element.desc += `\nThis Element is from ${mod}`;
|
||||
element.desc += `\nThis Element is from ${elementMod}`;
|
||||
}
|
||||
} else {
|
||||
element.desc = `This Element is from ${mod}`;
|
||||
element.desc = `This Element is from ${elementMod}`;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue