Merge branch 'main' of https://github.com/R74nCom/sandboxels
This commit is contained in:
commit
257f452ed3
96
mods/chem.js
96
mods/chem.js
|
|
@ -1,5 +1,24 @@
|
|||
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
|
||||
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 runAfterAutogenMod = "mods/runAfterAutogen2.js";
|
||||
if(enabledMods.includes(runAfterAutogenMod)){
|
||||
whenAvailable(["runAfterAutogen"], function() {
|
||||
|
||||
|
||||
elements.fluorine = {
|
||||
|
|
@ -369,6 +388,7 @@ let defaultAcidReactions = {
|
|||
"grape": { "elem2":"juice", "color1":"#291824" },
|
||||
"soap": { "elem1": "hydrogen" },
|
||||
"sodium": { "elem1":"explosion" },
|
||||
"potassium": { "elem1":"explosion" },
|
||||
"meat": { "elem2":"rotten_meat", "elem1":null, "chance":0.5 },
|
||||
};
|
||||
|
||||
|
|
@ -400,9 +420,8 @@ trueAcidGases = ["acid_gas", "hydrofluoric_acid_gas"];
|
|||
|
||||
|
||||
if (enabledMods.includes("mods/generative_mods.js")) {
|
||||
runAfterLoad(function() {
|
||||
generateCloud("hydrofluoric_acid");
|
||||
});
|
||||
whenAvailable(["generateCloud"], 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" };
|
||||
|
|
@ -414,6 +433,7 @@ if (enabledMods.includes("mods/generative_mods.js")) {
|
|||
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)
|
||||
{
|
||||
|
|
@ -460,10 +480,8 @@ 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")) {
|
||||
runAfterLoad(function() {
|
||||
generateCloud(name);
|
||||
console.log(name);
|
||||
});
|
||||
whenAvailable(["generateCloud"], 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" };
|
||||
|
|
@ -471,7 +489,8 @@ 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" };
|
||||
|
|
@ -636,7 +655,7 @@ elements.ammonia.reactions["oxygen"] = { "elem1": "steam", "elem2": "nitric_oxid
|
|||
|
||||
elements.supernova.behavior = [
|
||||
"XX|XX|XX",
|
||||
"XX|EX:80>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead AND CH:neutronium,neutronium,quark_matter,void|XX",
|
||||
"XX|EX:80>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead,oxygen,molten_sodium,sulfur_gas,fluorine,neon,molten_potassium,chlorine,molten_calcium,molten_titanium,molten_nickel,molten_copper,molten_zinc,gallium_gas,bromine_gas,iodine_gas AND CH:neutronium,neutronium,quark_matter,void|XX",
|
||||
"XX|XX|XX",
|
||||
];
|
||||
|
||||
|
|
@ -645,7 +664,7 @@ elements.gamma_ray_burst = {
|
|||
color: ["#ffb48f","#ffd991","#ffad91"],
|
||||
behavior: [
|
||||
"XX|XX|XX",
|
||||
"XX|EX:100>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_uranium,molten_gold,molten_tungsten,molten_lead AND CH:void|XX",
|
||||
"XX|EX:100>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_gold,molten_uranium,molten_lead,molten_tungsten,molten_nickel,molten_copper,molten_zinc,gallium_gas,bromine_gas,iodine_gas,molten_tin,molten_silver AND CH:void|XX",
|
||||
"XX|XX|XX",
|
||||
],
|
||||
temp: 99999999700,
|
||||
|
|
@ -1944,8 +1963,20 @@ elements.potassium_fluoride = {
|
|||
tempHigh: 858
|
||||
}
|
||||
|
||||
|
||||
elements.soy_sauce = {
|
||||
color: "#470500",
|
||||
behavior: behaviors.LIQUID,
|
||||
tempLow: -5,
|
||||
tempHigh: 105,
|
||||
state: "liquid",
|
||||
category:"liquids",
|
||||
density: 1200,
|
||||
stain: 0.5
|
||||
};
|
||||
|
||||
elements.bromine = {
|
||||
color: "#8a0707",
|
||||
color: "#470500",
|
||||
behavior: behaviors.LIQUID,
|
||||
tick: function(pixel) {
|
||||
if(pixel.temp > 0 && Math.random() < 0.001) {
|
||||
|
|
@ -2256,6 +2287,32 @@ 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
|
||||
//};
|
||||
|
||||
function acidReact(acid,element,product1,product2)
|
||||
{
|
||||
elements[acid].ignore.push(element,product1,product2);
|
||||
elements[acid].reactions[element] = { "elem1": product1, "elem2": product2 };
|
||||
}
|
||||
|
||||
let defaultBaseReactions = {
|
||||
"grape": { "elem2":"juice", "color1":"#291824" },
|
||||
"sodium": { "elem1":"pop" },
|
||||
|
|
@ -2268,6 +2325,7 @@ let defaultBaseGasReactions = {
|
|||
"meat": { "elem2":"rotten_meat", "elem1":null, "chance":0.4 },
|
||||
}
|
||||
|
||||
|
||||
createAcid("francium_hydroxide",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#863bff","#4d00ca","#897b9e"],"hidden","hidden",100,100,0,1000,1010,1)
|
||||
|
||||
function acidNeutralize(base)
|
||||
|
|
@ -2296,6 +2354,17 @@ acidNeutralize("sodium_hydroxide_gas");
|
|||
createAcid("potassium_hydroxide",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#3bc4ff","#0062ca","#7b949e"],"liquids","hidden",100,100,0,1000,1020,1);
|
||||
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" };
|
||||
|
||||
|
||||
elements.potassium_hydroxide.reactions["fertilizer"] = { elem1: "niter", elem2: "ammonia"};
|
||||
elements.potassium_hydroxide_gas.reactions["fertilizer"] = { elem1: "niter", elem2: "ammonia"};
|
||||
elements.potassium_hydroxide.ignore.push("fertilizer","niter","ammonia");
|
||||
|
|
@ -2314,6 +2383,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");
|
||||
|
||||
elements.bless.reactions["FOOF"] = {elem2: "oxygen"};
|
||||
elements.bless.reactions["solid_FOOF"] = {elem2: "oxygen"};
|
||||
|
|
@ -2346,6 +2417,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};
|
||||
});
|
||||
} else {
|
||||
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.unshift(runAfterAutogenMod) };
|
||||
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
|
||||
|
|
|
|||
|
|
@ -1,11 +1,30 @@
|
|||
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/runAfterAutogen and onload restructure.js";
|
||||
var runAfterAutogenMod = "mods/runAfterAutogen2.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
|
||||
|
||||
|
|
@ -1331,7 +1350,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
|
|||
|
||||
//Bombs
|
||||
|
||||
function generateBomb(bombElements,isAfterScriptLoading=false,bombNumber=1) {//it can be a single element, though
|
||||
generateBomb = function(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.
|
||||
|
|
@ -1490,7 +1509,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
|
|||
|
||||
//Clouds
|
||||
|
||||
function generateCloud(cloudElements,cloudType=0,isAfterScriptLoading=false) {//it can be a single element, though
|
||||
generateCloud = function(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),
|
||||
|
|
@ -1698,7 +1717,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
|
|||
|
||||
//Creepers
|
||||
|
||||
function generateCreeper(creeperElements,isAfterScriptLoading=false) {//it can be a single element, though
|
||||
generateCreeper = function(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),
|
||||
|
|
@ -1929,7 +1948,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
|
|||
|
||||
//Fairies
|
||||
|
||||
function generateFairy(fairyElements,isAfterScriptLoading=false) {//it can be a single element, though
|
||||
generateFairy = function(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),
|
||||
|
|
@ -2118,7 +2137,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
|
|||
|
||||
//Spouts
|
||||
|
||||
function generateSpout(spoutElements,isAfterScriptLoading=false) {//it can be a single element, though
|
||||
generateSpout = function(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),
|
||||
|
|
@ -2494,6 +2513,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
|
|||
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) };
|
||||
|
|
|
|||
|
|
@ -1,9 +1,29 @@
|
|||
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/runAfterAutogen and onload restructure.js";
|
||||
var runAfterAutogenMod = "mods/runAfterAutogen2.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)
|
||||
|
|
@ -761,6 +781,7 @@ 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) };
|
||||
|
|
|
|||
25
mods/mobs.js
25
mods/mobs.js
|
|
@ -1,9 +1,28 @@
|
|||
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/runAfterAutogen and onload restructure.js";
|
||||
var runAfterAutogenMod = "mods/runAfterAutogen2.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;
|
||||
|
|
@ -5117,6 +5136,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
|
|||
/* -------------------------
|
||||
- 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) };
|
||||
|
|
|
|||
|
|
@ -1,8 +1,27 @@
|
|||
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/runAfterAutogen and onload restructure.js";
|
||||
var runAfterAutogenMod = "mods/runAfterAutogen2.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;
|
||||
|
|
@ -388,6 +407,7 @@ 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) };
|
||||
|
|
|
|||
24
mods/rays.js
24
mods/rays.js
|
|
@ -1,8 +1,28 @@
|
|||
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/runAfterAutogen and onload restructure.js";
|
||||
var runAfterAutogenMod = "mods/runAfterAutogen2.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"
|
||||
|
|
@ -435,7 +455,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
} else {
|
||||
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
|
||||
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
//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);
|
||||
|
|
@ -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(!urlParams) { urlParams = new URLSearchParams(window.location.search) };
|
||||
if(!window["urlParams"] || !urlParams) { urlParams = new URLSearchParams(window.location.search) };
|
||||
|
||||
modRequirementsPartOne = (enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod));
|
||||
if(urlParams.get("radiationSystemEnabled") === null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue