This commit is contained in:
slweeb 2023-05-12 17:56:52 -04:00
commit 4026c72e2e
22 changed files with 2361 additions and 1726 deletions

View File

@ -1,3 +1,8 @@
var modName = "mods/boiling_things.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
//glass { //glass {
elements.molten_glass = { elements.molten_glass = {
@ -136,6 +141,51 @@
//} //}
//carbon dioxide {
/*fuck this, i can't work out the offset-infested math
function carbonDioxideDecompRatio(temp) {
//
// K is the ratio of O_2 to CO_2
// If K = 100, there is 100 times more O_2
// If K = 1, there is a 1:1 ratio
//
return Math.E**(((1110190+(13.083*(temp-298)))-(temp*(149.498+(13.083*(Math.log(temp/298))))))/(-8.31446*temp))
}
function carbonDioxideDecompChance(temp) {
//Expected 0.5 at 6275.6434478747902
if(typeof(temp) === "undefined") {
throw new Error("Temp must be specified~");
};
if(typeof(temp) == "string") {
temp = parseFloat(temp);
};
if(isNaN(temp)) {
throw new TypeError(typeof(temp) == "number" ? "Temp cannot be NaN~" : "Temp must be a number~");
};
if(temp == Infinity) {
return 1;
};
if(temp <= 0) {
return 0;
};
var K = carbonDioxideDecompRatio(temp);
return 1-(1/(K+1));
};
*/
var hasNM = enabledMods.includes("mods/Neutronium Mod.js");
//Mass given is the molar mass of O_2 molecule (31.999 g)
//O_2 bond energy is 495 kJ/mol
//Heat capacity is 0.918 J/(g*K)
//in case the link goes down: c = Q/(m * delta-T); c = capacity, m = mass, delta-T = temp change, energy = Q
//https://www.calctool.org/thermodynamics/specific-heat
tupleAdverbs = ['Nullly', 'Singly', 'Doubly', 'Triply', 'Quadruply', 'Quintuply', 'Sextuply', 'Septuply', 'Octuply', 'Nonuply', 'Decuply', 'Undecuply', 'Duodecuply', 'Tredecuply', 'Quattuordecuply', 'Quindecuply', 'Sexdecuply', 'Septendecuply', 'Octodecuply', 'Novemdecuply', 'Vigintuply', 'Unvigintuply', 'Duovigintuply', 'Trevigintuply', 'Quattuorvigintuply', 'Quinvigintuply', 'Sexvigintuply', 'Septenvigintuply', 'Octovigintuply', 'Novemvigintuply', 'Trigintuply'].map(x => x.toLowerCase());
//}
// baking soda { // baking soda {
elements.baking_soda.tempHigh = 150, elements.baking_soda.tempHigh = 150,
@ -300,7 +350,7 @@
} }
//} //}
/*
// clay { // clay {
if(!elements.baked_clay) { if(!elements.baked_clay) {
@ -380,7 +430,7 @@
}, },
//} //}
*/
// salt { // salt {
elements.molten_salt = { elements.molten_salt = {
@ -473,13 +523,18 @@ runAfterLoad(function() {
elements.concoction.reactions.vaporized_calcium = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.vaporized_calcium = { "elem1": "mistake", "elem2": null }
elements.concoction.reactions.hot_calcium_cloud = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.hot_calcium_cloud = { "elem1": "mistake", "elem2": null }
elements.concoction.reactions.cold_calcium_cloud = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.cold_calcium_cloud = { "elem1": "mistake", "elem2": null }
/*elements.concoction.reactions.molten_clay = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.molten_clay = { "elem1": "mistake", "elem2": null }
elements.concoction.reactions.vaporized_clay = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.vaporized_clay = { "elem1": "mistake", "elem2": null }
elements.concoction.reactions.hot_clay_cloud = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.hot_clay_cloud = { "elem1": "mistake", "elem2": null }
elements.concoction.reactions.cold_clay_cloud = { "elem1": "mistake", "elem2": null }*/ elements.concoction.reactions.cold_clay_cloud = { "elem1": "mistake", "elem2": null }
elements.concoction.reactions.vaporized_salt = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.vaporized_salt = { "elem1": "mistake", "elem2": null }
elements.concoction.reactions.hot_salt_cloud = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.hot_salt_cloud = { "elem1": "mistake", "elem2": null }
elements.concoction.reactions.cold_salt_cloud = { "elem1": "mistake", "elem2": null } elements.concoction.reactions.cold_salt_cloud = { "elem1": "mistake", "elem2": null }
}; };
}); });
} else {
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
};

View File

@ -1,3 +1,7 @@
var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
if(enabledMods.includes(runAfterAutogenMod)){
elements.fluorine = { elements.fluorine = {
color: "#FFFFBF", color: "#FFFFBF",
behavior: behaviors.GAS, behavior: behaviors.GAS,
@ -449,6 +453,8 @@ function createAcid(name,reactions, gasReactions, color, colorGas, category, cat
state: "gas", state: "gas",
density: densityGas, density: densityGas,
} }
elements.bless.reactions[name] = { elem2: "hydrogen" };
elements.bless.reactions[name+"_gas"] = { elem2: "hydrogen" };
if (enabledMods.includes("mods/generative_mods.js")) { if (enabledMods.includes("mods/generative_mods.js")) {
runAfterLoad(function() { runAfterLoad(function() {
generateCloud(name); generateCloud(name);
@ -498,7 +504,7 @@ if (!enabledMods.includes("mods/generative_mods.js")) {
]; ];
} }
createAcid("nitric_acid",defaultAcidReactions,defaultAcidGasReactions,["#5ee9c7","#7ac2b1","#7c9f96"],["#78edd2","#8eccbe","#8aa8a1"],"liquids","gases",83,70,-42,400,1500,1.5) createAcid("nitric_acid",defaultAcidReactions,defaultAcidGasReactions,["#91993c","#6b7041","#5f614b"],["#c9d457","#94996e","#abb07f"],"liquids","gases",83,70,-42,400,1500,1.5)
elements.nitric_acid.reactions["ammonia"] = { "elem1": "fertilizer", "elem2": null}; elements.nitric_acid.reactions["ammonia"] = { "elem1": "fertilizer", "elem2": null};
elements.nitric_acid_gas.reactions["ammonia"] = { "elem1": "fertilizer", "elem2": null}; elements.nitric_acid_gas.reactions["ammonia"] = { "elem1": "fertilizer", "elem2": null};
@ -523,14 +529,14 @@ elements.liquid_nitric_oxide = {
tempLow: -164, tempLow: -164,
hidden: true, hidden: true,
}; };
elements.nitrogen_dioxide = { elements.nitrogen_dioxide = {
color: "#964B00", color: "#964B00",
behavior: behaviors.GAS, behavior: behaviors.GAS,
reactions: { reactions: {
"steam": { "elem1": "smog", "elem2": null, "chance":0.01 }, "steam": { "elem1": "smog", "elem2": null, "chance":0.01 },
"blood": { "elem1":null, "elem2":"infection", "chance":0.01 }, "blood": { "elem1":null, "elem2":"infection", "chance":0.01 },
"water": { "elem1":null, "elem2":"acid", "chance":0.01 }, "water": { "elem1":null, "elem2":"nitric_acid", "chance":0.01 },
"dirty_water": { "elem1":null, "elem2":"nitric_acid", "chance":0.01 },
"plant": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "plant": { "elem1":null, "elem2":"dead_plant", "chance":0.01 },
"grass": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "grass": { "elem1":null, "elem2":"dead_plant", "chance":0.01 },
"algae": { "elem1":null, "elem2":null, "chance":0.01 }, "algae": { "elem1":null, "elem2":null, "chance":0.01 },
@ -554,14 +560,7 @@ elements.nitrogen_dioxide = {
"pistil": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "pistil": { "elem1":null, "elem2":"dead_plant", "chance":0.01 },
"petal": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "petal": { "elem1":null, "elem2":"dead_plant", "chance":0.01 },
"grass_seed": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "grass_seed": { "elem1":null, "elem2":"dead_plant", "chance":0.01 },
"meat": { "elem1":null, "elem2":"rotten_meat", "chance":0.01 }, "meat": { "elem1":null, "elem2":"rotten_meat", "chance":0.01 }
//clouds
"rain_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" },
"cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" },
"snow_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" },
"hail_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" },
"pyrocumulus": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" },
"fire_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" },
}, },
temp: 30, temp: 30,
tempLow: 21.15, tempLow: 21.15,
@ -576,6 +575,26 @@ elements.liquid_nitrogen_dioxide = {
reactions: structuredClone(elements.nitrogen_dioxide.reactions), reactions: structuredClone(elements.nitrogen_dioxide.reactions),
}; };
if (enabledMods.includes("mods/generative_mods.js")) {
elements["nitrogen_dioxide"].reactions["rain_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["snow_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["hail_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["pyrocumulus"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["fire_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["thunder_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
}
else
{
elements["nitrogen_dioxide"].reactions["rain_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["snow_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["hail_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["pyrocumulus"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["fire_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
elements["nitrogen_dioxide"].reactions["thunder_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" };
}
acidIgnore(["nitric_oxide","liquid_nitric_oxide","nitric_oxide_ice","nitrogen_dioxide","liquid_nitrogen_dioxide","nitrogen_dioxide_ice"]); acidIgnore(["nitric_oxide","liquid_nitric_oxide","nitric_oxide_ice","nitrogen_dioxide","liquid_nitrogen_dioxide","nitrogen_dioxide_ice"]);
elements.fertilizer = { elements.fertilizer = {
@ -610,7 +629,7 @@ elements.ammonia.reactions["oxygen"] = { "elem1": "steam", "elem2": "nitric_oxid
elements.supernova.behavior = [ elements.supernova.behavior = [
"XX|XX|XX", "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,neutronium,liquid_neutronium,quark_matter,void|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|XX|XX", "XX|XX|XX",
]; ];
@ -645,10 +664,11 @@ elements.neutronium = {
stateHigh: "liquid_neutronium", stateHigh: "liquid_neutronium",
tempLow: 1e5, tempLow: 1e5,
stateLow: ["molten_uranium","molten_gold","molten_tungsten","molten_lead"], stateLow: ["molten_uranium","molten_gold","molten_tungsten","molten_lead"],
breakInto: "gamma_ray_burst", breakInto: ["gamma_ray_burst","supernova","supernova"],
category: "special", category: "special",
state: "solid", state: "solid",
density: 4e17, density: 4e17,
hardness: 0.999,
excludeRandom: true, excludeRandom: true,
}; };
@ -697,10 +717,11 @@ elements.liquid_neutronium = {
temp: 2e7, temp: 2e7,
tempLow: 1e7, tempLow: 1e7,
stateLow: "neutronium", stateLow: "neutronium",
breakInto: "gamma_ray_burst", breakInto: ["gamma_ray_burst","supernova","supernova"],
category: "special", category: "special",
state: "liquid", state: "liquid",
density: 2e17, density: 2e17,
hardness: 0.999,
excludeRandom: true, excludeRandom: true,
}; };
@ -763,13 +784,12 @@ elements.quark_matter = {
tick: function(pixel) { tick: function(pixel) {
pixel.color = pixelColorPick(pixel); pixel.color = pixelColorPick(pixel);
}, },
tempHigh: 1e8,
temp: 2e7, temp: 2e7,
stateHigh: "gamma_ray_burst",
breakInto: "gamma_ray_burst", breakInto: "gamma_ray_burst",
category: "special", category: "special",
state: "liquid", state: "liquid",
density: 4e18, density: 4e18,
hardness: 0.999,
excludeRandom: true, excludeRandom: true,
}; };
@ -889,7 +909,7 @@ elements.iron_chloride = {
density: 2900, density: 2900,
} }
createAcid("sulfuric_acid",defaultAcidReactions,defaultAcidGasReactions,["#e9e05e","#c2bd7a","#9e9c7b"],["#ede579","#ccc88f","#a8a68a"],"liquids","gases",337,337,10,500,1830,1.26) createAcid("sulfuric_acid",structuredClone(defaultAcidReactions),structuredClone(defaultAcidGasReactions),["#e9e05e","#c2bd7a","#9e9c7b"],["#ede579","#ccc88f","#a8a68a"],"liquids","gases",337,337,10,500,1830,1.26)
elements.sulfuric_acid.ignore.push("charcoal"); elements.sulfuric_acid.ignore.push("charcoal");
elements.sulfuric_acid_gas.ignore.push("charcoal"); elements.sulfuric_acid_gas.ignore.push("charcoal");
@ -1603,6 +1623,138 @@ elements.big_pop = {
hidden: true, hidden: true,
}; };
elements.potassium_salt_water = {
color: "#416ed1",
behavior: behaviors.LIQUID,
tempHigh: 102,
stateHigh: ["steam","potassium_salt"],
tempLow: -2,
stateLowName: "potassium_salt_ice",
category: "liquids",
reactions: {
"dirt": { elem1: null, elem2: "mud" },
"sand": { elem1: null, elem2: "wet_sand" },
"clay_soil": { elem1: null, elem2: "clay" },
"dust": { elem1: "dirty_water", elem2: null },
"ash": { elem1: "dirty_water", elem2: null },
"carbon_dioxide": { elem1: "dirty_water", elem2: null },
"sulfur": { elem1: "dirty_water", elem2: null },
"charcoal": { elem1: "dirty_water", chance:0.005 },
"rat": { elem1: "dirty_water", chance:0.005 },
"plague": { elem1: "dirty_water", elem2: null },
"fallout": { elem1: "dirty_water", chance:0.25 },
"radiation": { elem1: "dirty_water", chance:0.25 },
"rust": { elem1: "dirty_water", chance:0.005 },
"quicklime": { elem1: null, elem2: "slaked_lime" },
"rock": { elem2: "wet_sand", chance: 0.0005 },
"fly": { elem2:"dead_bug", chance:0.1, "oneway":true },
"firefly": { elem2:"dead_bug", chance:0.1, "oneway":true },
"bee": { elem2:"dead_bug", chance:0.05, "oneway":true },
"stink_bug": { elem2:"dead_bug", chance:0.1, "oneway":true },
"cancer": { elem1: "dirty_water", chance:0.25 },
// electrolysis:
"aluminum": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0025 },
"zinc": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.015 },
"steel": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0125 },
"iron": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0125 },
"tin": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.01 },
"lead": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.01 },
"brass": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.001 },
"bronze": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.001 },
"copper": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0075 },
"silver": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0075 },
"gold": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0075 },
},
state: "liquid",
density: 1026,
conduct: 0.1,
stain: -0.66
};
elements.potassium = {
color: ["#8e8ba3","#8797a8","#7d6a75","#879dad"],
tick: function(pixel) {
for (var i = 0; i < adjacentCoords.length; i++) {
var x = pixel.x+adjacentCoords[i][0];
var y = pixel.y+adjacentCoords[i][1];
if (isEmpty(x,y)) {
if (Math.random() < 0.005) { deletePixel(pixel.x,pixel.y) }
break
} } },
reactions: {
"chlorine": { elem1:"potassium_salt", elem2:"big_pop" },
"water": { elem1:"big_pop" },
"salt_water": { elem1:"big_pop" },
"sugar_water": { elem1:"big_pop" },
"dirty_water": { elem1:"big_pop" },
"seltzer": { elem1:"big_pop" },
"acid": { elem1:"explosion" }
},
tempHigh: 63.5,
category: "solids",
state: "solid",
density: 890,
conduct: 0.85,
hardness: 0.04,
burn:40,
burnTime: 200,
fireColor: ["#ff00ee","#ff6bf5"]
};
elements.molten_potassium = {
tempLow: 63.5,
tempHigh: 757.6,
burn:40,
burnTime: 200,
fireColor: ["#ff00ee","#ff6bf5"],
reactions: {
"chlorine": { elem1:"potassium_salt", elem2:"big_pop" },
"water": { elem1:"big_pop" },
"salt_water": { elem1:"big_pop" },
"sugar_water": { elem1:"big_pop" },
"dirty_water": { elem1:"big_pop" },
"seltzer": { elem1:"big_pop" },
"acid": { elem1:"explosion" }
}
};
elements.potassium_gas = {
color: "#5e6fdb"
};
runAfterAutogen(function() {
elements.molten_salt.reactions = {};
elements.molten_salt.reactions.aluminum = { elem1:["sodium","chlorine"], charged:true, chance:0.0025 };
elements.molten_salt.reactions.zinc = { elem1:["sodium","chlorine"], charged:true, chance:0.015 };
elements.molten_salt.reactions.steel = { elem1:["sodium","chlorine"], charged:true, chance:0.0125 };
elements.molten_salt.reactions.iron = { elem1:["sodium","chlorine"], charged:true, chance:0.0125 };
elements.molten_salt.reactions.tin = { elem1:["sodium","chlorine"], charged:true, chance:0.01 };
elements.molten_salt.reactions.lead = { elem1:["sodium","chlorine"], charged:true, chance:0.01 };
elements.molten_salt.reactions.brass = { elem1:["sodium","chlorine"], charged:true, chance:0.001 };
elements.molten_salt.reactions.bronze = { elem1:["sodium","chlorine"], charged:true, chance:0.001 };
elements.molten_salt.reactions.copper = { elem1:["sodium","chlorine"], charged:true, chance:0.0075 };
elements.molten_salt.reactions.silver = { elem1:["sodium","chlorine"], charged:true, chance:0.0075 };
elements.molten_salt.reactions.gold = { elem1:["sodium","chlorine"], charged:true, chance:0.0075 };
elements.molten_salt.conduct = 0.7;
elements.molten_potassium_salt.reactions = {};
elements.molten_potassium_salt.reactions.aluminum = { elem1:["potassium","chlorine"], charged:true, chance:0.0025 };
elements.molten_potassium_salt.reactions.zinc = { elem1:["potassium","chlorine"], charged:true, chance:0.015 };
elements.molten_potassium_salt.reactions.steel = { elem1:["potassium","chlorine"], charged:true, chance:0.0125 };
elements.molten_potassium_salt.reactions.iron = { elem1:["potassium","chlorine"], charged:true, chance:0.0125 };
elements.molten_potassium_salt.reactions.tin = { elem1:["potassium","chlorine"], charged:true, chance:0.01 };
elements.molten_potassium_salt.reactions.lead = { elem1:["potassium","chlorine"], charged:true, chance:0.01 };
elements.molten_potassium_salt.reactions.brass = { elem1:["potassium","chlorine"], charged:true, chance:0.001 };
elements.molten_potassium_salt.reactions.bronze = { elem1:["potassium","chlorine"], charged:true, chance:0.001 };
elements.molten_potassium_salt.reactions.copper = { elem1:["potassium","chlorine"], charged:true, chance:0.0075 };
elements.molten_potassium_salt.reactions.silver = { elem1:["potassium","chlorine"], charged:true, chance:0.0075 };
elements.molten_potassium_salt.reactions.gold = { elem1:["potassium","chlorine"], charged:true, chance:0.0075 };
elements.molten_potassium_salt.conduct = 0.7;
delete elements.molten_potassium_salt.burn;
delete elements.molten_potassium.burn;
});
elements.potassium_salt.hidden = false;
let defaultBaseReactions = { let defaultBaseReactions = {
"grape": { "elem2":"juice", "color1":"#291824" }, "grape": { "elem2":"juice", "color1":"#291824" },
@ -1636,3 +1788,52 @@ delete elements.francium_hydroxide.burn;
delete elements.francium_hydroxide_gas.burn; delete elements.francium_hydroxide_gas.burn;
acidNeutralize("francium_hydroxide"); acidNeutralize("francium_hydroxide");
acidNeutralize("francium_hydroxide_gas"); acidNeutralize("francium_hydroxide_gas");
createAcid("sodium_hydroxide",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#fc3bff","#c000ca","#9b7b9e"],["#f36cff","#be40d7","#b69cb6"],"liquids","hidden",100,100,0,1000,1010,1);
acidNeutralize("sodium_hydroxide");
acidNeutralize("sodium_hydroxide_gas");
createAcid("potassium_hydroxide",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#3bc4ff","#0062ca","#7b949e"],["#6eecff","#40c5d7","#9cb1b6"],"liquids","hidden",100,100,0,1000,1020,1);
acidNeutralize("potassium_hydroxide");
acidNeutralize("potassium_hydroxide_gas");
elements.salt_water.reactions["mercury"] = { elem1:["sodium_hydroxide","chlorine","hydrogen"], charged:true, chance:0.02 };
elements.sodium_hydroxide.ignore.push("mercury");
elements.potassium_hydroxide.ignore.push("salt_water");
elements.potassium_salt_water.reactions["mercury"] = { elem1:["potassium_hydroxide","chlorine","hydrogen"], charged:true, chance:0.02 };
elements.potassium_hydroxide.ignore.push("mercury");
elements.potassium_hydroxide.ignore.push("potassium_salt_water");
elements.bless.reactions["FOOF"] = {elem2: "oxygen"};
elements.bless.reactions["solid_FOOF"] = {elem2: "oxygen"};
elements.bless.reactions["fluorine"] = {elem2: null};
elements.bless.reactions["liquid_fluorine"] = {elem2: null};
elements.bless.reactions["fluorine_ice"] = {elem2: null};
elements.bless.reactions["hydrogen_fluoride"] = {elem2: "hydrogen"};
elements.bless.reactions["liquid_hydrogen_fluoride"] = {elem2: "hydrogen"};
elements.bless.reactions["hydrogen_fluoride_ice"] = {elem2: "hydrogen"};
elements.bless.reactions["hydrofluoric_acid"] = {elem2: "hydrogen"};
elements.bless.reactions["liquid_hydrofluoric_acid"] = {elem2: "hydrogen"};
elements.bless.reactions["hydrofluoric_acid_ice"] = {elem2: "hydrogen"};
elements.bless.reactions["francium"] = {elem2: null};
elements.bless.reactions["molten_francium"] = {elem2: null};
elements.bless.reactions["radon"] = {elem2: null};
elements.bless.reactions["polonium"] = {elem2: null};
elements.bless.reactions["molten_polonium"] = {elem2: null};
elements.bless.reactions["neutronium"] = {elem2: "neutron"};
elements.bless.reactions["liquid_neutronium"] = {elem2: "neutron"};
elements.bless.reactions["quark_matter"] = {elem2: ["neutron","proton"]};
elements.bless.reactions["gamma_ray_burst"] = {elem2: null};
elements.bless.reactions["nitrogen_dioxide"] = {elem2: "oxygen"};
elements.bless.reactions["liquid_nitrogen_dioxide"] = {elem2: "oxygen"};
elements.bless.reactions["sulfur_dioxide"] = {elem2: "oxygen"};
elements.bless.reactions["liquid_sulfur_dioxide"] = {elem2: "oxygen"};
elements.bless.reactions["sulfur_dioxide_ice"] = {elem2: "oxygen"};
elements.bless.reactions["hydrogen_sulfide"] = {elem2: "hydrogen"};
elements.bless.reactions["liquid_hydrogen_sulfide"] = {elem2: "hydrogen"};
} else {
if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) };
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The "${runAfterAutogenMod}" is required and have been automatically inserted (reload for this to take effect).`);
};

View File

@ -5,10 +5,10 @@ if(enabledMods.includes(haseuliteMod)) {
fakeDate = urlParams.get('fakeDate'); fakeDate = urlParams.get('fakeDate');
shortenedTest = (urlParams.get('shortenedTest') !== null); shortenedTest = (urlParams.get('shortenedTest') !== null);
loonaObject = { idolData = {
"08-01": [ "08-01": [
{member: "Seo Dahyun", color: "rgb(251,160,227)", group: "tripleS"}, {member: "Seo Dahyun", color: "rgb(251,160,227)", group: "tripleS"},
{member: "Kwak Yeonji",color: "rgb(89,116,255)",group: "tripleS"},//Fod gucking damn it {member: "Kwak Yeonji", color: "rgb(89,116,255)", group: "tripleS"},
], ],
"23-01": {member: "Isa", color: "rgb(0,0,0)", group: "STAYC"}, "23-01": {member: "Isa", color: "rgb(0,0,0)", group: "STAYC"},
"01-02": {member: "Jihyo", color: "rgb(250,200,87)", group: "Twice"}, "01-02": {member: "Jihyo", color: "rgb(250,200,87)", group: "Twice"},
@ -19,35 +19,46 @@ if(enabledMods.includes(haseuliteMod)) {
"09-02": {member: "Kim Yooyeon", color: "rgb(205,102,171)", group: "tripleS"}, "09-02": {member: "Kim Yooyeon", color: "rgb(205,102,171)", group: "tripleS"},
"21-02": {member: "Leeseo", color: "rgb(255,240,1)", group: "IVE"}, "21-02": {member: "Leeseo", color: "rgb(255,240,1)", group: "IVE"},
"10-02": {member: "Kim Lip", color: "rgb(234,2,1)", group: "Loona"}, "10-02": {member: "Kim Lip", color: "rgb(234,2,1)", group: "Loona"},
"02-03": {member: "Dayeon", color: "rgb", group: "Kep1er"},
"10-03": {member: "Kotone", color: "rgb(255,246,84)", group: "tripleS"}, "10-03": {member: "Kotone", color: "rgb(255,246,84)", group: "tripleS"},
"12-03": {member: "Hikaru", color:"rgb", group: "Kep1er"},
"13-03": {member: "Sumin", color: "rgb(255,192,203)", group: "STAYC"}, "13-03": {member: "Sumin", color: "rgb(255,192,203)", group: "STAYC"},
"24-03": {member: "Mina", color: "rgb(111,197,194)", group: "Twice"}, "24-03": {member: "Mina", color: "rgb(111,197,194)", group: "Twice"},
"12-04": {member: "Jeong Hyerin", color: "rgb(142,108,255)", group: "tripleS"}, "12-04": {member: "Jeong Hyerin", color: "rgb(142,108,255)", group: "tripleS"},
"14-04": {member: "Yoon",color: "rgb(50,205,50)",group: "STAYC"},//so pretty soijejdsjiodiopziajreldkxf "14-04": {member: "Yoon", color: "rgb(50,205,50)", group: "STAYC"},
"23-04": {member: "Chaeyoung", color: "rgb(255,23,68)", group: "Twice"}, "23-04": {member: "Chaeyoung", color: "rgb(255,23,68)", group: "Twice"},
"26-04": {member: "Chaehyun", color:"rgb", group: "Kep1er"},
"24-05": {member: "Yves", color: "rgb(125,0,30)", group: "Loona"}, "24-05": {member: "Yves", color: "rgb(125,0,30)", group: "Loona"},
"28-05": {member: "Dahyun", color: "rgb(255,255,255)", group: "Twice"}, "28-05": {member: "Dahyun", color: "rgb(255,255,255)", group: "Twice"},
"02-06": {member: "Nien", color: "rgb(255,149,64)", group: "tripleS"},
"04-06": {member: "Choerry", color: "rgb(92,44,146)", group: "Loona"}, "04-06": {member: "Choerry", color: "rgb(92,44,146)", group: "Loona"},
"13-06": {member: "JinSoul", color: "rgb(20,36,176)", group: "Loona"}, "13-06": {member: "JinSoul", color: "rgb(20,36,176)", group: "Loona"},
"14-06": [ "14-06": [
{member: "Seeun", color: "rgb(135,206,235)", group: "STAYC"}, {member: "Seeun", color: "rgb(135,206,235)", group: "STAYC"},
{member: "Tzuyu", color: "rgb(2,119,189)", group: "Twice"} {member: "Tzuyu", color: "rgb(2,119,189)", group: "Twice"}
], ],
"27-07": {member: "Huening Bahiyyih", color:"rgb", group: "Kep1er"},
"01-08": {member: "Sieun", color: "rgb(255,255,255)", group: "STAYC"}, "01-08": {member: "Sieun", color: "rgb(255,255,255)", group: "STAYC"},
"06-08": {member: "Yoon Seoyeon", color: "rgb(34,174,255)", group: "tripleS"}, "06-08": {member: "Yoon Seoyeon", color: "rgb(34,174,255)", group: "tripleS"},
"12-08": {member: "Choi Yujin", color:"rgb", group: "Kep1er"},
"18-08": {member: "HaSeul", color: "rgb(0,166,81)", group: "Loona"}, "18-08": {member: "HaSeul", color: "rgb(0,166,81)", group: "Loona"},
"22-08": {member: "Yeseo", color:"rgb", group: "Kep1er"},
"31-08": {member: "Wonyoung", color: "rgb(255,0,30)", group: "IVE"},//stay mad "31-08": {member: "Wonyoung", color: "rgb(255,0,30)", group: "IVE"},//stay mad
"01-09": {member: "Yujin", color: "rgb(255,57,154)", group: "IVE"}, "01-09": {member: "Yujin", color: "rgb(255,57,154)", group: "IVE"},
"22-09": {member: "Nayeon", color: "rgb(129,212,250)", group: "Twice"}, "22-09": {member: "Nayeon", color: "rgb(129,212,250)", group: "Twice"},
"24-09": {member: "Gaeul", color: "rgb(0,85,168)", group: "IVE"}, "24-09": {member: "Gaeul", color: "rgb(0,85,168)", group: "IVE"},
"03-10": {member: "Kim Soomin", color: "rgb(236,138,165)", group: "tripleS"}, "03-10": {member: "Kim Soomin", color: "rgb(236,138,165)", group: "tripleS"},
"13-10": {member: "Kim Nakyoung",color: "rgb(101,153,164)",group: "tripleS"}, "13-10": [
{member: "Kim Nakyoung", color: "rgb(101,153,164)", group: "tripleS"},
{member: "Park Sohyun", color: "rgb(19,34,182)", group: "tripleS"},
],
"19-10": {member: "HeeJin", color: "rgb(255,0,146)", group: "Loona"}, "19-10": {member: "HeeJin", color: "rgb(255,0,146)", group: "Loona"},
"20-10": {member: "Chuu", color: "rgb(246,144,126)", group: "Loona"}, "20-10": {member: "Chuu", color: "rgb(246,144,126)", group: "Loona"},
"24-10": {member: "Lee Jiwoo", color: "rgb(255,249,36)", group: "tripleS"}, "24-10": {member: "Lee Jiwoo", color: "rgb(255,249,36)", group: "tripleS"},
"01-11": {member: "Jeongyeon", color: "rgb(188,215,118)", group: "Twice"}, "01-11": {member: "Jeongyeon", color: "rgb(188,215,118)", group: "Twice"},
"09-11": {member: "Momo", color: "rgb(248,207,215)", group: "Twice"}, "09-11": {member: "Momo", color: "rgb(248,207,215)", group: "Twice"},
"11-11": {member: "YeoJin", color: "rgb(244,111,31)", group: "Loona"}, "11-11": {member: "YeoJin", color: "rgb(244,111,31)", group: "Loona"},
"12-11": {member: "Xiaoting", color:"rgb", group: "Kep1er"},
"13-11": {member: "Olivia Hye", color: "rgb(143,143,143)", group: "Loona"}, "13-11": {member: "Olivia Hye", color: "rgb(143,143,143)", group: "Loona"},
"15-11": {member: "HyunJin", color: "rgb(255,204,0)", group: "Loona"}, "15-11": {member: "HyunJin", color: "rgb(255,204,0)", group: "Loona"},
"19-11": {member: "Go Won", color: "rgb(48,195,156)", group: "Loona"}, "19-11": {member: "Go Won", color: "rgb(48,195,156)", group: "Loona"},
@ -57,18 +68,20 @@ if(enabledMods.includes(haseuliteMod)) {
{member: "ViVi", color: "rgb(255,152,180)", group: "Loona"}, {member: "ViVi", color: "rgb(255,152,180)", group: "Loona"},
{member: "J", color: "rgb(255,0,0)", group: "STAYC"} {member: "J", color: "rgb(255,0,0)", group: "STAYC"}
], ],
"16-12": {member: "Mashiro", color:"rgb", group: "Kep1er"},
"20-12": {member: "Kaede", color: "rgb(255,201,53)", group: "tripleS"}, "20-12": {member: "Kaede", color: "rgb(255,201,53)", group: "tripleS"},
"27-12": {member: "Youngeun", color:"rgb", group: "Kep1er"},
"29-12": {member: "Sana", color: "rgb(159,168,218)", group: "Twice"} "29-12": {member: "Sana", color: "rgb(159,168,218)", group: "Twice"}
}; };
var chaos = []; var chaos = [];
for(date in loonaObject) { for(date in idolData) {
if(date == "chaos") { continue }; if(date == "chaos") { continue };
if(!(loonaObject[date] instanceof Array)) { loonaObject[date] = [loonaObject[date]] }; //array wrap if(!(idolData[date] instanceof Array)) { idolData[date] = [idolData[date]] }; //array wrap
chaos = chaos.concat(loonaObject[date]); chaos = chaos.concat(idolData[date]);
}; };
loonaObject.chaos = chaos; idolData.chaos = chaos;
var february10Override = false; var february10Override = false;
@ -83,7 +96,7 @@ if(enabledMods.includes(haseuliteMod)) {
} }
function registerElemClick(elementName,memberDataIndex) { function registerElemClick(elementName,memberDataIndex) {
var dateData = loonaObject[getDayMonth()]; var dateData = idolData[getDayMonth()];
if(!dateData) { if(!dateData) {
alert("No birthday data here"); alert("No birthday data here");
return false; return false;
@ -155,8 +168,8 @@ if(enabledMods.includes(haseuliteMod)) {
var randomElementSets = {}; var randomElementSets = {};
if(loonaObject[dayMonth]) { if(idolData[dayMonth]) {
var data = loonaObject[dayMonth]; var data = idolData[dayMonth];
for(var memberIndex = 0; memberIndex < data.length; memberIndex++) { for(var memberIndex = 0; memberIndex < data.length; memberIndex++) {
var member = data[memberIndex].member; var member = data[memberIndex].member;
@ -203,7 +216,7 @@ if(enabledMods.includes(haseuliteMod)) {
}; };
runAfterButtons(function() { runAfterButtons(function() {
var data = loonaObject[getDayMonth()]; var data = idolData[getDayMonth()];
//console.log(data); //console.log(data);
for(var memberIndex = 0; memberIndex < data.length; memberIndex++) { for(var memberIndex = 0; memberIndex < data.length; memberIndex++) {
var member = data[memberIndex].member; var member = data[memberIndex].member;
@ -230,6 +243,7 @@ if(enabledMods.includes(haseuliteMod)) {
for(element in funnyElements) { for(element in funnyElements) {
var elemName = funnyElements[element]; var elemName = funnyElements[element];
var info = elements[elemName]; var info = elements[elemName];
if(!info) { console.log(element) };
var memberData = data[memberIndex]; var memberData = data[memberIndex];
if(typeof(info.desc) === "undefined") { if(typeof(info.desc) === "undefined") {
info.desc = "" info.desc = ""

View File

@ -13,6 +13,7 @@ function doElectricity(pixel) {
var newPixel = pixelMap[x][y]; var newPixel = pixelMap[x][y];
var con = elements[newPixel.element].conduct; var con = elements[newPixel.element].conduct;
if (con == undefined) {continue} if (con == undefined) {continue}
if (elements[pixel.element].noConduct?.length && elements[pixel.element].noConduct.includes(newPixel.element)) {continue};
if (Math.random() < con) { // If random number is less than conductivity if (Math.random() < con) { // If random number is less than conductivity
if (!newPixel.charge && !newPixel.chargeCD) { if (!newPixel.charge && !newPixel.chargeCD) {
newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge

View File

@ -1,4 +1,4 @@
var modName = "mods/random_rocks.js"; var modName = "mods/fire_mod.js";
var libraryMod = "mods/code_library.js"; var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) { if(enabledMods.includes(libraryMod)) {

62
mods/funni_water.js Normal file
View File

@ -0,0 +1,62 @@
"water": {
color: "#2167ff",
behavior: behaviors.LIQUID,
tempHigh: 100,
stateHigh: "steam",
tempLow: 0,
stateLow: "ice",
category: "liquids",
heatCapacity: 4.184,
reactions: {
"dirt": { // React with (water reacts with dirt to make mud)
elem1: null, // First element transforms into; in this case, water deletes itself
elem2: "mud", // Second element transforms into; in this case, dirt turns to mud
},
"sand": { elem1: null, elem2: "wet_sand" },
"clay_soil": { elem1: null, elem2: "clay" },
"salt": { elem1: "salt_water", elem2: null },
"sugar": { elem1: "sugar_water", elem2: null },
"dust": { elem1: "dirty_water", elem2: null },
"ash": { elem1: "dirty_water", elem2: null },
"cyanide": { elem1: "dirty_water", elem2: null },
"cyanide_gas": { elem1: "dirty_water", elem2: null },
"carbon_dioxide": { elem1: "seltzer", elem2: null, "oneway":true },
"sulfur": { elem1: "dirty_water", elem2: null },
"rat": { elem1: "dirty_water", chance:0.005 },
"plague": { elem1: "dirty_water", elem2: null },
"rust": { elem1: "dirty_water", chance:0.005 },
"fallout": { elem1: "dirty_water", chance:0.25 },
"radiation": { elem1: "dirty_water", chance:0.25 },
"uranium": { elem1: "dirty_water", chance:0.25 },
"rotten_meat": { elem1: "dirty_water", chance:0.25 },
"rotten_cheese": { elem1: "dirty_water", chance:0.25 },
"cancer": { elem1: "dirty_water", chance:0.25 },
"quicklime": { elem1: null, elem2: "slaked_lime" },
"rock": { elem2: "wet_sand", chance: 0.00035 },
"ruins": { elem2: "rock", chance: 0.00035 },
"mudstone": { elem2: "mud", chance: 0.00035 },
"methane": { elem1:"primordial_soup", elem2:"primordial_soup", tempMin:60, charged:true },
"ammonia": { elem1:"primordial_soup", elem2:"primordial_soup", tempMin:60, charged:true },
"fly": { elem2:"dead_bug", chance:0.1, "oneway":true },
"firefly": { elem2:"dead_bug", chance:0.1, "oneway":true },
"bee": { elem2:"dead_bug", chance:0.05, "oneway":true },
"stink_bug": { elem2:"dead_bug", chance:0.1, "oneway":true },
// electrolysis:
"aluminum": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0025 },
"zinc": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.015 },
"steel": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0125 },
"iron": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0125 },
"tin": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.01 },
"lead": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.01 },
"brass": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.001 },
"snow": { elem1: "armageddon", elem2: null, "oneway":false },
"bronze": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.001 },
"copper": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0075 },
"silver": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0075 },
"gold": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0075 },
},
state: "liquid",
density: 997,
conduct: 0.02,
stain: -0.5
},

View File

@ -114,12 +114,12 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
//Bombs //Bombs
amalgamatedBombFire = "plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,acid,acid,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,flash,flash,flash,flash,flash,acid_gas,acid_gas,acid_gas,acid,oil,oil,oil,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,acid,acid,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,electric_cluster_bomb,electric_cluster_bomb,flash,flash,flash,flash,flash,acid_gas,acid_gas,acid_gas,acid,oil,oil,oil,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plague,plague,plague,plague,plague,plague,radiation,radiation,radiation,radiation,radiation,radiation,radiation,radiation,uranium,uranium,uranium,uranium,uranium,uranium,greek_fire,greek_fire,greek_fire,greek_fire,greek_fire,antimatter,antimatter,antimatter,antimatter,antimatter,smoke_grenade,antimatter,smoke_grenade,fireball,flash,acid_gas,acid_gas,acid_gas,plague,plague,plague,plague,plague,plague,radiation,radiation,radiation,radiation,radiation,radiation,radiation,radiation,uranium,uranium,uranium,uranium,uranium,uranium,greek_fire,greek_fire,greek_fire,greek_fire,greek_fire,antimatter,antimatter,antimatter,antimatter,antimatter,smoke_grenade,antimatter,flash,acid_gas,acid_gas,acid_gas,radiation,radiation,radiation,radiation,plague,acid_gas,acid_gas,acid_gas,chlorine,chlorine,chlorine" amalgamatedBombFire = "plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,acid,acid,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,flash,flash,flash,flash,flash,acid_gas,acid_gas,acid_gas,acid,oil,oil,oil,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,acid,acid,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,electric_cluster_bomb,electric_cluster_bomb,flash,flash,flash,flash,flash,acid_gas,acid_gas,acid_gas,acid,oil,oil,oil,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plague,plague,plague,plague,plague,plague,radiation,radiation,radiation,radiation,radiation,radiation,radiation,radiation,uranium,uranium,uranium,uranium,uranium,uranium,greek_fire,greek_fire,greek_fire,greek_fire,greek_fire,antimatter,antimatter,antimatter,antimatter,antimatter,smoke_grenade,antimatter,smoke_grenade,fireball,flash,acid_gas,acid_gas,acid_gas,plague,plague,plague,plague,plague,plague,radiation,radiation,radiation,radiation,radiation,radiation,radiation,radiation,uranium,uranium,uranium,uranium,uranium,uranium,greek_fire,greek_fire,greek_fire,greek_fire,greek_fire,antimatter,antimatter,antimatter,antimatter,antimatter,smoke_grenade,antimatter,flash,acid_gas,acid_gas,acid_gas,radiation,radiation,radiation,radiation,plague,acid_gas,acid_gas,acid_gas,chlorine,chlorine,chlorine"
eLists.BOMB = ["bomb", "tnt", "c4", "grenade", "dynamite", "gunpowder", "firework", "nuke", "h_bomb", "dirty_bomb", "emp_bomb", "sticky_bomb", "cold_bomb", "hot_bomb", "electro_bomb", "water_bomb", "antimatter_bomb", "flashbang", "smoke_grenade", "fireball", "landmine", "cluster_bomb", "cluster_nuke", "op_hottester_bomb", "anti-bomb", "electric_bomblet", "electric_cluster_bomb", "radioactive_popper", "acid_bomb", "amalgamated_bomb"]; eLists.BOMB = ["bomb", "tnt", "c4", "grenade", "dynamite", "gunpowder", "firework", "nuke", "h_bomb", "dirty_bomb", "emp_bomb", "sticky_bomb", "cold_bomb", "hot_bomb", "electro_bomb", "water_bomb", "antimatter_bomb", "flashbang", "smoke_grenade", "fireball", "landmine", "cluster_bomb", "cluster_nuke", "op_hottester_bomb", "anti-bomb", "electric_bomblet", "electric_cluster_bomb", "radioactive_popper", "acid_bomb", "amalgamated_bomb"]; bombChoices = eLists.BOMB;
var excludedBombElements = ["water", "antimatter", "acid"]; var excludedBombElements = ["water", "antimatter", "acid"];
//Clouds //Clouds
eLists.CLOUD = ["cloud", "rain_cloud", "snow_cloud", "fire_cloud", "hail_cloud", "acid_cloud", "pyrocumulus"]; eLists.CLOUD = ["cloud", "rain_cloud", "snow_cloud", "fire_cloud", "hail_cloud", "acid_cloud", "pyrocumulus"]; cloudChoices = eLists.CLOUD;
var includedClouds = ["cloud", "rain_cloud", "snow_cloud", "fire_cloud", "hail_cloud", "acid_cloud", "pyrocumulus"]; var includedClouds = ["cloud", "rain_cloud", "snow_cloud", "fire_cloud", "hail_cloud", "acid_cloud", "pyrocumulus"];
var excludedCloudElements = ["snow", "fire", "hail", "acid"]; var excludedCloudElements = ["snow", "fire", "hail", "acid"];
if(typeof(behaviorGenerators) === "undefined") { behaviorGenerators = {} }; if(typeof(behaviorGenerators) === "undefined") { behaviorGenerators = {} };
@ -137,7 +137,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
var backupElementWhitelist = ["mercury", "chalcopyrite_ore", "chalcopyrite_dust", "copper_concentrate", "fluxed_copper_concentrate", "unignited_pyrestone", "ignited_pyrestone", "everfire_dust", "extinguished_everfire_dust", "mistake", "polusium_oxide", "vaporized_polusium_oxide", "glowstone_dust", "redstone_dust", "soul_mud", "wet_soul_sand", "nitrogen_snow", "fusion_catalyst", "coal", "coal_coke", "blast_furnace_fuel", "molten_mythril"]; var backupElementWhitelist = ["mercury", "chalcopyrite_ore", "chalcopyrite_dust", "copper_concentrate", "fluxed_copper_concentrate", "unignited_pyrestone", "ignited_pyrestone", "everfire_dust", "extinguished_everfire_dust", "mistake", "polusium_oxide", "vaporized_polusium_oxide", "glowstone_dust", "redstone_dust", "soul_mud", "wet_soul_sand", "nitrogen_snow", "fusion_catalyst", "coal", "coal_coke", "blast_furnace_fuel", "molten_mythril"];
//Spouts //Spouts
eLists.SPOUT = ["spout", "udder", "torch"]; eLists.SPOUT = ["spout", "udder", "torch"]; spoutChoices = eLists.SPOUT;
var excludedSpoutElements = ["ketchup", "liquid_cloner", "fire_cloner"] var excludedSpoutElements = ["ketchup", "liquid_cloner", "fire_cloner"]
var includedSpouts = ["ketchup_spout", "spout", "udder", "torch"] var includedSpouts = ["ketchup_spout", "spout", "udder", "torch"]
var backupCategoryWhitelist = ["land","powders","weapons","food","life","corruption","states","fey","Fantastic Creatures","dyes","energy liquids","random liquids","random gases","random rocks"]; var backupCategoryWhitelist = ["land","powders","weapons","food","life","corruption","states","fey","Fantastic Creatures","dyes","energy liquids","random liquids","random gases","random rocks"];
@ -1352,17 +1352,21 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
var returns = []; var returns = [];
for(aaf = 0; aaf < bombElements.length; aaf++) { for(aaf = 0; aaf < bombElements.length; aaf++) {
var elementOfBomb = bombElements[aaf]; var elementOfBomb = bombElements[aaf];
if(!(elements[elementOfBomb]?.color)) { continue }; //console.log("1",elementOfBomb);
var allElementsHaveColors = ((elementOfBomb instanceof Array ? elementOfBomb : [elementOfBomb]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1)
if(!allElementsHaveColors) { continue };
var startColor; var startColor;
var randomExcl = 0; var randomExcl = 0;
//console.log(elementOfBomb); //console.log(elementOfBomb);
var bombName; var bombName;
//console.log("2-1");
if(typeof(elementOfBomb === "string")) { //comma separated string check if(typeof(elementOfBomb === "string")) { //comma separated string check
if(elementOfBomb.includes(",")) { //if it is if(elementOfBomb.includes(",")) { //if it is
elementOfBomb = elementOfBomb.split(","); //to array elementOfBomb = elementOfBomb.split(","); //to array
elementOfBomb = elementOfBomb.filter(function(e) { //strip nonexistent elements elementOfBomb = elementOfBomb.filter(function(e) { //strip nonexistent elements
//console.log("3 a");
return typeof(elements[e]) === "object"; return typeof(elements[e]) === "object";
}); });
}; };
@ -1395,6 +1399,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
}; };
}; };
}; };
//console.log("e",bombName);
//Color gen //Color gen
if(Array.isArray(startColor)) { //Average arrays, make colors rgb() if(Array.isArray(startColor)) { //Average arrays, make colors rgb()
@ -1505,7 +1510,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
var returns = []; var returns = [];
for(aaf = 0; aaf < cloudElements.length; aaf++) { for(aaf = 0; aaf < cloudElements.length; aaf++) {
var elementOfCloud = cloudElements[aaf]; var elementOfCloud = cloudElements[aaf];
if(!(elements[elementOfCloud]?.color)) { continue }; var allElementsHaveColors = ((elementOfCloud instanceof Array ? elementOfCloud : [elementOfCloud]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1)
if(!allElementsHaveColors) { continue };
var startColor; var startColor;
var randomExcl = 0; var randomExcl = 0;
//console.log("randomExcl set") //console.log("randomExcl set")
@ -1712,7 +1718,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
var returns = []; var returns = [];
for(aaf = 0; aaf < creeperElements.length; aaf++) { for(aaf = 0; aaf < creeperElements.length; aaf++) {
var elementOfCreeper = creeperElements[aaf]; var elementOfCreeper = creeperElements[aaf];
if(!(elements[elementOfCreeper]?.color)) { continue }; var allElementsHaveColors = ((elementOfCreeper instanceof Array ? elementOfCreeper : [elementOfCreeper]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1)
if(!allElementsHaveColors) { continue };
var startColor; var startColor;
var randomExcl = 0; var randomExcl = 0;
//console.log("randomExcl set") //console.log("randomExcl set")
@ -1941,7 +1948,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
var returns = []; var returns = [];
for(aaf = 0; aaf < fairyElements.length; aaf++) { for(aaf = 0; aaf < fairyElements.length; aaf++) {
var elementOfFairy = fairyElements[aaf]; var elementOfFairy = fairyElements[aaf];
if(!(elements[elementOfFairy]?.color)) { continue }; var allElementsHaveColors = ((elementOfFairy instanceof Array ? elementOfFairy : [elementOfFairy]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1)
if(!allElementsHaveColors) { continue };
var startColor; var startColor;
var randomExcl = 0; var randomExcl = 0;
var isNocheer = 0; var isNocheer = 0;
@ -2129,7 +2137,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
var returns = []; var returns = [];
for(aaf = 0; aaf < spoutElements.length; aaf++) { for(aaf = 0; aaf < spoutElements.length; aaf++) {
var elementOfSpout = spoutElements[aaf]; var elementOfSpout = spoutElements[aaf];
if(!(elements[elementOfSpout]?.color)) { continue }; var allElementsHaveColors = ((elementOfSpout instanceof Array ? elementOfSpout : [elementOfSpout]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1)
if(!allElementsHaveColors) { continue };
var startColor; var startColor;
var randomExcl = 0; var randomExcl = 0;
var isNocheer = 0; var isNocheer = 0;

View File

@ -384,7 +384,7 @@ runAfterLoad(function() {
if(enabledMods.includes("mods/Neutronium Mod.js")) { if(enabledMods.includes("mods/Neutronium Mod.js")) {
elements.coal.breakInto = "coal_dust" elements.coal.breakInto = "coal_dust"
} }
if(enabledMods.includes("mods/the_ground.js")) { /*if(enabledMods.includes("mods/the_ground.js")) {
elements.radioactive_rock_dust = { elements.radioactive_rock_dust = {
color: "#839e78", color: "#839e78",
behavior: behaviors.RAD_GAS, behavior: behaviors.RAD_GAS,
@ -399,13 +399,13 @@ runAfterLoad(function() {
} }
elements.radioactive_rock.breakInto.push("radioactive_rock_dust") elements.radioactive_rock.breakInto.push("radioactive_rock_dust")
} }*/
if(enabledMods.includes("mods/boiling_rock.js")) { if(enabledMods.includes("mods/boiling_rock.js")) {
elements.rock_dust.tempHigh = 3000 elements.rock_dust.tempHigh = 3000
elements.rock_dust.stateHigh = "vaporized_rock" elements.rock_dust.stateHigh = "vaporized_rock"
if(enabledMods.includes("mods/the_ground.js")) { /*if(enabledMods.includes("mods/the_ground.js")) {
elements.radioactive_rock_dust.tempHigh = 3000 elements.radioactive_rock_dust.tempHigh = 3000
elements.radioactive_rock_dust.stateHigh = "vaporized_rock" elements.radioactive_rock_dust.stateHigh = "vaporized_rock"
} }*/
} }
}); });

View File

@ -1,146 +0,0 @@
var modName = "mods/hot_rocks.js";
var groundMod = "mods/the_ground.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(groundMod) && enabledMods.includes(libraryMod)) {
function redHotColorgen(colorIn,outputFormat="rgb") {
var color = colorIn;
//console.log(color);
if(!Array.isArray(color)) {
color = [color];
};
//console.log(color);
color = color.map(x => convertColorFormats(x,"json"));
//console.log(color);
for(i = 0; i < color.length; i++) {
var subcolor = color[i];
//console.log(i);
subcolor.r += 48;
subcolor.r *= 1.7;
subcolor.g += 24;
subcolor.g *= 1.2;
subcolor.g -= 16;
subcolor.b -= 10;
subcolor.b *= 0.75;
for(colorlet in subcolor) {
subcolor[colorlet] = Math.round(rgbColorBound(subcolor[colorlet]));
};
//console.log(color);
};
//console.log(color);
color = color.map(x => convertColorFormats(x,outputFormat));
if(color.length == 1) { color = color[0] };
return color;
};
var hotNameOverrides = {
dry_dirt: "hot_dirt",
};
elements.dirt._data = ["mixed","mixed","particulate"];
elements.dry_dirt._data = ["mixed","mixed","particulate"];
//console.log(elements.dry_dirt.stateHigh);
runAfterLoad(function() {
var igneousRocksAndSands = Object.keys(elements).filter(
function(elemName) {
//console.log(elemName,elements[elemName]._data?.[2]);
return ["igneous_rock","solid_igneous_rock","igneous_gravel","sedimentary_rock","particulate"].includes(elements[elemName]._data?.[2]) && !("clay","limestone","black_limestone","shale".includes(elemName))
}
);
//console.log(igneousRocksAndSands);
function hotData2Switch(data2) {
switch(data2) {
case "igneous_rock":
return "hot_igneous_rock";
case "solid_igneous_rock":
return "hot_solid_igneous_rock";
case "particulate":
return "hot_particulate";
case "sedimentary_rock":
return "hot_sedimentary_rock";
case "igneous_gravel":
return "hot_igneous_gravel";
default:
return "hot_" + data2;
};
};
igneousRocksAndSands = igneousRocksAndSands.concat("dry_dirt");
hotRockBehavior = [
"XX|CR:fire%0.5|XX",
"XX|XX|XX",
"M2|M1|M2"
];
solidHotRockBehavior = [
"XX|CR:fire%0.1|XX",
"CR:fire%0.1|XX|CR:fire%0.1",
"XX|CR:fire%0.1|XX"
];
for(j = 0; j < igneousRocksAndSands.length; j++) {
var rockName = igneousRocksAndSands[j];
var rockInfo = elements[rockName];
if(!rockInfo) {
console.error(rockName);
continue;
};
var rockData = rockInfo._data ?? ["error","error","hot_unknown"];
var newName = hotNameOverrides[rockName] ?? "hot_" + rockName;
//console.log(rockInfo.stateHigh);
elements[newName] = {
color: redHotColorgen(rockInfo.color,"hex"),
behavior: hotData2Switch(rockData[2]).includes("solid") ? solidHotRockBehavior : hotRockBehavior,
category: "land",
state: "solid",
temp: Math.min(rockInfo.tempHigh - 50,850),
tempHigh: rockInfo.tempHigh,
tempLow: Math.min(rockInfo.tempHigh - 100,800),
stateLow: rockName,
stateHigh: rockInfo.stateHigh,
density: rockData.density * 0.9,
hardness: rockData.density * 0.85,
//breakInto: newName + "_gravel",
_data: [rockData[0], rockData[1], hotData2Switch(rockData[2])],
};
if(rockName == "basalt") {
elements[newName].behavior = [
"XX|CR:fire%0.5|XX",
"XX|XX|XX",
"XX|M1|XX"
]
};
//console.log(j);
if(rockInfo.nellfireImmune) {
elements[newName].nellfireImmune = true;
};
elements[rockName].tempHigh = Math.min(rockInfo.tempHigh - 100,800);
elements[rockName].stateHigh = newName;
if(rockInfo._data[2] == "igneous_rock" && elements[newName + "_gravel"]) {
elements[newName].stateHigh = newName + "_gravel";
};
};
elements.dirt.tempHigh = 100;
elements.dirt.stateHigh = "dry_dirt";
elements.dry_dirt.tempHigh = 800;
elements.dry_dirt.stateHigh = "hot_dirt";
elements.hot_dirt.tempHigh = 1200;
elements.hot_dirt.stateHigh = "molten_dirt";
elements.hot_dirt.tempLow = 800;
elements.hot_dirt.stateLow = "dry_dirt";
});
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod);
enabledMods.splice(enabledMods.indexOf(modName),0,groundMod);
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${groundMod} and ${libraryMod} mods are required and have been automatically inserted (reload for this to take effect).`);
};

