Merge pull request #136 from lllllllllwith10ls/load_order_fix

reverted index.html change
This commit is contained in:
slweeb 2023-09-30 20:16:41 -04:00 committed by GitHub
commit ce84b33212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 214 deletions

View File

@ -1,24 +1,16 @@
function whenAvailable(names, callback) {
function whenAvailable(name, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
if (window[name]) {
callback();
} else {
whenAvailable(names, callback);
whenAvailable(name, callback);
}
}, interval);
}
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
if(enabledMods.includes(runAfterAutogenMod)){
whenAvailable(["runAfterAutogen"], function() {
whenAvailable("runAfterAutogen", function() {
elements.fluorine = {
color: "#FFFFBF",
@ -419,8 +411,9 @@ trueAcidGases = ["acid_gas", "hydrofluoric_acid_gas"];
if (enabledMods.includes("mods/generative_mods.js")) {
whenAvailable(["generateCloud"], function() {
generateCloud("hydrofluoric_acid");
runAfterLoad(function() {
generateCloud("hydrofluoric_acid");
});
elements["hydrofluoric_acid_gas"].reactions["hydrofluoric_acid_gas"]= { "elem1": null, "elem2": "hydrofluoric_acid_cloud", "chance":0.3, "y":[0,12], "setting":"clouds" };
elements["hydrofluoric_acid_gas"].reactions["rain_cloud"]= { "elem1": null, "elem2": "hydrofluoric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["hydrofluoric_acid_gas"].reactions["cloud"]= { "elem1": null, "elem2": "hydrofluoric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
@ -432,7 +425,6 @@ whenAvailable(["generateCloud"], function() {
elements["cloud"].reactions["anesthesia"] = { elem1:"nitric_acid_cloud", elem2:null, chance:0.05 };
elements["rain_cloud"].reactions["anesthesia"] = { elem1:"nitric_acid_cloud", elem2:null, chance:0.05 };
});
}
function createAcid(name,reactions, gasReactions, color, category, categoryGas, tempHigh, tempLowGas, tempLow, tempHighGas, density, densityGas)
{
@ -479,8 +471,9 @@ function createAcid(name,reactions, gasReactions, color, category, categoryGas,
elements.bless.reactions[name] = { elem2: "hydrogen" };
elements.bless.reactions[name+"_gas"] = { elem2: "hydrogen" };
if (enabledMods.includes("mods/generative_mods.js")) {
whenAvailable(["generateCloud"], function() {
generateCloud(name);
runAfterLoad(function() {
generateCloud(name);
});
elements[name+"_gas"].reactions[name+"_gas"]= { "elem1": null, "elem2": name + "_cloud", "chance":0.3, "y":[0,12], "setting":"clouds" };
elements[name+"_gas"].reactions["rain_cloud"]= { "elem1": null, "elem2": name + "_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements[name+"_gas"].reactions["cloud"]= { "elem1": null, "elem2": name + "_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
@ -488,8 +481,7 @@ function createAcid(name,reactions, gasReactions, color, category, categoryGas,
elements[name+"_gas"].reactions["hail_cloud"]= { "elem1": null, "elem2": name + "_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements[name+"_gas"].reactions["pyrocumulus"]= { "elem1": null, "elem2": name + "_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements[name+"_gas"].reactions["fire_cloud"]= { "elem1": null, "elem2": name + "_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
});
}
}
else
{
elements[name+"_gas"].reactions[name+"_gas"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.3, "y":[0,12], "setting":"clouds" };
@ -2287,24 +2279,24 @@ elements.disinfectant = {
//elements.bauxite = {
// color: ["#915a30","#cc7533"],
// behavior: behaviors.POWDER,
// category: "land",
// density: 2420,
// state: "solid",
// tempHigh: 300
//};
//
//elements.sodium_aluminate = {
// color: ["#e6c9b3","#ebc8ad"],
// behavior: behaviors.POWDER,
// category: "powders",
// hidden: true,
// density: 1500,
// state: "solid",
// tempHigh: 1650
//};
elements.bauxite = {
color: ["#915a30","#cc7533"],
behavior: behaviors.POWDER,
category: "land",
density: 2420,
state: "solid",
tempHigh: 300
};
elements.sodium_aluminate = {
color: ["#e6c9b3","#ebc8ad"],
behavior: behaviors.POWDER,
category: "powders",
hidden: true,
density: 1500,
state: "solid",
tempHigh: 1650
};
function acidReact(acid,element,product1,product2)
{
@ -2355,13 +2347,13 @@ acidNeutralize("potassium_hydroxide");
acidNeutralize("potassium_hydroxide_gas");
//createAcid("red_mud",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#ab3d24","#cc5d2d","#a81b1b"],"hidden","hidden",1600,1600,0,Infinity,5200,3);
//acidNeutralize("red_mud");
//acidNeutralize("red_mud_gas");
//elements.red_mud.viscosity = 1000000;
//elements.red_mud.reactions.water = {"elem2":"dirty_water" };
//elements.red_mud.reactions.salt_water = {"elem2":"dirty_water" };
//elements.red_mud.reactions.sugar_water = {"elem2":"dirty_water" };
createAcid("red_mud",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#ab3d24","#cc5d2d","#a81b1b"],"hidden","hidden",1600,1600,0,Infinity,5200,3);
acidNeutralize("red_mud");
acidNeutralize("red_mud_gas");
elements.red_mud.viscosity = 1000000;
elements.red_mud.reactions.water = {"elem2":"dirty_water" };
elements.red_mud.reactions.salt_water = {"elem2":"dirty_water" };
elements.red_mud.reactions.sugar_water = {"elem2":"dirty_water" };
elements.potassium_hydroxide.reactions["fertilizer"] = { elem1: "niter", elem2: "ammonia"};
elements.potassium_hydroxide_gas.reactions["fertilizer"] = { elem1: "niter", elem2: "ammonia"};
@ -2381,8 +2373,8 @@ elements.potassium_salt_water.reactions["mercury"] = { elem1:["potassium_hydroxi
elements.potassium_hydroxide.ignore.push("mercury");
elements.potassium_hydroxide.ignore.push("potassium_salt_water");
//acidReact("sodium_hydroxide","bauxite","sodium_aluminate","red_mud")
//elements.red_mud.ignore.push("bauxite","sodium_aluminate");
acidReact("sodium_hydroxide","bauxite","sodium_aluminate","red_mud")
elements.red_mud.ignore.push("bauxite","sodium_aluminate");
elements.bless.reactions["FOOF"] = {elem2: "oxygen"};
elements.bless.reactions["solid_FOOF"] = {elem2: "oxygen"};
@ -2415,6 +2407,7 @@ elements.bless.reactions["sulfur_dioxide_ice"] = {elem2: "oxygen"};
elements.bless.reactions["hydrogen_sulfide"] = {elem2: "hydrogen"};
elements.bless.reactions["liquid_hydrogen_sulfide"] = {elem2: "hydrogen"};
elements.bless.reactions["rocket_fuel"] = {elem2: null};
// do something
});
} else {
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.unshift(runAfterAutogenMod) };

View File

@ -1,30 +1,11 @@
function whenAvailable(names, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
callback();
} else {
whenAvailable(names, callback);
}
}, interval);
}
var modName = "mods/generative_mods.js";
var explodeAtPlusMod = "mods/explodeAtPlus.js";
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
var libraryMod = "mods/code_library.js";
var feyAndMoreMod = "mods/fey_and_more.js";
var mobsMod = "mods/mobs.js";
if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlusMod) && enabledMods.includes(libraryMod) && enabledMods.includes(feyAndMoreMod) && enabledMods.includes(mobsMod)) {
whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoaded"], function() {
//urlParams reads
@ -1350,7 +1331,7 @@ whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoade
//Bombs
generateBomb = function(bombElements,isAfterScriptLoading=false,bombNumber=1) {//it can be a single element, though
function generateBomb(bombElements,isAfterScriptLoading=false,bombNumber=1) {//it can be a single element, though
bombNumber = Math.max(0,bombNumber);
//To specify an array bomb, have the array be inside another array.
@ -1509,7 +1490,7 @@ whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoade
//Clouds
generateCloud = function(cloudElements,cloudType=0,isAfterScriptLoading=false) {//it can be a single element, though
function generateCloud(cloudElements,cloudType=0,isAfterScriptLoading=false) {//it can be a single element, though
//To specify an array cloud, have the array be inside another array.
/*For reasons related to how element colors are loaded, if this function is being run from a JS mod file, isAfterScriptLoading should be false.
Otherwise, you'll get TypeErrors for some reason when trying to place your cloud. If this is being run after the game has loaded (e.g. in the console),
@ -1717,7 +1698,7 @@ whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoade
//Creepers
generateCreeper = function(creeperElements,isAfterScriptLoading=false) {//it can be a single element, though
function generateCreeper(creeperElements,isAfterScriptLoading=false) {//it can be a single element, though
//To specify an array creeper, have the array be inside another array.
/*For reasons related to how element colors are loaded, if this function is being run from a JS mod file, isAfterScriptLoading should be false.
Otherwise, you'll get TypeErrors for some reason when trying to place your creeper. If this is being run after the game has loaded (e.g. in the console),
@ -1948,7 +1929,7 @@ whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoade
//Fairies
generateFairy = function(fairyElements,isAfterScriptLoading=false) {//it can be a single element, though
function generateFairy(fairyElements,isAfterScriptLoading=false) {//it can be a single element, though
//To specify an array fairy, have the array be inside another array.
/*For reasons related to how element colors are loaded, if this function is being run from a JS mod file, isAfterScriptLoading should be false.
Otherwise, you'll get TypeErrors for some reason when trying to place your fairy. If this is being run after the game has loaded (e.g. in the console),
@ -2137,7 +2118,7 @@ whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoade
//Spouts
generateSpout = function(spoutElements,isAfterScriptLoading=false) {//it can be a single element, though
function generateSpout(spoutElements,isAfterScriptLoading=false) {//it can be a single element, though
//To specify an array spout, have the array be inside another array.
/*For reasons related to how element colors are loaded, if this function is being run from a JS mod file, isAfterScriptLoading should be false.
Otherwise, you'll get TypeErrors for some reason when trying to place your spout. If this is being run after the game has loaded (e.g. in the console),
@ -2513,7 +2494,6 @@ whenAvailable(["eLists","explodeAtPlus","urlParams","runAfterAutogen","mobsLoade
elements[name].behavior = behaviors.FAIRYKILL;
};
};
});
} else {
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };
if(!enabledMods.includes(explodeAtPlusMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,explodeAtPlusMod) };

View File

@ -1,29 +1,9 @@
function whenAvailable(names, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
callback();
} else {
whenAvailable(names, callback);
}
}, interval);
}
var modName = "mods/metals.js";
var changeTempMod = "mods/changeTempReactionParameter.js";
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
var libraryMod = "mods/code_library.js";
var onTryMoveIntoMod = "mods/onTryMoveInto.js";
if(enabledMods.includes(changeTempMod) && enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod) && enabledMods.includes(onTryMoveIntoMod)) {
whenAvailable(["runAfterAutogen"], function() {
elements.iron.hardness = 0.74
//https://www.engineeringtoolbox.com/bhn-brinell-hardness-number-d_1365.html
//https://en.wikipedia.org/wiki/Hardnesses_of_the_elements_(data_page)
@ -781,7 +761,6 @@ if(enabledMods.includes(changeTempMod) && enabledMods.includes(runAfterAutogenMo
conduct: 0.35,
hardness: 0.7, //idk lol
};
});
} else {
if(!enabledMods.includes(changeTempMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,changeTempMod) };
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };

View File

@ -1,28 +1,9 @@
function whenAvailable(names, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
callback();
} else {
whenAvailable(names, callback);
}
}, interval);
}
var modName = "mods/mobs.js";
var explodeAtPlusMod = "mods/explodeAtPlus.js";
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
var libraryMod = "mods/code_library.js";
var mobsLoaded = false;
if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlusMod) && enabledMods.includes(libraryMod)) {
whenAvailable(["runAfterAutogen","explodeAtPlus"], function() {
//Prerequisite Functions and Variables
minimumCreeperTries = 3;
@ -5136,8 +5117,6 @@ whenAvailable(["runAfterAutogen","explodeAtPlus"], function() {
/* -------------------------
- End skeleton elements -
------------------------- */
mobsLoaded = true;
});
} else {
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };
if(!enabledMods.includes(explodeAtPlusMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,explodeAtPlusMod) };

View File

@ -1,27 +1,8 @@
function whenAvailable(names, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
callback();
} else {
whenAvailable(names, callback);
}
}, interval);
}
var modName = "mods/neutronium_compressor.js";
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) {
whenAvailable(["urlParams","runAfterAutogen"], function() {
var singularityColorTemplate = ["#202020", "#505050", "#b0b0b0", "#c7c7c7"];
singularityNumber = 10000;
@ -407,7 +388,6 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
//Post-generation tasks
});
} else {
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };

View File

@ -1,28 +1,8 @@
function whenAvailable(names, callback) {
var interval = 10; // ms
window.setTimeout(function() {
let bool = true;
for(let i = 0; i < names.length; i++)
{
if(!window[names[i]])
{
bool = false;
}
}
if (bool) {
callback();
} else {
whenAvailable(names, callback);
}
}, interval);
}
var modName = "mods/rays.js";
var runAfterAutogenMod = "mods/runAfterAutogen2.js";
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) {
whenAvailable(["runAfterAutogen","libraryLoaded"], function() {
runAfterAutogen(function() {
snowAndIceCache = Object.keys(elements).filter(function(name) {
return name.endsWith("snow") || name.endsWith("ice") || name == "rime"
@ -455,7 +435,7 @@ whenAvailable(["runAfterAutogen","libraryLoaded"], function() {
}
}
};
});
} else {
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };

View File

@ -1,52 +0,0 @@
//runs after the elements in "names" are defined
function runAfterAutogen(callback) {
var interval = 10; // ms
window.setTimeout(function() {
if (window.autoElements) {
callback();
} else {
runAfterAutogen(callback);
}
}, interval);
}
function createButtonsAndCountElements() {
document.getElementById("categoryControls").innerHTML = "";
document.getElementById("elementControls").innerHTML = "";
document.getElementById("extraInfo").innerHTML = "";
elementCount = 0;
hiddenCount = 0;
categoryList = [];
for (var element in elements) {
elementCount++;
if (settings.cheerful && elements[element].nocheer) {
elements[element].hidden = true;
hiddenCount++;
continue;
}
if (element === "unknown") {continue;}
var category = elements[element].category;
if (category==null) {category="other"}
if (categoryList.indexOf(category) === -1) {
categoryList.push(category);
}
if (elements[element].hidden && (!settings["unhide"] || ( settings["unhide"]===2 && !settings.unlocked[element] ))) { hiddenCount++; continue; }
var categoryDiv = document.getElementById("category-"+category);
if (categoryDiv == null) {
createCategoryDiv(category);
categoryDiv = document.getElementById("category-"+category);
}
createElementButton(element);
}
if (document.getElementById("categoryButton-states")) {
// move it to the end of its parent
document.getElementById("categoryButton-states").parentNode.appendChild(document.getElementById("categoryButton-states"));
}
// Set the first button in categoryControls div to be the current category
document.getElementById("categoryControls").children[0].click()
document.getElementById("extraInfo").insertAdjacentHTML("beforeend", "<small><p>v" + currentversion + " • " + elementCount + " elements, including " + hiddenCount + " hidden ones.</p><p>©2021-" + new Date().getFullYear() + ". All Rights Reserved. <a style='color:#00ffff' href='https://r74n.com'>R74n</a></p></small>");
selectElement(currentElement);
};
runAfterAutogen(createButtonsAndCountElements);

View File

@ -15,7 +15,7 @@ var libHookTickMod = "mods/libhooktick.js";
var propertyLibrary = "mods/special_property_library.js";
//someone retroactively turned off ??= assignment on undeclared variables /hj
if(!window["urlParams"] || !urlParams) { urlParams = new URLSearchParams(window.location.search) };
if(!urlParams) { urlParams = new URLSearchParams(window.location.search) };
modRequirementsPartOne = (enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod));
if(urlParams.get("radiationSystemEnabled") === null) {