Delete mods/elementOrigin.js

This commit is contained in:
sq 2024-11-03 19:33:25 +08:00 committed by GitHub
parent 0aa107f373
commit c80991f027
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 54 deletions

View File

@ -1,54 +0,0 @@
// created by SquareScreamYT
for (let elementName in elements) {
let element = elements[elementName];
if (element.desc && typeof element.desc === 'string' && element.desc.trim() !== '') {
if (!element.desc.includes("This Element is from")) {
element.desc += "\nThis Element is from Sandboxels (Vanilla)";
}
} else {
element.desc = "This Element is from Sandboxels (Vanilla)";
}
}
runAfterLoad(function() {
let modDescriptions = {};
let vanillaElements = Object.keys(elements);
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];
let elementMod = vanillaElements.includes(elementName) ? "Sandboxels (Vanilla)" : null;
if (!elementMod) {
for (let mod of enabledMods) {
if (modDescriptions[mod].includes(`elements.${elementName} =`) ||
modDescriptions[mod].includes(`elements["${elementName}"] =`)) {
elementMod = mod;
break;
}
}
}
if (!elementMod) elementMod = "Unknown Mod";
if (element.desc && typeof element.desc === 'string' && element.desc.trim() !== '') {
if (!element.desc.includes("This Element is from")) {
element.desc += `\nThis Element is from ${elementMod}`;
}
} else {
element.desc = `This Element is from ${elementMod}`;
}
});
});
});