View File

@ -1,20 +1,6 @@
var modName = "mods/human_edit.js"; var modName = "mods/human_edit.js";
var onTryMoveIntoMod = "mods/onTryMoveInto.js"; var onTryMoveIntoMod = "mods/onTryMoveInto.js";
function hasPixel(x,y,elementInput) { if(typeof(breakPixel) == "undefined") {
if(isEmpty(x,y,true)) { //if empty, it can't have a pixel
return false;
} else {
if(elementInput.includes(",")) { //CSTA
elementInput = elementInput.split(",");
};
if(Array.isArray(elementInput)) { //if element list
return elementInput.includes(pixelMap[x][y].element);
} else { //if single element
return pixelMap[x][y].element === elementInput;
};
};
};
function breakPixel(pixel,changetemp=false,defaultBreakIntoDust=false) { function breakPixel(pixel,changetemp=false,defaultBreakIntoDust=false) {
var info = elements[pixel.element]; var info = elements[pixel.element];
if(typeof(info.breakInto) === "undefined") { if(typeof(info.breakInto) === "undefined") {
@ -28,7 +14,23 @@ function breakPixel(pixel,changetemp=false,defaultBreakIntoDust=false) {
breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)] breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)]
}; };
changePixel(pixel,breakIntoElement,changetemp) changePixel(pixel,breakIntoElement,changetemp)
return true; return true
}
};
function hasPixel(x,y,elementInput) {
if(isEmpty(x,y,true)) { //if empty, it can't have a pixel
return false;
} else {
if(elementInput.includes(",")) { //CSTA
elementInput = elementInput.split(",");
};
if(Array.isArray(elementInput)) { //if element list
return elementInput.includes(pixelMap[x][y].element);
} else { //if single element
return pixelMap[x][y].element === elementInput;
};
};
}; };
if(enabledMods.includes(onTryMoveIntoMod)) { if(enabledMods.includes(onTryMoveIntoMod)) {
@ -98,31 +100,39 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
//console.log(`Bounding code running from value of ${pixel.panic}`); //console.log(`Bounding code running from value of ${pixel.panic}`);
pixel.panic = Math.max(0,Math.min(1,pixel.panic)); pixel.panic = Math.max(0,Math.min(1,pixel.panic));
//console.log(`Validation result: Panic set to ${pixel.panic}`); //console.log(`Validation result: Panic set to ${pixel.panic}`);
if(Number.isNaN(pixel.mood)) {
//console.log("NaN case: panic set to 0");
pixel.mood = 0;
};
//console.log(`Bounding code running from value of ${pixel.panic}`);
pixel.mood = Math.max(-3,Math.min(3,pixel.mood));
//console.log(`Validation result: Panic set to ${pixel.panic}`);
}; };
goodPixels = { goodPixels = {
silver: { panicIncrease: 0.01, panicIncreaseChance: 0.1 }, silver: { panicChange: 0.01, panicChangeChance: 0.1, moodChange: 0.004 },
gold: { panicIncrease: 0.02, panicIncreaseChance: 0.15 }, gold: { panicChange: 0.02, panicChangeChance: 0.15, moodChange: 0.01 },
diamond: { panicIncrease: 0.03, panicIncreaseChance: 0.2 }, diamond: { panicChange: 0.03, panicChangeChance: 0.2, moodChange: 0.02 },
}; //effectively, the difference is that good pixels don't make the human flip direction (run away); }; //effectively, the difference is that good pixels don't make the human flip direction (run away);
badPixels = { badPixels = {
rotten_meat: { panicIncrease: 0.02, panicIncreaseChance: 0.15 }, rotten_meat: { panicChange: 0.02, panicChangeChance: 0.15, moodChange: -0.015 },
blood: { panicIncrease: 0.06, panicIncreaseChance: 0.2 }, blood: { panicChange: 0.06, panicChangeChance: 0.2, moodChange: -0.006 },
brain: { panicIncrease: 0.1, panicIncreaseChance: 0.3 }, brain: { panicChange: 0.1, panicChangeChance: 0.3, moodChange: -0.005 },
fire: { panicIncrease: 0.1, panicIncreaseChance: 0.1 }, fire: { panicChange: 0.1, panicChangeChance: 0.1, moodChange: 0 },
poison: { panicIncrease: 0.2, panicIncreaseChance: 0.05 }, poison: { panicChange: 0.2, panicChangeChance: 0.05, moodChange: -0.01 },
grenade: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, grenade: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.3 },
bomb: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, bomb: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.3 },
tnt: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, tnt: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: 0 },
dynamite: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, dynamite: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.3 },
anti_bomb: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, anti_bomb: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.3 },
cluster_bomb: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, cluster_bomb: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.4 },
landmine: { panicIncrease: 0.25, panicIncreaseChance: 0.1 }, landmine: { panicChange: 0.25, panicChangeChance: 0.1, moodChange: -0.3 },
fireball: { panicIncrease: 0.25, panicIncreaseChance: 0.45 }, fireball: { panicChange: 0.25, panicChangeChance: 0.45, moodChange: -0.35 },
magma: { panicIncrease: 0.3, panicIncreaseChance: 0.2 }, magma: { panicChange: 0.3, panicChangeChance: 0.2, moodChange: 0 },
plasma: { panicIncrease: 0.3, panicIncreaseChance: 0.2 }, plasma: { panicChange: 0.3, panicChangeChance: 0.2, moodChange: 0 },
nuke: { panicIncrease: 1, panicIncreaseChance: 1 }, //insta-panic nuke: { panicChange: 1, panicChangeChance: 1, moodChange: -1 }, //insta-panic
cluster_nuke: { panicIncrease: 1, panicIncreaseChance: 1 }, //insta-panic cluster_nuke: { panicChange: 1, panicChangeChance: 1, moodChange: -1 }, //insta-panic
}; //testing }; //testing
otherPixels = ["head","body"]; //do custom code here otherPixels = ["head","body"]; //do custom code here
@ -137,8 +147,13 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
elements.body.properties = { elements.body.properties = {
dead: false, dead: false,
dir: 1, dir: 1,
extremePanicStart: null,
}; };
elements.body.tick = function(pixel) { elements.body.tick = function(pixel) {
if(typeof(pixel.extremePanicStart) == "undefined") {
//console.log("oops");
pixel.extremePanicStart = null
};
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down
var headpixel = pixelMap[pixel.x][pixel.y-2]; var headpixel = pixelMap[pixel.x][pixel.y-2];
@ -192,9 +207,20 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
// While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break. // While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break.
while (movesToTry.length > 0) { while (movesToTry.length > 0) {
var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0]; var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0];
if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) { /*
console.log(move);
console.log("Body X:", pixel.x, "to", pixel.x+move[0]);
console.log("Body Y:", pixel.y, "to", pixel.y+move[1]);
console.log("Head X:",head.x, "to", head.x+move[0]);
console.log("Head Y:", head.y, "to", head.y+move[1]);
*/
//If head coords are empty
if (isEmpty(pixel.x+move[0], pixel.y+move[1]) && isEmpty(head.x+move[0], head.y+move[1])) {
//console.log("Head target coords are empty");
if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1])) { if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1])) {
movePixel(head, head.x+move[0], head.y+move[1]); movePixel(head, head.x+move[0], head.y+move[1]);
//console.log(`Moved body to (${pixel.x},${pixel.y}) and head to (${head.x},${head.y})`);
//console.log(`Head-body offset (should always be [0,-1]): [${head.x-pixel.x},${head.y-pixel.y}]`)
break; break;
} }
} }
@ -208,9 +234,30 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
}; };
}; };
var pX = pixel.x; //if not flagged for extreme panic
var pY = pixel.y; //extreme panic will not be flagged in good moods, just to be nice
if(pixel.extremePanicStart == null && head.panic > 0.8 && head.mood <= 0) {
//flag extreme panic
pixel.extremePanicStart = pixelTicks;
}
//if flagged for extreme panic and panic is still extreme
else if(pixel.extremePanicStart != null && (head.panic > 0.8 && head.mood <= 0)) {
//if extreme panic lasts too long
if(pixelTicks - pixel.extremePanicStart > 350) {
//random chance to die from exhaustion/a heart attack/whatever
if(Math.random() < 0.01) {
pixel.dead = true;
}; };
};
}
//if flagged for extreme panic and extreme panic is no longer extreme
else if(pixel.extremePanicStart != null && (head.panic <= 0.8 || head.mood > 0)) {
//unflag
pixel.extremePanicStart = null;
};
};
elements.body.onTryMoveInto = function(pixel,otherPixel) { elements.body.onTryMoveInto = function(pixel,otherPixel) {
var pX = pixel.x; var pX = pixel.x;
var pY = pixel.y; var pY = pixel.y;
@ -226,7 +273,7 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
if(otherPixel.dead || otherBody.dead) { //if either part of that human is dead if(otherPixel.dead || otherBody.dead) { //if either part of that human is dead
head.panic += 0.08; //being hit by a dead ******* body is terrifying head.panic += 0.08; //being hit by a dead ******* body is terrifying
} else { } else {
if(otherPixel.panic > 0.04) { head.panic += 0.04 }; //living, normal, bodied heads scare only if that incoming human is already scared if(otherPixel.panic > 0.04 && otherPixel.mood <= 0) { head.panic += 0.04 }; //living, normal, bodied heads scare only if that incoming human is already scared
}; };
} else { //if it's a severed head } else { //if it's a severed head
if(otherPixel.dead) { //if the head is dead if(otherPixel.dead) { //if the head is dead
@ -260,12 +307,8 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
dirLocked: false, dirLocked: false,
panic: 0, panic: 0,
}; };
elements.head.tick = function(pixel) { elements.head.tick = function(pixel) {
//debugging: display panic through color and temp
/*pixel.temp = (pixel.panic * 100);
var spookyColor = Math.min(pixel.panic,1) * 255;
var spookyColor2 = 255 - Math.max(pixel.panic-1, 0);
pixel.color = `rgb(${spookyColor},${spookyColor2},0)`;*/
doHeat(pixel); doHeat(pixel);
doBurning(pixel); doBurning(pixel);
doElectricity(pixel); doElectricity(pixel);
@ -298,6 +341,8 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
} }
} }
pixel.mood ??= 0;
if((pixelTicks-pixel.start) % 5 === 0) { if((pixelTicks-pixel.start) % 5 === 0) {
//Vision loop //Vision loop
var pX = pixel.x; var pX = pixel.x;
@ -323,14 +368,16 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
var newElement = newPixel.element; var newElement = newPixel.element;
if(Object.keys(goodPixels).includes(newElement)) { if(Object.keys(goodPixels).includes(newElement)) {
//no dir flip //no dir flip
if(Math.random() > goodPixels[newElement].panicIncreaseChance) { if(Math.random() > goodPixels[newElement].panicChangeChance) {
pixel.panic += goodPixels[newElement].panicIncrease; pixel.panic += goodPixels[newElement].panicChange;
pixel.mood += goodPixels[newElement].moodChange; //like if there was a pretty painting item, it would make you feel better but you wouldn't necessarily feel the need to run towards it
}; };
pixel.dirLocked = true; pixel.dirLocked = true;
} else if(Object.keys(badPixels).includes(newElement)) { } else if(Object.keys(badPixels).includes(newElement)) {
body.dir = 1; //flip dir body.dir = 1; //flip dir
if(Math.random() > badPixels[newElement].panicIncreaseChance) { if(Math.random() > badPixels[newElement].panicChangeChance) {
pixel.panic += badPixels[newElement].panicIncrease; pixel.panic += badPixels[newElement].panicChange;
pixel.mood += badPixels[newElement].moodChange;
}; };
pixel.dirLocked = true; pixel.dirLocked = true;
}; //good and bad should be mutually exclusive; good will be evaulated first because one inevitably has to be considered first }; //good and bad should be mutually exclusive; good will be evaulated first because one inevitably has to be considered first
@ -359,6 +406,12 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
} else { } else {
pixel.panic += 0.003; pixel.panic += 0.003;
}; };
//the vision loop is in the head, and this is in the "seeing head" case, then this will happen when the head sees another head, and heads store panic; this is in the "other head" is panicking case so this will ultimately be the code that runs when its human sees another human panicking
if(Math.random() < 0.5) {
//run in same direction as panicking person
pixel.dir = newPixel.dir
};
}; };
}; };
} else { //severed head } else { //severed head
@ -429,8 +482,9 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
var newElement = newPixel.element; var newElement = newPixel.element;
if(Object.keys(goodPixels).includes(newElement)) { if(Object.keys(goodPixels).includes(newElement)) {
//no dir flip //no dir flip
if(Math.random() > goodPixels[newElement].panicIncreaseChance) { if(Math.random() > goodPixels[newElement].panicChangeChance) {
pixel.panic += goodPixels[newElement].panicIncrease; pixel.panic += goodPixels[newElement].panicChange;
pixel.mood += goodPixels[newElement].moodChange;
}; };
pixel.dirLocked = true; pixel.dirLocked = true;
} else if(Object.keys(badPixels).includes(newElement)) { } else if(Object.keys(badPixels).includes(newElement)) {
@ -438,8 +492,9 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
var body = pixelMap[pX][pY+1]; var body = pixelMap[pX][pY+1];
body.dir = -1; //run away body.dir = -1; //run away
}; };
if(Math.random() > badPixels[newElement].panicIncreaseChance) { if(Math.random() > badPixels[newElement].panicChangeChance) {
pixel.panic += badPixels[newElement].panicIncrease; pixel.panic += badPixels[newElement].panicChange;
pixel.mood += badPixels[newElement].moodChange;
}; };
pixel.dirLocked = true; pixel.dirLocked = true;
}; //good and bad should be mutually exclusive; good will be evaulated first because one inevitably has to be considered first }; //good and bad should be mutually exclusive; good will be evaulated first because one inevitably has to be considered first
@ -526,12 +581,14 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
//console.log("Meh."); //console.log("Meh.");
}; };
if(Math.random() < 0.02) { //2% chance each tick to decrease panic if(Math.random() < ((pixel.panic) > 0.8 ? 0.04 : 0.02)) { //2% chance each tick to decrease panic (4% if the panic is extreme)
//console.log("Decreasing panic"); //console.log("Decreasing panic");
pixel.panic < 0.05 ? pixel.panic = 0 : pixel.panic -= 0.05; pixel.panic < 0.05 ? pixel.panic = 0 : pixel.panic -= 0.05;
}; };
}; };
elements.head.breakInto = ["bone","brain","brain","cerebrospinal_fluid","blood","blood","meat"]; elements.head.breakInto = ["bone","brain","brain","cerebrospinal_fluid","blood","blood","meat"];
elements.head.onTryMoveInto = function(pixel,otherPixel) { elements.head.onTryMoveInto = function(pixel,otherPixel) {
var pX = pixel.x; var pX = pixel.x;
var pY = pixel.y; var pY = pixel.y;
@ -548,7 +605,7 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
pixel.panic += 0.08; //being hit by a dead ******* body is terrifying pixel.panic += 0.08; //being hit by a dead ******* body is terrifying
//console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (head's code branch)"); //console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (head's code branch)");
} else { } else {
if(otherPixel.panic > 0.04) { pixel.panic += 0.04; console.log("head.onTryMoveInto: panic increase, case: head hit by panicked whole body (head's code branch)"); }; //living, normal, headed bodies scare only if that incoming human is already scared //if(otherPixel.panic > 0.04) { pixel.panic += 0.04; console.log("head.onTryMoveInto: panic increase, case: head hit by panicked whole body (head's code branch)"); }; //living, normal, headed bodies scare only if that incoming human is already scared
}; };
} else { //if it's a severed head } else { //if it's a severed head
if(otherPixel.dead) { //if the head is dead if(otherPixel.dead) { //if the head is dead
@ -563,23 +620,23 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
if(hasPixel(oX,oY-1,"head")) { //if the body hitting this pixel has a head on it if(hasPixel(oX,oY-1,"head")) { //if the body hitting this pixel has a head on it
var otherHead = pixelMap[oX][oY-1]; var otherHead = pixelMap[oX][oY-1];
if(otherPixel.dead || otherHead.dead) { //if either part of that human is dead if(otherPixel.dead || otherHead.dead) { //if either part of that human is dead
pixel.panic += 0.06; //dead whole body case pixel.panic += 0.03; //dead whole body case
//console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (body's code branch)"); //console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (body's code branch)");
} else { } else {
if(otherHead.panic > 0.04) { if(otherHead.panic > 0.04) {
pixel.panic += 0.06; pixel.panic += 0.03;
//console.log("head.onTryMoveInto: panic increase, case: head crushed by panicked whole body (body's code branch)"); //console.log("head.onTryMoveInto: panic increase, case: head crushed by panicked whole body (body's code branch)");
} else { } else {
pixel.panic += 0.04; pixel.panic += 0.02;
//console.log("head.onTryMoveInto: panic increase, case: head crushed by whole body (body's code branch)"); //console.log("head.onTryMoveInto: panic increase, case: head crushed by whole body (body's code branch)");
}; };
}; };
} else { //severed body case } else { //severed body case
if(otherPixel.dead) { //if the body is dead if(otherPixel.dead) { //if the body is dead
pixel.panic += 0.08; //imagine being hit by a severed human without the head pixel.panic += 0.04; //imagine being hit by a severed human without the head
//console.log("head.onTryMoveInto: panic increase, case: head hit by dead severed body"); //console.log("head.onTryMoveInto: panic increase, case: head hit by dead severed body");
} else { } else {
pixel.panic += 0.1; //imagine the above but the heart is still beating pixel.panic += 0.05; //imagine the above but the heart is still beating
//console.log("head.onTryMoveInto: panic increase, case: head hit by living severed body"); //console.log("head.onTryMoveInto: panic increase, case: head hit by living severed body");
}; };
}; };
@ -614,8 +671,55 @@ if(enabledMods.includes(onTryMoveIntoMod)) {
[0, "dirt"] [0, "dirt"]
] ]
}; };
kep1er = [
["first_impact", ["#664482","#cf4ba3","#c15ca9","#f0a669"]],
["doublast", ["#2b98fd","#d0e26d","#e6f049","#dce4b3"]],
["fly-up", ["#f2f2f2","#15a667","#de0180"]],
["troubleshooter", ["#291923","#ed3fb6","#fee6f8","#64c5e0","#d6cdca","#330d25"]],
["fly-by", ["#e7e6dd","#fcf0ef","#efa1ba","#8d7cb6","#5e74ba","#2b5db5","#e292b7"]],
["lovestruck", ["#bfd9f0","#bfd9f0","#fef792","#c36475","#edd1d6"]],
];
for(index in kep1er) {
index = parseInt(index);
var newName = kep1er[index][0];
var newColor = kep1er[index][1];
var newDisplayName = newName.replaceAll("_"," ").replaceAll("-"," - ").split(" ").map(x => x.substring(0,1).toUpperCase() + x.substring(1)).join(" ").replace(" - ","-");
elements[newName] = {
name: newDisplayName,
color: newColor,
tempHigh: 200,
stateHigh: ["ash","molten_plastic"],
density: 332, //based off of First Impact: https://www.amazon.com/Kep1er-IMPACT-Contents-Tracking-Connect/dp/B09MQMNZ62
tick: function(pixel) {
if(!(tryMove(pixel,pixel.x,pixel.y+1))) {
var directions = [];
if(isEmpty(pixel.x-1,pixel.y+1) && isEmpty(pixel.x-1,pixel.y+2)) {
directions.push(-1)
};
if(isEmpty(pixel.x+1,pixel.y+1) && isEmpty(pixel.x+1,pixel.y+2)) {
directions.push(1)
};
if(directions.length > 0) {
tryMove(pixel,pixel.x+directions[Math.floor(Math.random() * directions.length)],pixel.y)
};
}
},
reactions: {
water: { elem1: ["plastic","cellulose","cellulose"], elem2: ["water","water","cellulose",null,null], chance: 0.8 }
},
burn: 40,
burnTime: 150,
burnInto: ["ash","molten_plastic","carbon_dioxide","smoke"],
category: "other"
};
goodPixels[newName] = { panicChange: 0.01, panicChangeChance: 0.2, moodChange: 0.035 };
};
} else { } else {
alert(`The ${onTryMoveIntoMod} mod is required and has been automatically inserted (reload for this to take effect).`)
enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod) enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${onTryMoveIntoMod} mod is required and has been automatically inserted (reload for this to take effect).`)
}; };

View File

@ -1,43 +0,0 @@
if(!settings) {
settings = {}
}
if(!settings.bg) {
settings.bg = "#000000"
}
elements.invisible_dye = {
color: settings.bg,
behavior: behaviors.LIQUID,
tick: function(pixel) {
var backgroundColor = hexToRGB(settings.bg);
var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")";
pixel.color = rgbValue;
},
hardness: 0.8,
breakInto: "invisible_dye_gas",
tempHigh: 110,
stateHigh: "invisible_dye_gas",
category: "special",
state: "liquid",
density: 1,
stain: elements.dye.stain,
};
elements.invisible_dye_gas = {
color: settings.bg,
behavior: behaviors.GAS,
tick: function(pixel) {
var backgroundColor = hexToRGB(settings.bg);
var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")";
pixel.color = rgbValue;
},
hardness: 0.5,
breakInto: "invisible_dye_gas",
tempLow: 109,
stateLow: "invisible_dye",
category: "special",
state: "liquid",
density: 1,
stain: elements.spray_paint.stain,
};

83
mods/invisible_things.js Normal file
View File

@ -0,0 +1,83 @@
var modName = "mods/invisible_things.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
if(!settings) {
settings = {}
}
if(!(settings.bg)) {
settings.bg = "#000000"
}
function getBackgroundColorOrAverageAsJSON() {
if(!(settings?.bg)) {
return {r: 0, g: 0, b: 0};
} else if(!(settings.bg instanceof Array)) {
return convertColorFormats(settings.bg,"json")
} else {
return convertColorFormats(averageRgbPrefixedColorArray(settings.bg.map(color => convertColorFormats(color,"rgb"))),"json");
};
};
function makePixelInvisible(pixel) {
var backgroundColor = getBackgroundColorOrAverageAsJSON();
pixel.color = `rgba(${backgroundColor.r},${backgroundColor.g},${backgroundColor.b},0)`;
};
elements.invisible_wall = {
color: settings.bg,
behavior: behaviors.WALL,
tick: function(pixel) { makePixelInvisible(pixel) },
insulate: true,
hardness: 1,
category: "special",
state: "solid",
};
elements.invisible_dye = {
color: settings.bg,
behavior: behaviors.LIQUID,
tick: function(pixel) { makePixelInvisible(pixel) },
hardness: 0.8,
breakInto: "invisible_dye_gas",
tempHigh: 110,
stateHigh: "invisible_dye_gas",
category: "special",
state: "liquid",
density: 1,
stain: elements.dye.stain,
};
elements.invisible_dye_gas = {
color: settings.bg,
behavior: behaviors.GAS,
tick: function(pixel) { makePixelInvisible(pixel) },
hardness: 0.5,
breakInto: "invisible_dye_gas",
tempLow: 109,
stateLow: "invisible_dye",
category: "special",
state: "liquid",
density: 1,
stain: elements.spray_paint.stain,
};
var temp = {
invisible_wall: "asdfg",
invisible_dye: 2,
invisible_dye_gas: false
};
if(enabledMods.includes("mods/gradient_background_support.js")) {
for(var elemName in temp) {
elements[elemName].desc = "Invisible dyes <em style='color: yellow;'>do not work</em> and <em style='color: yellow;'>are not supported</em> with gradient backgrouds";
elements[elemName].hidden = true;
elements[elemName].excludeRandom = true;
};
};
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
};

View File

@ -1,21 +0,0 @@
if(!settings) {
settings = {}
}
if(!settings.bg) {
settings.bg = "#000000"
}
elements.invisible_wall = {
color: settings.bg,
behavior: behaviors.WALL,
tick: function(pixel) {
var backgroundColor = hexToRGB(settings.bg);
var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")";
pixel.color = rgbValue;
},
insulate: true,
hardness: 1,
category: "special",
state: "solid",
};

View File

@ -175,6 +175,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
//console.log(elementOfSingularity); //console.log(elementOfSingularity);
var returns = [];
if(!elementExists(singularityName)) { if(!elementExists(singularityName)) {
elements[singularityName] = { elements[singularityName] = {
color: newColorArray, color: newColorArray,
@ -184,9 +186,14 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
temp: firstTemp, temp: firstTemp,
hardness: 0.995, hardness: 0.995,
singularityNumber: null, singularityNumber: null,
originalElementDisplay: elements[elementOfSingularity.replaceAll(",","_")]?.originalElementKey ?? elementOfSingularity.split(","),
originalElementKey: elements[elementOfSingularity.replaceAll(",","_")]?.originalElementKey ?? elementOfSingularity.split(","),
state: "solid", state: "solid",
density: finalDensity, density: finalDensity,
}; };
var newInfo = elements[singularityName];
elements[singularityName].originalElementDisplay = newInfo.originalElementKey.map(x => elements[x].name ?? x);
if(elements[singularityName].originalElementDisplay.length == 1) { elements[singularityName].originalElementDisplay = elements[singularityName].originalElementDisplay[0] };
if(singularityElements[0] instanceof Array) { if(singularityElements[0] instanceof Array) {
elements[singularityName].singularityNumber = 1; elements[singularityName].singularityNumber = 1;
} else { } else {
@ -196,6 +203,11 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
elements[singularityName].singularityNumber = elements[singularityElements[0]].singularityNumber + 1; elements[singularityName].singularityNumber = elements[singularityElements[0]].singularityNumber + 1;
}; };
}; };
var num = newInfo.singularityNumber ?? NaN;
var descTypeString = (num == 1 ? "singularity" : `${num.toString()}-singularity`);
var descNumberString = (num < 4 ? (10 ** (num * 4)).toLocaleString("en-US") : `10<sup>${num * 4}</sup>`);
var descElementString = tryJoin((newInfo.originalElementDisplay ?? "[Original element could not be determined]"),", ");
elements[singularityName].desc = `A ${descTypeString} normally made of ${descNumberString} pixels of ${descElementString}.`.replaceAll("NaN","[Quantity could not be determined]");
if(singularityName.includes("haseulite") && !singularityName.includes("haseulite_vent")) { if(singularityName.includes("haseulite") && !singularityName.includes("haseulite_vent")) {
elements[singularityName].tick = function(pixel) { haseulitoidSingularityTick(pixel) }; elements[singularityName].tick = function(pixel) { haseulitoidSingularityTick(pixel) };
haseuliteSpreadWhitelist.push(singularityName); haseuliteSpreadWhitelist.push(singularityName);
@ -236,8 +248,9 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
}; };
}; };
count++; count++;
returns.push(singularityName);
}; };
return count; return returns;
}; };
elements.neutronium_compressor = { elements.neutronium_compressor = {

View File

@ -1,43 +0,0 @@
function doElectricity(pixel) {
var info = elements[pixel.element];
if (pixel.charge) {
// Check each adjacent pixel, if that pixel's charge is false, set it to the same charge
for (var i = 0; i < adjacentCoords.length; i++) {
var x = pixel.x+adjacentCoords[i][0];
var y = pixel.y+adjacentCoords[i][1];
if (!isEmpty(x,y,true)) {
var newPixel = pixelMap[x][y];
var con = elements[newPixel.element].conduct;
if (con == undefined) {continue}
if (info.noConduct?.length && info.noConduct.includes(newPixel.element)) {continue};
if (Math.random() < con) { // If random number is less than conductivity
if (!newPixel.charge && !newPixel.chargeCD) {
newPixel.charge = 1;
if (elements[newPixel.element].colorOn) {
newPixel.color = pixelColorPick(newPixel);
}
}
}
else if (elements[newPixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation)
newPixel.temp += pixel.charge/4;
pixelTempCheck(newPixel);
}
}
}
pixel.charge -= 0.25;
if (pixel.charge <= 0) {
delete pixel.charge;
pixel.chargeCD = 4;
}
}
// Lower charge cooldown
else if (pixel.chargeCD) {
pixel.chargeCD -= 1;
if (pixel.chargeCD <= 0) {
delete pixel.chargeCD;
if (info.colorOn) {
pixel.color = pixelColorPick(pixel);
}
}
}
}

View File

@ -3,7 +3,7 @@ var libraryMod = "mods/code_library.js";
var propMod = "mods/prop.js"; var propMod = "mods/prop.js";
var variablesMod = "mods/prop and prompt variables.js"; var variablesMod = "mods/prop and prompt variables.js";
if(enabledMods.includes(libraryMod) && enabledMods.includes(propMod) && enabledMods.includes(variablesMod)) { if(enabledMods.includes(libraryMod) && enabledMods.includes(propMod) && enabledMods.includes(variablesMod)) {
function placeRegularlySpacedPixels(element,startX,startY,xSpacing,ySpacing,overwrite=false,stopAt=null,rayIgnore=null,spawnTemp=null,limit=1000) { function placeRegularlySpacedPixels(element,startX,startY,xSpacing,ySpacing,overwrite=false,stopAt=null,rayIgnore=[],spawnTemp=null,limit=1000) {
if(element.includes(",")) { element = element.split(",") }; if(element.includes(",")) { element = element.split(",") };
var newElement = element; var newElement = element;
if(isNaN(xSpacing) || isNaN(ySpacing)) { if(isNaN(xSpacing) || isNaN(ySpacing)) {
@ -94,7 +94,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(propMod) && enabledM
ySpacing: 0, ySpacing: 0,
overwrite: false, overwrite: false,
stopAt: null, stopAt: null,
rayIgnoreSelf: true, rayIgnore: [],
spawnAtPixelTemp: false, spawnAtPixelTemp: false,
maxPixels: 1000, maxPixels: 1000,
/*clone: "plasma", /*clone: "plasma",
@ -118,7 +118,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(propMod) && enabledM
pixel.ySpacing, pixel.ySpacing,
pixel.overwrite, pixel.overwrite,
pixel.stopAt, pixel.stopAt,
pixel.rayIgnoreSelf ? pixel.clone : null, pixel.rayIgnore,
pixel.spawnAtPixelTemp ? pixel.temp : null, pixel.spawnAtPixelTemp ? pixel.temp : null,
pixel.maxPixels pixel.maxPixels
); );

View File

@ -244,13 +244,13 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
else { else {
var otherPixel = pixelMap[x][y] var otherPixel = pixelMap[x][y]
var otherInfo = elements[otherPixel.element]; var otherInfo = elements[otherPixel.element];
otherPixel.temp += 400; otherPixel.temp += (400 * (shiftDown + 1));
if(otherPixel.del) { continue }; if(otherPixel.del) { continue };
if (!(grbBreakIntos.includes(otherPixel.element))) { if (!(grbBreakIntos.includes(otherPixel.element))) {
if (otherInfo.isGas) { if (otherInfo.isGas) {
if(Math.random() > ((otherInfo.hardness ?? 0) ** 4)) { breakPixel(otherPixel,false,false) }; if(Math.random() > ((otherInfo.hardness ?? 0) ** (4 + shiftDown))) { breakPixel(otherPixel,false,false) };
if(hasVelocity && otherPixel && !(lightlikes.includes(otherPixel.element))) { if(hasVelocity && otherPixel && !(lightlikes.includes(otherPixel.element))) {
var vels = [randomIntegerBetweenTwoValues(-7,7),randomIntegerBetweenTwoValues(-7,7)]; var vels = [randomIntegerBetweenTwoValues(-7 - (shiftDown * 2),7 + (shiftDown * 2)),randomIntegerBetweenTwoValues(-7 - (shiftDown * 2),7 + (shiftDown * 2))];
otherPixel.vx = vels[0]; otherPixel.vx = vels[0];
otherPixel.vy = vels[1]; otherPixel.vy = vels[1];
}; };
@ -258,13 +258,13 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
}; };
if (otherInfo.id === elements[pixel.element].id) { break } if (otherInfo.id === elements[pixel.element].id) { break }
if(Math.random() > ((otherInfo.hardness ?? 0) ** 2)) { breakPixel(otherPixel,false,false) }; if(Math.random() > ((otherInfo.hardness ?? 0) ** (2 + shiftDown))) { breakPixel(otherPixel,false,false) };
if(hasVelocity && otherPixel) { if(hasVelocity && otherPixel) {
var vels = [randomIntegerBetweenTwoValues(-9,9),randomIntegerBetweenTwoValues(-7,0)]; var vels = [randomIntegerBetweenTwoValues(-9 - (shiftDown * 2),9 + (shiftDown * 2)),randomIntegerBetweenTwoValues(-7 - (shiftDown * 2),0 + (shiftDown * 2))];
otherPixel.vx = vels[0]; otherPixel.vx = vels[0];
otherPixel.vy = vels[1]; otherPixel.vy = vels[1];
}; };
if(Math.random() < Math.max(0.9,0.4 + ((1 - (otherInfo.hardness ?? 0)) / 2))) { //thanks, I hate random continue if(Math.random() < ((shiftDown / 20) + (Math.max(0.9,0.4 + ((1 - (otherInfo.hardness ?? 0)) / 2))))) { //thanks, I hate random continue
continue; continue;
}; };
break; break;

View File

@ -0,0 +1,138 @@
var modName = "mods/special_property_library.js";
var libraryMod = "mods/code_library.js";
var libHookTickMod = "mods/libhooktick.js";
if(enabledMods.includes(libraryMod) && enabledMods.includes(libHookTickMod)) {
specialProperties = {
/*red: {
specialFunction: function(pixel) { pixel.color = "rgb(255,0,0)" }
},*/
};
//I hate overwriting drawPixels
function drawPixels(forceTick=false) {
// newCurrentPixels = shuffled currentPixels
var newCurrentPixels = currentPixels.slice();
var pixelsFirst = [];
var pixelsLast = [];
if (!paused || forceTick) {
shuffleArray(newCurrentPixels);
}
/*{newCurrentPixels.sort(function(p) { // shuffle the pixels but keep elements[p.element].isGas last
return 0.5 - Math.random();
})} // shuffle the pixels if not paused*/
for (var i = 0; i < newCurrentPixels.length; i++) {
pixel = newCurrentPixels[i];
//if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue}
if (pixel.del) {continue}
if (!paused || forceTick) {
if (elements[pixel.element].tick) { // Run tick function if it exists
elements[pixel.element].tick(pixel);
}
if (pixel.del) {continue}
if (elements[pixel.element].behavior) { // Parse behavior if it exists
pixelTick(pixel);
}
};
if (elements[pixel.element].isGas) {
pixelsLast.push(pixel);
}
else {
pixelsFirst.push(pixel);
}
}
// Draw the current pixels
var canvas = document.getElementById("game");
var ctx = canvas.getContext("2d");
var pixelDrawList = pixelsFirst.concat(pixelsLast);
for (var i = 0; i < pixelDrawList.length; i++) {
pixel = pixelDrawList[i];
if (pixelMap[pixel.x][pixel.y] == undefined) {continue}
if (view===null || view===3) {
var colorOut = pixel.color;
for(var imsorryaboutthelagthiswillcause in specialProperties) {
if(pixel[imsorryaboutthelagthiswillcause] !== undefined && specialProperties[imsorryaboutthelagthiswillcause].specialColorFunction) {
colorOut = specialProperties[imsorryaboutthelagthiswillcause].specialColorFunction(pixel,oldColor=colorOut)
}
}
ctx.fillStyle = colorOut;
}
else if (view === 2) { // thermal view
// set the color to pixel.temp, from hottest at 0 hue to coldest 225 hue, with the minimum being -273, max being 6000
var temp = pixel.temp;
if (temp < -273) {temp = -273}
if (temp > 6000) {temp = 6000}
var hue = 225 - (temp/6000)*225;
if (hue < 0) {hue = 0}
if (hue > 225) {hue = 225}
ctx.fillStyle = "hsl("+hue+",100%,50%)";
}
else if (view === 4) { // smooth view, average of surrounding pixels
// E/N: i'm too scared to do smooth view
var colorlist = [];
// check adjacent coords on the pixelMap, add the color to the list if the pixel is not empty and the color indexOf "rgb" is not -1
for (var j = 0; j < biCoords.length; j++) {
var x = pixel.x + biCoords[j][0];
var y = pixel.y + biCoords[j][1];
if (isEmpty(x,y,true) || elements[pixelMap[x][y].element].state !== elements[pixel.element].state) {continue}
var color = pixelMap[x][y].color;
if (color.indexOf("rgb") !== -1) {
colorlist.push(color.match(/\d+/g));
}
}
if (colorlist.length === 0) {
ctx.fillStyle = pixel.color;
}
else {
ctx.fillStyle = averageRGB(colorlist);
}
}
if (ctx.globalAlpha < 1 && !elements[pixel.element].isGas) {
ctx.globalAlpha = 1;
}
if ((view === null || view === 4) && elements[pixel.element].isGas) {
if (ctx.globalAlpha!==0.5) { ctx.globalAlpha = 0.5; }
ctx.fillRect((pixel.x-1)*pixelSize, (pixel.y)*pixelSize, pixelSize*3, pixelSize);
ctx.fillRect((pixel.x)*pixelSize, (pixel.y-1)*pixelSize, pixelSize, pixelSize*3);
}
else { // draw the pixel (default)
ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize);
}
if (pixel.charge && view !== 2) { // Yellow glow on charge
if (!elements[pixel.element].colorOn) {
ctx.fillStyle = "rgba(255,255,0,0.5)";
ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize);
}
}
}
if (ctx.globalAlpha < 1) {
ctx.globalAlpha = 1;
}
if ((!paused) || forceTick) {pixelTicks++};
}
//I hate overwriting drawPixels
runAfterLoad(function() {
console.log(everyTick(function() {
if(paused) { return };
for(var propName in specialProperties) {
//thanks, I hate not being able to pass arguments to filter functions
var _filterFunction = function(pixel) {
return pixel.hasOwnProperty(propName)
};
var pixelsWithProp = currentPixels.filter(_filterFunction);
//console.log(pixelsWithProp.map(p => [p.x,p.y,propName,p[propName]].join(",")).join("\n"));
for(var i in pixelsWithProp) {
var propPixel = pixelsWithProp[i];
if(!propPixel || propPixel.del) { continue };
specialProperties[propName]?.specialFunction?.(propPixel);
};
}
}),"Property handler tick callback set")
});
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod);
enabledMods.splice(enabledMods.indexOf(modName),0,libHookTickMod);
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${libraryMod} and ${libHookTickMod} mods are required and have been automatically inserted (reload for this to take effect).`);
};

View File

@ -1,7 +1,7 @@
var modName = "mods/switches.js"; var modName = "mods/switches.js";
var noConductMod = "mods/noConduct.js"; var formerlyNoConductMod = "mods/doElectricity changes.js";
if(enabledMods.includes(noConductMod)) { if(enabledMods.includes(formerlyNoConductMod)) {
elements.switch_off = { elements.switch_off = {
name: "switch (off)", name: "switch (off)",
color: "#7F3333", color: "#7F3333",
@ -45,7 +45,7 @@ if(enabledMods.includes(noConductMod)) {
category: "machines", category: "machines",
}; };
} else { } else {
enabledMods.splice(enabledMods.indexOf(modName),0,noConductMod) enabledMods.splice(enabledMods.indexOf(modName),0,formerlyNoConductMod)
alert(`The ${noConductMod} mod is required and has been automatically inserted (reload for this to take effect).`) alert(`The ${formerlyNoConductMod} mod is required and has been automatically inserted (reload for this to take effect).`)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
}; };

399
mods/test_2.js Normal file
View File

@ -0,0 +1,399 @@
var modName = "mods/test_2.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
/*function defaultIonizationColorFormula(state) {
return convertColorFormats({r: 255, g: 221 - ((state + 1) * 32), b: 255 - ((state + 1) * 8)},"hex");
};
function secondTestDefaultIonizationColorFormula(state) {
return convertColorFormats({r: 221 - ((state + 1) * 32), g: 255, b: 255 - ((state + 1) * 8)},"hex");
};
function thirdTestDefaultIonizationColorFormula(state) {
var lum = 17 + (state * 10);
return convertColorFormats({r: lum, g: lum, b: lum},"hex");
};
function fourthTestDefaultIonizationColorFormula(state) {
return convertColorFormats({r: 0x9f + (state * 4), g: 0xff - state, b: 0x7f - (state * 3)},"hex");
};*/
function iHeliumColorFunction(state) {
return convertColorFormats({r: 128 - (state * 64), g: 0, b: 255},"hex")
};
function iCarbonColorFunction(state) {
return convertColorFormats({r: 128, g: 128 + (state * 25.6), b: 128},"hex")
};
function iNitrogenColorFunction(state) {
var fraction = 256/6;
return convertColorFormats({r: (state * fraction), g: (state * fraction), b: 256 - (state * fraction)},"hex")
};
function iOxygenColorFunction(state) {
return convertColorFormats({r: 255, g: 25, b: state * 24},"hex")
};
if(elements.carbon.reactions) {
var TheReVeFestival_Finale = structuredClone(elements.carbon.reactions)
};
delete elements.carbon;
scientificElementoids = {
/*defaultium: { sublimates: false, solidColor: "#EEEEEE", solidDensity: 1000, meltingPoint: 1200, solidHardness: 0.8,
liquidColor: "#FFFFFF", liquidDensity: 850, liquidViscosity: 4000, boilingPoint: 2500,
gasColor: "#FFDDFF", gasDensity: 3.5,
ionizationEnergies_eV: [15,30,45,60,100], ionizationColorFormula: defaultIonizationColorFormula,
defaultState: "solid"
},
sublimatestium: { sublimates: true, solidColor: "#FFFFCC", solidDensity: 813, meltingPoint: 1033, solidHardness: 0.5,
liquidColor: "#EEEEAA", liquidDensity: 420, liquidViscosity: 420, boilingPoint: 42069,
gasColor: "#FFFF96", gasDensity: 3.2,
ionizationEnergies_eV: [12,41,99], ionizationColorFormula: secondTestDefaultIonizationColorFormula,
defaultState: "solid"
},
pneumagvnigium: { sublimates: false, solidColor: "#100810", solidDensity: 814, meltingPoint: -191, solidHardness: 0.7,
liquidColor: "#131011", liquidDensity: 1013, liquidViscosity: 131, boilingPoint: -83,
gasColor: "#202020", gasDensity: 14.6,
ionizationEnergies_eV: [11,22,33,44,55,66,77,88,99,110,121,1337],
ionizationColorFormula: thirdTestDefaultIonizationColorFormula,
defaultState: "gas"
},*/
hydrogen: { sublimates: false, solidColor: "#e6e6ff", solidDensity: 86, meltingPoint: -259.2, solidHardness: 0.3,
liquidColor: "#97afcf", liquidDensity: 70.85, liquidViscosity: 0.013, boilingPoint: -253,
gasColor: "#558bcf", gasDensity: 0.084,
ionizationEnergies_eV: [13.59844], ionizationColorFormula: function() { return "#FF00FF" },
defaultState: "gas"
},
//non-superfluid viscosity: https://royalsocietypublishing.org/doi/pdf/10.1098/rspa.1950.0181
helium: { sublimates: false, solidColor: "#faebeb", solidDensity: 214, meltingPoint: -Infinity, solidHardness: 0.3,
liquidColor: "#e3d3d3", liquidDensity: 124.8, liquidViscosity: 0.0033, boilingPoint: -268.9,
gasColor: "#a69494", gasDensity: 0.138 * airDensity, //i used a relative density because i can't make sense of the units in given liquid vs gas densities
ionizationEnergies_eV: [24.587387936,54.41776311], ionizationColorFormula: iHeliumColorFunction,
defaultState: "gas"
},
//lithium
//beryllium
//boron
carbon: { sublimates: true, solidColor: "#171717", solidDensity: 3500, meltingPoint: 3642, solidHardness: 0.7,
liquidColor: ["#ffae9f", "#ffba80", "#ff9c8f"], liquidDensity: 1200, liquidViscosity: 69, boilingPoint: 3642,
gasColor: ["#ffce9f", "#ffda80", "#ffbc8f"], gasDensity: 2, //made-up due to insufficient science
ionizationEnergies_eV: [11.26030,24.38332,47.8878,64.4939,392.087,489.99334], ionizationColorFormula: iCarbonColorFunction,
defaultState: "solid"
},
nitrogen: { sublimates: false, solidColor: "#e6e6e6", solidDensity: 1026.5, meltingPoint: -210, solidHardness: 0.3,
liquidColor: "#d3e1e3", liquidDensity: 806.4, liquidViscosity: 0.00545, boilingPoint: -198.5,
gasColor: "#b8d1d4", gasDensity: 1.1606,
ionizationEnergies_eV: [14.53414,29.6013,47.44924,77.4735,97.8902,552.0718,667.046], ionizationColorFormula: iNitrogenColorFunction,
defaultState: "gas"
},
oxygen: { sublimates: false, solidColor: "#00cfc6", solidDensity: 214, meltingPoint: -218, solidHardness: 0.3,
liquidColor: "#00ad99", liquidDensity: 1141, liquidViscosity: 0.2849, boilingPoint: -189,
gasColor: "#99c7ff", gasDensity: 1.4291,
ionizationEnergies_eV: [13.61806,35.11730,54.9355,77.41353,113.8990,138.1197,739.29,871.4101], ionizationColorFormula: iOxygenColorFunction,
defaultState: "gas"
}
};
behaviors.HOT_GAS = [
"CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2",
"M1|XX|M1",
"CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2"
],
behaviors.SUPERHOT_GAS = [
"CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2",
"M1|XX|M1",
"CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2"
],
first9 = [ "singly", "doubly", "triply", "quadruply", "quintuply", "sextuply", "septuply", "octuply", "nonuply", "ERROR" ];
ones = ["", "un", "duo", "tre", "quattuor", "quin", "sex", "septen", "octo", "novem", "ERROR"];
tens = ["", "dec", "vigint", "trigint", "quadragint", "quinquagint", "sexagint", "septuagint", "octogint", "nonagint", "ERROR"];
hundreds = ["", "cent", "ducent", "trecent", "quadringent", "quingent", "sescent", "septingent", "octingent", "nongent", "ERROR"];
thousands = ["", "mill", "dumill", "trimill", "quadrimill", "quinmill", "sexmill", "septimill", "octimill", "nonimill", "ERROR"];
function getTupleAdverb(number) { //this code is horrendous
if(number == "0") { return "nullly" };
number--;
if(number <= 8) {
return first9[number];
} else {
number++;
var onesPlace = Math.floor(number % 10);
var tensPlace = Math.floor((number / 10) % 10);
var hundredsPlace = Math.floor((number / 100) % 10);
var thousandsPlace = Math.floor((number / 1000) % 10);
var tupleOnes = ones[onesPlace];
var tupleTens = tens[tensPlace];
var tupleHundreds = hundreds[hundredsPlace];
var tupleThousands = thousands[thousandsPlace];
if(tupleOnes.endsWith("tre")) {
if(!tupleTens.startsWith("d") && !tupleTens.startsWith("s")) { //tre is not tres before d, and not as many people double the S
tupleOnes = "tres";
//this entire code block is basically so we can use trescentuple for 103-uple and trecentuple for 300-uple
};
};
if(number > 100 && tupleTens !== "") { //tens before something have an number after them
tupleTens += "number";
};
if(number > 1000 && tupleHundreds !== "") { //hundreds before something have an number after them
tupleHundreds += "number";
};
tuple = tupleOnes + tupleTens + tupleHundreds + tupleThousands + "uply";
return tuple;
};
};
function makeScrapColor(colorIn) {
var colorInput = colorIn; //side effects?
//make sure in is array
if(!(colorInput instanceof Array)) {
colorInput = [colorInput];
};
colorInput = colorInput.map(color => convertColorFormats(color,"hex"));
//prepare final color
var finalColor = [];
var lumOffsets = [1.2,1,0.8];
for(var i in colorInput) {
for(var j in lumOffsets) {
finalColor.push(changeLuminance(colorInput[i],lumOffsets[j],"multiply","hex"));
};
};
return finalColor;
};
for(element in scientificElementoids) {
var elemInfo = scientificElementoids[element];
if(!elemInfo.liquidColor) {
elemInfo.liquidColor = makeMoltenColor(elemInfo.solidColor);
};
if(!elemInfo.gasColor) {
elemInfo.gasColor = makeGasColor(elemInfo.solidColor);
};
var names = {
solid: elemInfo.meltingPoint <= 0 ? element + "_ice" : "solid_" + element,
powder: elemInfo.meltingPoint <= 0 ? element + "_snow" : "powdered_" + element,
liquid: (elemInfo.meltingPoint > 200 ? "molten_" : "liquid_") + element,
gas: element + "_gas"
};
names[elemInfo.defaultState] = element; //"hydrogen" is not "hydrogen_gas", iron is not "solid_iron", etc.
if(elemInfo.defaultState == "liquid" && elemInfo.sublimates) {
throw new Error("A sublimating element can't have a liquid default state, idiot!");
};
var ionizationTemperatures = elemInfo.ionizationEnergies_eV.map(x => (x * 16021766340) / 1380649);
var liquidIsHot = (elemInfo.meltingPoint > 600);
var gasIsHot = (elemInfo.boilingPoint > 600);
var solidIsCold = (elemInfo.meltingPoint < 0);
//"nullish"-piecewise definition to preserve reactions
elements[names.solid] ??= {};
elements[names.solid].color = elemInfo.solidColor;
elements[names.solid].density = elemInfo.solidDensity;
elements[names.solid].hardness = elemInfo.solidHardness;
elements[names.solid].breakInto = names.powder;
elements[names.solid].temp = Math.min(20, elemInfo.meltingPoint * 1.1);
elements[names.solid].tempHigh = elemInfo.meltingPoint;
elements[names.solid].stateHigh = elemInfo.sublimates ? names.gas : names.liquid;
elements[names.solid].behavior = behaviors.WALL;
elements[names.solid].category = "powders";
elements[names.solid].state = "solid";
elements[names.solid].hidden = true;
elements[names.powder] ??= {};
elements[names.powder].color = makeScrapColor(elemInfo.solidColor);
elements[names.powder].density = elemInfo.solidDensity * 0.7;
elements[names.powder].hardness = elemInfo.solidHardness * 0.7;
elements[names.powder].temp = Math.min(20, elemInfo.meltingPoint * 1.1);
elements[names.powder].tempHigh = elemInfo.meltingPoint;
elements[names.powder].stateHigh = elemInfo.sublimates ? names.gas : names.liquid;
elements[names.powder].behavior = behaviors.POWDER;
elements[names.powder].category = "powders";
elements[names.powder].state = "powder";
elements[names.powder].hidden = true;
if(elemInfo.sublimates != true) {
elements[names.liquid] ??= {};
elements[names.liquid].color = elemInfo.liquidColor;
elements[names.liquid].density = elemInfo.liquidDensity;
elements[names.liquid].temp = (elemInfo.meltingPoint + elemInfo.boilingPoint) / 2;
elements[names.liquid].tempHigh = elemInfo.boilingPoint;
elements[names.liquid].stateHigh = names.gas;
elements[names.liquid].tempLow = elemInfo.meltingPoint;
elements[names.liquid].stateLow = names.solid;
elements[names.liquid].viscosity = elemInfo.liquidViscosity;
elements[names.liquid].behavior = liquidIsHot ? behaviors.MOLTEN : behaviors.LIQUID;
elements[names.liquid].category = "liquids";
elements[names.liquid].state = "liquid";
elements[names.liquid].hidden = true;
};
elements[names.gas] ??= {}
elements[names.gas].color = elemInfo.gasColor;
elements[names.gas].density = elemInfo.gasDensity;
elements[names.gas].temp = (elemInfo.sublimates ? elemInfo.meltingPoint : elemInfo.boilingPoint) * 1.1;
elements[names.gas].tempLow = (elemInfo.sublimates ? elemInfo.meltingPoint : elemInfo.boilingPoint);
elements[names.gas].stateLow = elemInfo.sublimates ? names.solid : names.liquid;
elements[names.gas].behavior = gasIsHot ? behaviors.HOT_GAS : behaviors.GAS;
elements[names.gas].category = "gases";
elements[names.gas].state = "gas";
elements[names.gas].hidden = true;
if(elemInfo.ionizationEnergies_eV && elemInfo.ionizationEnergies_eV.length > 0 && elemInfo.ionizationColorFormula) {
elements[names.gas].tempHigh = ionizationTemperatures[0];
elements[names.gas].stateHigh = "ionized_" + element;
var lastTempsIndex = ionizationTemperatures.length - 1;
for(j in ionizationTemperatures) {
j = parseInt(j); // for some reason JS is suddenly deciding to use strings for array iterators
var plasmaName = (getTupleAdverb(j + 1) + "_ionized_" + element).replace("singly_","");
var lastPlasmaName = (getTupleAdverb(j) + "_ionized_" + element).replace("singly_","");
var nextPlasmaName = (getTupleAdverb(j + 2) + "_ionized_" + element).replace("singly_","");
var plasmaTemp = ionizationTemperatures[j];
elements[plasmaName] = {
color: elemInfo.ionizationColorFormula(j),
density: elemInfo.gasDensity * (0.99 ** (j + 1)),
temp: (Math.ceil(plasmaTemp/10000)*10000) + 1000,
tempLow: ionizationTemperatures[j],
stateLow: j == 0 ? names.gas : lastPlasmaName,
behavior: behaviors.SUPERHOT_GAS,
category: "energy",
state: "gas",
hidden: true,
};
if(j < lastTempsIndex) {
elements[plasmaName].tempHigh = ionizationTemperatures[j + 1];
//console.log(j,getTupleAdverb(j),nextPlasmaName);
elements[plasmaName].stateHigh = nextPlasmaName;
};
};
};
elements[names[elemInfo.defaultState]].hidden = false;
elements[names[elemInfo.defaultState]].temp = 20;
};
//Manual work for diatomic gases and other shit
elements.carbon_dioxide.tempHigh = 6275.6434478747902; //50% point
elements.carbon_dioxide.stateHigh = ["carbon","oxygen","carbon_dioxide","carbon_dioxide"];
if(typeof(TheReVeFestival_Finale) !== "undefined") {
elements.carbon.reactions = TheReVeFestival_Finale;
};
elements.carbon.behavior = behaviors.POWDER;
elements.monatomic_nitrogen = {
temp: 13000,
tempLow: 12345, //Number pulled entirely out of my ass due to acute literature deficiency (does nobody care?)
stateLow: "nitrogen",
behavior: behaviors.GAS,
tempHigh: elements.nitrogen.tempHigh,
stateHigh: "ionized_nitrogen",
color: "#add2ff",
category: "gases",
state: "gas",
density: 1
};
elements.nitrogen.tempHigh = 12345;
elements.nitrogen.stateHigh = "monatomic_nitrogen";
elements.ionized_nitrogen.tempLow = elements.monatomic_nitrogen.tempHigh;
elements.ionized_nitrogen.stateLow = "monatomic_nitrogen";
elements.monatomic_oxygen = {
temp: 18000,
tempLow: 16851,
stateLow: "oxygen",
behavior: behaviors.GAS,
tempHigh: elements.oxygen.tempHigh,
stateHigh: "ionized_oxygen",
color: "#d2adff",
category: "gases",
state: "gas",
density: 1
};
elements.oxygen.tempHigh = 16851;
elements.oxygen.stateHigh = "monatomic_oxygen";
elements.ionized_oxygen.tempLow = elements.monatomic_oxygen.tempHigh;
elements.ionized_oxygen.stateLow = "monatomic_oxygen";
var newSteamTick = function(pixel) {
pixel.split ??= 0;
if(pixel.split == 0 && pixel.temp >= 2200) {
if(Math.random() < 0.03) {
changePixel(pixel,Math.random() < 1/3 ? "oxygen" : "hydrogen",false)
};
pixel.split = 1
} else if(pixel.split == 1 && pixel.temp >= 2600) { //made-up data point for smoothness
if(Math.random() < 0.097) {
changePixel(pixel,Math.random() < 1/3 ? "oxygen" : "hydrogen",false)
};
pixel.split = 2
} else if(pixel.split == 2 && pixel.temp >= 3000) {
if(Math.random() < 0.45) {
changePixel(pixel,Math.random() < 1/3 ? "oxygen" : "hydrogen",false)
};
pixel.split = 3
};
if(pixel.split > 1 && Math.random() < 0.03) { pixel.split = 0 }
};
var tempkeys = {steam: 0, cloud: 0};
for(var name in tempkeys) {
if(typeof(elements[name].tick) == "function") {
var tick1 = elements[name].tick;
var tick2 = newSteamTick;
elements[name].tick = function(pixel) {
tick1(pixel);
if(pixel && !(pixel.del)) {
tick2(pixel)
}
}
} else {
elements[name].tick = newSteamTick;
};
};
elements.hydrogen.reactions.oxygen.tempMax = 3000;
} else {
enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod)
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`)
};

File diff suppressed because it is too large Load Diff

162
mods/wifi.js Normal file
View File

@ -0,0 +1,162 @@
var modName = "mods/wifi.js";
var libraryMod = "mods/code_library.js";
if(enabledMods.includes(libraryMod)) {
//https://stackoverflow.com/a/60922255
elements.wifi = {
color: "#bfff7f",
properties: {
_channel: 0,
_correspondingWifi: null,
},
hardness: 0.8,
breakInto: ["plastic","steel","copper"],
conduct: 1,
insulate: true,
tick: function(pixel) {
pixel._channel = Math.floor(pixel.temp / 100);
var colorBase = (pixel._channel + 3);
if(colorBase < 0 || colorBase > 124) {
pixel.color == "rgb(212,185,222)";
} else {
colorBase = colorBase.toString(5).padStart(3,"0").split("").map(x => parseInt(x) * 64);
pixel.color = `rgb(${colorBase.join(",")})`
};
pixel._correspondingWifi = currentPixels.filter(function(pixelToCheck) {
return (
pixelToCheck !== pixel && //should work if this pixel is the same as the other one by reference
["wifi","receiver"].includes(pixelToCheck.element) &&
pixelToCheck._channel == pixelChannel
);
},pixelChannel=pixel._channel).map(pixel => [pixel.x,pixel.y]);
if(pixel.charge) {
for(var i in pixel._correspondingWifi) {
i = parseInt(i);
var wifiCoords = pixel._correspondingWifi[i];
var newPixel = pixelMap[wifiCoords[0]]?.[wifiCoords[1]];
if(newPixel) {
if(!newPixel.chargeCD) {
for(var j in adjacentCoords) {
j = parseInt(j);
var pixelAdjacentToWifi = pixelMap[newPixel.x+adjacentCoords[j][0]]?.[newPixel.y+adjacentCoords[j][1]];
if(pixelAdjacentToWifi) { pixelAdjacentToWifi.charge = 1 };
};
}
}
};
if(pixel._correspondingWifi.length > 0) {
delete pixel.charge;
pixel.chargeCD = 5
}
}
if(typeof(pixel.chargeCD) !== "undefined") {
pixel.chargeCD--;
if(pixel.chargeCD <= 0) { delete pixel.chargeCD };
};
},
category: "machines",
state: "solid",
};
elements.transmitter = {
color: "#00ff7f",
properties: {
_channel: 0,
_correspondingWifi: null,
},
hardness: 0.8,
breakInto: ["plastic","steel","copper"],
conduct: 1,
insulate: true,
tick: function(pixel) {
pixel._channel = Math.floor(pixel.temp / 100);
var colorBase = (pixel._channel + 3);
if(colorBase < 0 || colorBase > 124) {
pixel.color == "rgb(212,185,222)";
} else {
colorBase = colorBase.toString(5).padStart(3,"0").split("").map(x => parseInt(x) * 64);
pixel.color = `rgb(${colorBase.join(",")})`
};
pixel._correspondingWifi = currentPixels.filter(function(pixelToCheck) {
return (
pixelToCheck !== pixel && //should work if this pixel is the same as the other one by reference
["wifi","receiver"].includes(pixelToCheck.element) &&
pixelToCheck._channel == pixelChannel
);
},pixelChannel=pixel._channel).map(pixel => [pixel.x,pixel.y]);
if(pixel.charge) {
for(var i in pixel._correspondingWifi) {
i = parseInt(i);
var wifiCoords = pixel._correspondingWifi[i];
var newPixel = pixelMap[wifiCoords[0]]?.[wifiCoords[1]];
if(newPixel) {
if(!newPixel.chargeCD) {
for(var j in adjacentCoords) {
j = parseInt(j);
var pixelAdjacentToWifi = pixelMap[newPixel.x+adjacentCoords[j][0]]?.[newPixel.y+adjacentCoords[j][1]];
if(pixelAdjacentToWifi && elements[pixelAdjacentToWifi.element].conduct) { pixelAdjacentToWifi.charge = 1 };
};
}
}
};
if(pixel._correspondingWifi.length > 0) {
delete pixel.charge;
pixel.chargeCD = 5
}
}
if(typeof(pixel.chargeCD) !== "undefined") {
pixel.chargeCD--;
if(pixel.chargeCD <= 0) { delete pixel.chargeCD };
};
},
category: "machines",
state: "solid",
}
elements.receiver = {
color: "#bfff00",
properties: {
_channel: 0,
},
hardness: 0.8,
breakInto: ["plastic","steel","copper"],
conduct: 1,
insulate: true,
tick: function(pixel) {
pixel._channel = Math.floor(pixel.temp / 100);
var colorBase = (pixel._channel + 3);
if(colorBase < 0 || colorBase > 124) {
pixel.color = "rgb(212,185,222)";
} else {
colorBase = colorBase.toString(5).padStart(3,"0").split("").map(x => parseInt(x) * 64);
pixel.color = `rgb(${colorBase.join(",")})`
};
if(typeof(pixel.chargeCD) !== "undefined") {
pixel.chargeCD = Math.min(pixel.chargeCD,5);
pixel.chargeCD--;
if(pixel.chargeCD <= 0) { delete pixel.chargeCD };
};
if(pixel.charge) {
pixel.charge -= 0.25;
if(pixel.charge <= 0) { delete pixel.charge };
};
},
category: "machines",
state: "solid",
}
} else {
if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) };
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
alert(`The "${libraryMod}" mods is required; and has been automatically inserted (reload for this to take effect).`)
};