Merge branch 'R74nCom:main' into main

This commit is contained in:
Nekonico 2025-10-15 18:43:40 -07:00 committed by GitHub
commit 06e606c3c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 661 additions and 140 deletions

View File

@ -243,6 +243,7 @@
<tr><td>radioactive.js</td><td>Radioactive elements on the periodic table [WIP]</td><td>kaeud</td></tr>
<tr><td>random_rocks.js</td><td>Randomly generates rocks on game load</td><td>Alice</td></tr>
<tr><td>roseyiede.js</td><td>Several variants of a substance called roseyiede</td><td>Alice</td></tr>
<tr><td>solubility.js</td><td>Adds solubility and a simple-to-use format for other mods to use with it</td><td>Orchid</td></tr>
<tr><td>some_tf_liquids.js</td><td>Various liquids from the Thermal Foundation Minecraft mod</td><td>Alice</td></tr>
<tr><td>stickystuff.js</td><td>Slime, Honey, and others can stick to other elements</td><td>Suss</td></tr>
<tr><td>the_ground.js</td><td>Several rocks, worldgen types, and gemstones</td><td>Alice</td></tr>
@ -263,6 +264,7 @@
<tr><td>gameOfLife.js</td><td>Conway's Game of Life on a screen</td><td>ggod</td></tr>
<tr><td>heatshield.js</td><td>Heatshields, makes Plasma cooler</td></td><td>Taterbob</td></tr>
<tr><td>human_friendly_design.js</td><td>Pipes, Portals, Drag, and Mix don't kill humans</td><td>Nekonico</td></tr>
<tr><td>industry.js</td><td>Conveyors and emitters for most energy types</td><td>pogdog</td></tr>
<tr><td>logicgates.js</td><td>Predictable electricity and logic gates</td><td>nousernamefound</td></tr>
<tr><td>note_block_advanced.js</td><td>Edit of Alice's note_block.js, adds different blocks with different frequencies</td><td>CharsonBurensen</td></tr>
<tr><td>note_block.js</td><td>Musical Note Blocks</td><td>Alice</td></tr>
@ -363,6 +365,7 @@
<tr><td>volcanic_expansion.js</td><td>Obsidian, Pumice, and Andesite rocks</td><td>Jayd</td></tr>
<!----><tr><td class="modCat" colspan="3">Fun & Games</td></tr><!---->
<tr><td>3pms_mod.js</td><td>Adds random stuff and tools</td><td>3pm</td></tr>
<tr><td>10kelements.js</td><td>Customizable amount of randomly generated elements</td><td>nousernamefound</td></tr>
<tr><td>all_around_fillers.js</td><td>Directional Filler variants</td><td>idk73248</td></tr>
<tr><td>allliquids.js</td><td>Made all elements liquids</td><td>Orchid</td></tr>
@ -396,6 +399,7 @@
<tr><td>random_liquids.js</td><td>Randomly generates liquids on game load</td><td>Alice</td></tr>
<tr><td>sbmixup.js</td><td>Silly elements from a <a href="https://R74n.com/mix/" target="_blank">Mix-Up!</a> game</td><td>stefanblox</td>
<tr><td>scp.js</td><td>Creatures and items from the SCP Wiki</td><td>Nekonico</td></tr>
<tr><td>sensitive.js</td><td>Makes all elements sensitive to air</td><td>pogdog</td></tr>
<tr><td>sports_beta.js</td><td>Several sports items</td><td>BluBun5193</td></tr>
<tr><td>star_wars.js</td><td>Various items from Star Wars by Disney</td><td>SeaPickle754</td>
<tr><td>sus.js</td><td>Among Us crewmate</td><td>Nv7</td></tr>
@ -404,6 +408,7 @@
<tr><td>troll.js</td><td>Various dumb elements that iterate randomly on the entire screen</td><td>Alice</td></tr>
<tr><td>WhisperingTheory.js</td><td>Powder and gas variant of heater and cooler</td><td>kaeud</td></tr>
<!----><tr><td class="modCat" colspan="3">Visual Effects</td></tr><!---->
<tr><td>acid_and_shapes.js</td><td>Weird visual effects enabled in settings</td><td>Alice</td></tr>
<tr><td>asciiboxels.js</td><td>Renders pixels as ASCII characters</td><td>Nekonico</td></tr>

View File

@ -1,43 +1,37 @@
// mod moment
// also made by 3pm
// made by 3pm
// starting the initiation
version = "0.0.1"
subversion = "0.0.12"
versionname = "Gullible On The Ceilling"
version = "0.0.2"
subversion = "0.0.21"
versionname = "Let's take a look..."
console.log("3pms_mod.js " + version + " \"" + versionname + "\"")
console.log("3pms_mod.js | Initiating...")
// bypassing the tps limit
// nvm this is useless
// whatever im keeping it
setTimeout(() => {
const tpsbutton = document.getElementById("tpsButton");
tpsbutton.onclick = () => {
var tpsprompt = prompt(
"Enter the new simulation Ticks Per Second (TPS). This is how many updates per second the simulation will run.\n\n" +
"The default is 30.\n\nThe current TPS is " + tps + ".\n\nNOTE: 3pms_mod.js removes the TPS limit.\n" +
"Any TPS higher than 1000 isn\'t recommended.\n\n"
);
var newtps = parseInt(tpsprompt);
if (tpsprompt !== null) {
if (isNaN(newtps) || newtps == "") {
alert("You did not enter a valid TPS.");
} else {
tps = parseInt(newtps);
if (isNaN(tps) || tps <= 0) {
alert("You did not enter a valid TPS.");
tps = 30;
function tpsPrompt() {
promptInput("Enter the new simulation Ticks Per Second (TPS). This is how many updates per second the simulation will run.\n\nThe default is 30.\n\nThe current TPS is " + tps + ".\n\nNOTE: 3pms_mod.js removes the TPS limit.\nAny TPS higher than 1000 isn't recommended.\n\n",
(r) => {
var newtps = parseInt(r);
if (r !== null) {
if (isNaN(newtps) || newtps == "") logMessage("You did not enter a valid TPS.");
else {
newtps = parseInt(newtps);
if (isNaN(newtps) || newtps <= 0) {
logMessage("You did not enter a valid TPS.");
}
else {
tps = newtps;
delete currentSaveData.oldTps;
}
}
resetInterval(tps);
}
}
resetInterval(tps);
}
focusGame();
};
}, 1000);
focusGame();
},
"Change TPS"
)
}
// more settings
@ -60,7 +54,7 @@ setTimeout(() => {
</div>
</div>
</div>`);
const menuText = document.getElementsByClassName("menuText")[6]
const menuText = document.getElementsByClassName("menuText")[9]
const newButton = document.createElement("button")
newButton.innerText = "More Settings"
newButton.className = "settingsButton"
@ -73,7 +67,7 @@ setTimeout(() => {
// elements
elements.calcium_oxide = { // most of this is taken off calcium
elements.calcium_oxide = {
color: ["#544E45","#6A635E","#6E6A61","#756F62","#918A7B"],
tick: function(pixel) {
behaviors.POWDER(pixel);
@ -95,39 +89,56 @@ elements.calcium_oxide = { // most of this is taken off calcium
fireColor: "#ff6b21"
}
elements.eeraser = { // finally integrating it after over a year
elements.eeraser = {
color: "#FFFF00",
behavior: behaviors.WALL,
behaviorON: [
"DL|DL|DL",
"DL|DL|DL",
behaviorOn: [
"DL|XX|DL",
"DL|XX|DL",
"DL|DL|DL",
],
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|XX|XX"
],
conduct: 0.5,
category: "machines",
insulate: elements.wire.insulate,
conduct: elements.wire.conduct,
noMix: elements.wire.noMix
state: "solid",
};
// stopping the initiation
// tools
elements.replace_all_of_element = {
color: ["#ff3030", "#800000"],
name: "replace all of element",
onSelect: async function() {
promptInput(
"Enter the element to be replaced.",
(r) => {
if (r in elements) {
elements.replace_all_of_element.tool = function(pixel) {
elementbefore = pixel.element
for (var i = 0; i <= width; i++) {
for (var j = 0; j <= height; j++) {
if (!isEmpty(i,j,true)) {
if(pixelMap[i][j].element == elementbefore) {
changePixel(pixelMap[i][j], r)
}
}
}
}
}
} else {
logMessage("You did not enter an existing element.");
}
},
"3pms_mod.js"
);
},
category: "tools",
};
setTimeout(() => {
console.log("3pms_mod.js | Initiated. Thank you.")
}, 1000);
const thing=document.createElement("p");thing.innerText="MY NAME 📛 IS DAVID 👨‍🎤 DAD 👨‍👩‍👧‍👦👨‍👩‍👧‍👧 I WANT SOME ICE 🧊🇦🇶 CREAM 🧴🧴 DAVID 👨‍🎤 THAT IS MY NAME 📛 DAVID 👨‍🎤👨‍🎤 I WANT ANOTHER WHERE ❔❓ IS MY BALL 🏈🏈 IM RUNNING 🏃‍♂️🏃‍♀️ OUT ON 🔛 THE ROAD 🚧 THERE IS A 🅰️ CAR 🚔🚖 AND IT IS GOING TO HIT 👊 ME 🖐🙋‍♀️ HEEEEEEEEELP HELP 💁 MEEEEEEE HEEEEEEEEEEEEEEEEELP\n\nthanks for using 3pms_mod.js :3";document.body.appendChild(thing)

View File

@ -3,7 +3,7 @@
// https://github.com/SquareScreamYT/
// https://youtube.com/@sqec
version = "v2.1.0"
version = "v2.1.1"
runAfterLoad(function() {
console.log("Current aChefsDream version: "+version)
@ -595,4 +595,147 @@ elements.pistachio_powder = {
hidden: true
}
elements.pumpkin_mash = {
color: ["#f59c2f", "#efa810", "#e38f1a"],
behavior: behaviors.STURDYPOWDER,
tempHigh: 125,
stateHigh: ["pumpkin_spice","pumpkin_spice","smoke"],
category: "food",
state: "liquid",
density: 500,
isFood: true,
hidden: true,
}
elements.pumpkin.breakInto = ["pumpkin_seed", "pumpkin_mash", "pumpkin_mash", "pumpkin_mash", "pumpkin_mash", null];
elements.pumpkin_spice = {
color: ["#95570b", "#ba7f36"],
behavior: behaviors.POWDER,
tempHigh: 400,
stateHigh: ["smoke","smoke","smoke","smoke","ash"],
category: "food",
state: "solid",
density: 500,
isFood: true,
hidden: true,
}
elements.cinnamon_powder.reactions.nutmeg_powder = { elem1: "pumpkin_spice", elem2: null, chance: 0.5 };
elements.coffee.reactions.pumpkin_mash = { elem2: null, color1: "#7e3c09", chance: 0.005 };
elements.coffee.reactions.pumpkin_spice = { elem2: null, color1: "#7e3c09", chance: 0.005 };
elements.nutmeg_tree = {
color: "#6B4226",
behavior: behaviors.WALL,
tempHigh: 400,
stateHigh: ["ember", "charcoal", "fire"],
category: "solids",
burn: 5,
burnTime: 300,
burnInto: ["ember", "charcoal", "fire"],
state: "solid",
hardness: 0.2,
breakInto: "sawdust",
hidden: true
};
elements.nutmeg_branch = {
color: "#5c3b23",
behavior: [
"CR:nutmeg_leaves,nutmeg_branch%2|CR:nutmeg_leaves,nutmeg_branch%2|CR:nutmeg_leaves,nutmeg_branch%2",
"XX|XX|XX",
"XX|XX|XX",
],
tempHigh: 100,
stateHigh: "nutmeg_tree",
tempLow: -30,
stateLow: "nutmeg_tree",
category: "life",
burn: 30,
burnTime: 60,
burnInto: ["sap", "ember"],
hidden: true,
state: "solid",
density: 1400,
breakInto: ["sap", "sawdust"]
};
elements.nutmeg_leaves = {
color: ["#4b7d3d", "#558c40"],
behavior: [
"XX|XX|XX",
"XX|XX|XX",
"XX|CR:nutmeg_fruit%0.1|XX",
],
reactions: {
"vinegar": { elem1: "dead_plant", chance: 0.035 },
"baking_soda": { elem1: "dead_plant", chance: 0.01 },
"bleach": { elem1: "dead_plant", chance: 0.05 },
"alcohol": { elem1: "dead_plant", chance: 0.035 },
},
category: "life",
tempHigh: 90,
stateHigh: "dead_plant",
tempLow: -1.5,
stateLow: "frozen_plant",
burn: 60,
burnTime: 60,
burnInto: "dead_plant",
state: "solid",
density: 1050,
hidden: true
};
elements.nutmeg_fruit = {
color: ["#c0a25d", "#ddb86c"],
behavior: behaviors.POWDER,
category: "food",
tempHigh: 100,
stateHigh: "dead_plant",
burn: 60,
burnTime: 60,
cutInto: ["mace", "nutmeg", "nutmeg"],
breakInto: ["mace", "nutmeg", "nutmeg"],
state: "solid",
density: 1050
};
elements.mace = {
color: ["#e04e1b", "#cc3614"],
behavior: behaviors.POWDER,
category: "food",
tempHigh: 250,
stateHigh: ["ash", "smoke"],
isFood: true,
state: "solid",
density: 900,
hidden: false
};
elements.nutmeg = {
color: ["#8b5a2b", "#A0522D"],
behavior: behaviors.POWDER,
category: "food",
tempHigh: 250,
stateHigh: ["ash", "smoke"],
isFood: true,
state: "solid",
density: 1000,
breakInto: "nutmeg_powder",
};
elements.nutmeg_powder = {
color: "#C58940",
behavior: behaviors.POWDER,
category: "food",
tempHigh: 250,
stateHigh: ["ash", "smoke"],
isFood: true,
state: "solid",
density: 950,
hidden: false
};
},true)

View File

@ -74,3 +74,87 @@ elements.tea_powder = {
hidden: true
}
elements.water.reactions.tea_powder = { elem1:"tea", chance:0.0002 }
elements.pumpkin.breakInto = ["pumpkin_seed","pumpkin_mash","pumpkin_mash","pumpkin_mash",null];
elements.pumpkin_mash = {
color: ["#DF7E06","#eba100"],
behavior: behaviors.STURDYPOWDER,
tempHigh: 125,
stateHigh: ["pumpkin_spice","pumpkin_spice",null],
category: "food",
state: "liquid",
density: 490.3,
isFood: true,
hidden: true,
}
elements.pumpkin_seed.tempHigh = 125;
elements.pumpkin_seed.stateHigh = ["pumpkin_spice","pumpkin_spice",null];
elements.pumpkin_spice = {
color: "#8d4f03",
grain: 1.5,
behavior: behaviors.POWDER,
tempHigh: 400,
stateHigh: ["smoke","smoke","smoke","smoke","ash"],
category: "food",
state: "solid",
density: 490.3,
isFood: true,
hidden: true,
}
elements.coffee.reactions.pumpkin_spice = { elem2:null, color1:"#6A2F03", chance:0.005 };
elements.coffee.reactions.pumpkin_mash = { elem2:null, color1:"#6A2F03", chance:0.005 };
elements.apple = {
color: ["#b22424","#f5c517","#66b447"],
grain: 2,
behavior: behaviors.POWDER,
// singleColor: true,
category: "food",
state: "solid",
density: 750,
isFood: true,
breakInto: "juice",
tempHigh: 175,
stateHigh: ["applesauce",null]
}
elements.applesauce = {
color: "#E7C45A",
behavior: behaviors.LIQUID,
viscosity: 50000,
tempHigh: 400,
stateHigh: "smoke",
category: "food",
state: "liquid",
density: 750,
isFood: true,
hidden: true,
}
if (!elements.mayo.reactions) elements.mayo.reactions = {};
elements.mayo.reactions.ketchup = { elem1:"mayochup", elem2:"mayochup" }
elements.mayochup = {
color: "#FDCC94",
behavior: behaviors.LIQUID,
reactions: {
"rust": { elem2:"iron", chance:0.005 },
"oxidized_copper": { elem2:"copper", chance:0.005 },
"baking_soda": { "elem1":"carbon_dioxide", elem2:"foam", chance:0.005, attr2:{"foam":3} },
"glue": { elem2:null, chance:0.005 },
"oil": { elem2:null, chance:0.005 },
"sap": { elem2:null, chance:0.005 }
},
viscosity: 26745.5,
tempHigh: 180.3,
stateHigh: ["carbon_dioxide","methane","steam","salt","sugar","steam","carbon_dioxide","methane"],
category:"liquids",
state: "liquid",
density: 1072.5,
isFood: true,
hidden: true
};

View File

@ -1,96 +1,77 @@
/*
*Version 2.2.0
*Version 2.2.1
*/
dependOn("orchidslibrary.js", ()=>{
elements.cloner.keyInput = "str:clone", elements.ecloner.keyInput = "str:clone", elements.slow_cloner.keyInput = "str:clone", elements.floating_cloner.keyInput = "str:clone";
let xDown = false;
elements.copper_sulfate = {
behavior: behaviors.POWDER,
color: ["#4391fd","#004cfe"],
reactions: {
ant: {"elem2": "dead_bug"},
fly: {"elem2": "dead_bug"},
firefly: {"elem2": "dead_bug"},
stink_bug: {"elem2": "dead_bug"},
bee: {"elem2": "dead_bug"},
termite: {"elem2": "dead_bug"},
spider: {"elem2": "dead_bug"},
plant: {"elem2": "dead_plant"},
grass: {"elem2": "dead_plant"},
algae: {"elem2": null},
kelp: {"elem2": "water"},
coral: {"elem2": "water"},
mushroom_cap: {"elem2": null},
mushroom_stalk: {"elem2": null},
mushroom_gill: {"elem2": null},
mushroom_spore: {"elem2": null},
zinc: {"stain2": "#2A1210"},
fire: {"elem1": null,"elem2": "poison_gas","chance": 0.1},
sugar: {"elem1": "oxidized_copper","elem2": null,"color1": ["#CB3D3D","#A6292B","#6E1B1B"]},
magnesium: {elem1: "copper", elem2: "epsom_salt"},
wood: {stain2: "#043023"},
},
tempHigh: 110,
fireColor: [
"#91d106",
"#feff97",
"#248e01"
],
state: "solid",
density: 3600,
hidden: true,
category: "powders",
id: 509,
movable: true,
properties: {
anhydrous: false
},
tick: function(pixel){
if(pixelTicks-pixel.start == 2 && xDown){
pixel.anhydrous = true;
let rgb = {r: 235, g: 247, b: 250};
elements.copper_sulfate.reactions = {
ant: {"elem2": "dead_bug"},
fly: {"elem2": "dead_bug"},
firefly: {"elem2": "dead_bug"},
stink_bug: {"elem2": "dead_bug"},
bee: {"elem2": "dead_bug"},
termite: {"elem2": "dead_bug"},
spider: {"elem2": "dead_bug"},
plant: {"elem2": "dead_plant"},
grass: {"elem2": "dead_plant"},
algae: {"elem2": null},
kelp: {"elem2": "water"},
coral: {"elem2": "water"},
mushroom_cap: {"elem2": null},
mushroom_stalk: {"elem2": null},
mushroom_gill: {"elem2": null},
mushroom_spore: {"elem2": null},
zinc: {"stain2": "#2A1210"},
fire: {"elem1": null,"elem2": "poison_gas","chance": 0.1},
sugar: {"elem1": "oxidized_copper","elem2": null,"color1": ["#CB3D3D","#A6292B","#6E1B1B"]},
magnesium: {elem1: "copper", elem2: "epsom_salt"},
wood: {stain2: "#043023"},
}
elements.copper_sulfate.tick = function(pixel){
if(pixelTicks-pixel.start == 2 && xDown){
pixel.anhydrous = true;
let rgb = {r: 235, g: 247, b: 250};
let num = 6 - (Math.round(Math.random()*12));
for(let key in rgb){
rgb[key] += num;
}
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
}
let multi = (pixel.temp-70)/100;
multi = (multi < 0) ? 0 : ((multi > 1) ? 1 : multi);
if(Math.random() < 0.05*multi){
pixel.anhydrous = true;
let rgb = {r: 235, g: 247, b: 250};
let num = 6 - (Math.round(Math.random()*12));
for(let key in rgb){
rgb[key] += num;
}
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
}
if(pixel.anhydrous){
let neighbors = [];
for(let coords of squareCoords){
let x = pixel.x+coords[0], y = pixel.y+coords[1];
neighbors[neighbors.length] = (isEmpty(x,y) && !outOfBounds(x,y)) ? "air" : (!outOfBounds(x,y)) ? pixelMap[x][y].element : undefined;
}
if(neighbors.includes("air") && pixel.temp < 50 && Math.random() < 0.00035){
pixel.anhydrous = false;
let rgb = (Math.random() > 0.5) ? {r: 67, g: 145, b: 253} : {r: 0, g: 76, b: 254};
let num = 6 - (Math.round(Math.random()*12));
for(let key in rgb){
rgb[key] += num;
}
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
}
let multi = (pixel.temp-70)/100;
multi = (multi < 0) ? 0 : ((multi > 1) ? 1 : multi);
if(Math.random() < 0.05*multi){
pixel.anhydrous = true;
let rgb = {r: 235, g: 247, b: 250};
let num = 6 - (Math.round(Math.random()*12));
for(let key in rgb){
rgb[key] += num;
}
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
}
if(pixel.anhydrous){
let neighbors = [];
for(let coords of squareCoords){
let x = pixel.x+coords[0], y = pixel.y+coords[1];
neighbors[neighbors.length] = (isEmpty(x,y) && !outOfBounds(x,y)) ? "air" : (!outOfBounds(x,y)) ? pixelMap[x][y].element : undefined;
}
if(neighbors.includes("air") && pixel.temp < 50 && Math.random() < 0.00035){
pixel.anhydrous = false;
let rgb = (Math.random() > 0.5) ? {r: 67, g: 145, b: 253} : {r: 0, g: 76, b: 254};
let num = 6 - (Math.round(Math.random()*12));
for(let key in rgb){
rgb[key] += num;
}
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
} else if (neighbors.includes("steam") || neighbors.includes("water") || neighbors.includes("salt_water") || neighbors.includes("sugar_water") || neighbors.includes("dirty_water") || neighbors.includes("seltzer") || neighbors.includes("pool_water") || neighbors.includes("slush")){
pixel.anhydrous = false;
let rgb = (Math.random() > 0.5) ? {r: 67, g: 145, b: 253} : {r: 0, g: 76, b: 254};
let num = 6 - (Math.round(Math.random()*12));
for(let key in rgb){
rgb[key] += num;
}
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
} else if (neighbors.includes("steam") || neighbors.includes("water") || neighbors.includes("salt_water") || neighbors.includes("sugar_water") || neighbors.includes("dirty_water") || neighbors.includes("seltzer") || neighbors.includes("pool_water") || neighbors.includes("slush")){
pixel.anhydrous = false;
let rgb = (Math.random() > 0.5) ? {r: 67, g: 145, b: 253} : {r: 0, g: 76, b: 254};
let num = 6 - (Math.round(Math.random()*12));
for(let key in rgb){
rgb[key] += num;
}
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
}
}
}
@ -806,6 +787,7 @@ dependOn("orchidslibrary.js", ()=>{
category: "salts",
state: "solid",
density: 3900,
solubility: {water: 3.5},
reactions: {
potassium: {elem1: "gold_coin", elem2: "potassium_salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}, color1: ["#574000", "#705200", "#634900", "#755600"]},
sodium: {elem1: "gold_coin", elem2: "salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}, color1: ["#574000", "#705200", "#634900", "#755600"]},
@ -823,6 +805,7 @@ dependOn("orchidslibrary.js", ()=>{
state: "solid",
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
density: 2320,
solubility: {water: 0.543, color: ["#7a9ff0", "#7aa4ff", "#729bf2", "#6f9cfc"]},
reactions: {
baking_soda: {elem1: "magnesium_carbonate", elem2: "salt"},
lye: {elem1: "magnesium_hydroxide", elem2: "salt"},
@ -852,6 +835,7 @@ dependOn("orchidslibrary.js", ()=>{
behavior: behaviors.POWDER,
state: "solid",
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
solubility: {water: 0.745, color: ["#7a9ff0", "#7aa4ff", "#729bf2", "#6f9cfc"]},
reactions: {
baking_soda: {elem1: "limestone", elem2: "salt"},
lye: {elem1: "slaked_lime", elem2: "salt"},
@ -941,6 +925,7 @@ dependOn("orchidslibrary.js", ()=>{
state: "solid",
color: ["#ffffff", "#fcfcfc", "#ffffff", "#ededed"],
density: 2470,
solubility: {water: 0.8, color: ["#7a9ff0", "#7aa4ff", "#729bf2", "#6f9cfc"]},
reactions: {
water: {elem1: "gallium", elem2: "acid"},
steam: {elem1: "gallium", elem2: "acid_gas"},
@ -972,6 +957,7 @@ dependOn("orchidslibrary.js", ()=>{
density: 2480,
tempHigh: 630,
stateHigh: ["chlorine", "aluminum"],
solubility: {water: 0.458, color: ["#7a9ff0", "#7aa4ff", "#729bf2", "#6f9cfc"]},
}
elements.acid.reactions.aluminum = {elem1: "hydrogen", elem2: "aluminum_chloride"};
elements.acid.reactions.purple_gold = {elem1: ["aluminum_chloride", "aluminum_chloride", "hydrogen"], elem2: "gold"};
@ -1079,6 +1065,7 @@ dependOn("orchidslibrary.js", ()=>{
state: "solid",
category: "salts",
alias: "Mg(CH₃COO)₂",
solubility: {water: 0.53, color: ["#7a9ff0", "#7aa4ff", "#729bf2", "#6f9cfc"]},
reactions: {
acid: {elem1: "magnesium_chloride", elem2: "vinegar"},
baking_soda: {elem1: "magnesium_carbonate", elem2: "sodium_acetate"},
@ -1095,6 +1082,7 @@ dependOn("orchidslibrary.js", ()=>{
state: "solid",
category: "salts",
alias: "Ca(CH₃COO)₂",
solubility: {water: 0.347, color: ["#7a9ff0", "#7aa4ff", "#729bf2", "#6f9cfc"]},
reactions: {
acid: {elem1: "calcium_chloride", elem2: "vinegar"},
baking_soda: {elem1: "limestone", elem2: "sodium_acetate"},
@ -1113,6 +1101,7 @@ dependOn("orchidslibrary.js", ()=>{
state: "solid",
category: "salts",
alias: "CH₃COOK",
solubility: {water: 2.55, color: ["#7a9ff0", "#7aa4ff", "#729bf2", "#6f9cfc"]},
reactions: {
acid: {elem1: "potassium_salt", elem2: "vinegar"},
baking_soda: {elem1: "caustic_potash", elem2: "sodium_acetate"},
@ -1128,6 +1117,7 @@ dependOn("orchidslibrary.js", ()=>{
state: "solid",
category: "salts",
alias: "Cu(CH₃COO)₂",
solubility: {water: 0.072},
reactions: {
sodium: {elem1: "copper", elem2: "sodium_acetate"},
potassium: {elem1: "copper", elem2: "potassium_acetate"},
@ -1148,6 +1138,7 @@ dependOn("orchidslibrary.js", ()=>{
state: "solid",
category: "salts",
alias: "CuCl₂",
solubility: {water: 0.743},
reactions: {
sodium: {elem1: "copper", elem2: "sodium_acetate"},
potassium: {elem1: "copper", elem2: "potassium_acetate"},
@ -1265,6 +1256,7 @@ dependOn("orchidslibrary.js", ()=>{
alias: "H₂PtCl₆",
tempHigh: 500,
stateHigh: ["acid_gas", "chlorine", "platinum", "platinum"],
solubility: {water: 1, },
reactions: {
sodium: {elem1: "salt", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
potassium: {elem1: "potassium_salt", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},

286
mods/solubility.js Normal file
View File

@ -0,0 +1,286 @@
/*
* Version 1.0.0
*/
dependOn("orchidslibrary.js", ()=>{
elements.water.reactions.salt = undefined;
elements.water.reactions.sugar = undefined;
elements.water.properties = {capacity: 100, elemsDissolved: {}};
elements.salt.solubility = {water: 0.36, color: ["#7ca3f7", "#7798e0", "#89abf5", "#96b8ff"]};
elements.sugar.solubility = {water: 2, visc: 850, color: ["#9bb0de", "#a8bbe3", "#a2b8e8", "#a7b7d9"]};
elements.lye.solubility = {water: 1.09, color: ["#7ca3f7", "#7798e0", "#89abf5", "#96b8ff"]};
elements.caustic_potash.solubility = {water: 1.1, color: ["#7ca3f7", "#7798e0", "#89abf5", "#96b8ff"]};
elements.potassium_salt.solubility = {water: 0.3397, color: ["#7ca3f7", "#7798e0", "#89abf5", "#96b8ff"]};
elements.borax.solubility = {water: 0.041, color: ["#658ce0", "#7299ed", "#7597e0", "#78a1fa"]};
elements.epsom_salt.solubility = {water: 0.351, color: ["#658ce0", "#7299ed", "#7597e0", "#78a1fa"]};
elements.sodium_acetate.solubility = {water: 1.233, color: ["#7ca3f7", "#7798e0", "#89abf5", "#96b8ff"]};
elements.baking_soda.solubility = {water: 0.097, color: ["#7ca3f7", "#7798e0", "#89abf5", "#96b8ff"]};
elements.copper_sulfate.solubility = {water: 0.32, color: ["#4a68f0", "#3358ff", "#2948d6", "#2146ed"]};
elements.lye.reactions.water = undefined;
elements.soap.reactions.water = undefined;
elements.ash.solubility = {water: 1.1, func: function(p1, p2){
if(p1.elemsDissolved.caustic_potash != undefined){
p1.elemsDissolved.caustic_potash += p1.elemsDissolved.ash;
p1.elemsDissolved.ash = 0;
} else {
p1.elemsDissolved.caustic_potash = p1.elemsDissolved.ash;
p1.elemsDissolved.ash = 0;
}
if(p2.dissolved >= 100){
changePixel(p2, getItem(["limestone", "quicklime", "charcoal", "dust", "dust"]));
p2.dissolved = undefined;
}
}};
elements.water.reactions.ash = undefined;
function getItem(obj){
let res;
if(Array.isArray(obj)){
res = obj[Math.round(Math.random()*obj.length)];
while(res == null){
res = obj[Math.round(Math.random()*obj.length)];
}
} else {
res = obj;
}
return res;
}
function aqueousReaction(p1, p2){
for(let elem in p1.elemsDissolved){
if(elements[elem].reactions != null && p2.element != "water" && elements[elem].reactions[p2.element] != undefined){
let r = elements[elem].reactions[p2.element];
if(r.tempMin && !((p1.temp >= r.tempMin) && (p2.temp >= r.tempMin))){
return false;
}
if(r.tempMax && !((p1.temp <= r.tempMax) && (p2.temp <= r.tempMax))){
return false;
}
if(r.charged && !(p1.charge || p2.charge)){
return false;
}
let c = (r.chance != undefined) ? r.chance : 1;
c = c*((p1.elemsDissolved[elem]/100)/elements[elem].solubility.water);
if(Math.random() > c){
return false;
}
if(r.aqFunc){
r.aqFunc(p1, p2);
}
if(r.elem1 != undefined){
let e = getItem(r.elem1);
if(elements[e].solubility != undefined && elements[e].solubility.water != undefined){
p1.elemsDissolved[e] = p1.elemsDissolved[elem];
p1.elemsDissolved[elem] = undefined;
} else {
if(e === null){
deletePixel(p1.x, p1.y);
} else {
changePixel(p1, e);
}
}
}
if(r.elem2 != undefined){
changePixel(p2, getItem(r.elem2));
}
if(r.charge1){
p1.charge = r.charge1;
}
if(r.charge2){
p2.charge = r.charge2;
}
if(r.stain1){
stainPixel(p1,r.stain1,0.05);
}
if(r.stain2){
stainPixel(p2,r.stain2,0.05);
}
} else if (p2.element == "water"){
for(let e2 in p2.elemsDissolved){
if(elements[elem].reactions != undefined && elements[elem].reactions[e2] != undefined){
let r = elements[elem].reactions[e2];
if(r.tempMin && !((p1.temp >= r.tempMin) && (p2.temp >= r.tempMin))){
return false;
}
if(r.tempMax && !((p1.temp <= r.tempMax) && (p2.temp <= r.tempMax))){
return false;
}
if(r.charged && !(p1.charge || p2.charge)){
return false;
}
let c = (r.chance != undefined) ? r.chance : 1;
c = c*((p1.elemsDissolved[elem]/100)/elements[elem].solubility.water);
if(Math.random() > c){
return false;
}
if(r.aqFunc){
r.aqFunc(p1, p2);
}
if(r.elem1 != undefined){
let e = getItem(r.elem1);
if(elements[e].solubility != undefined && elements[e].solubility.water != undefined){
p1.elemsDissolved[e] = p1.elemsDissolved[elem];
p1.elemsDissolved[elem] = undefined;
} else {
if(e === null){
deletePixel(p1.x, p1.y);
} else {
changePixel(p1, e);
}
}
}
if(r.elem2 != undefined){
let e = getItem(r.elem2);
if(elements[e].solubility != undefined && elements[e].solubility.water != undefined){
p2.elemsDissolved[e] = p1.elemsDissolved[elem];
p2.elemsDissolved[elem] = undefined;
} else {
if(e === null){
deletePixel(p2.x, p2.y);
} else {
changePixel(p2, e);
}
}
}
if(r.charge1){
p1.charge = r.charge1;
}
if(r.charge2){
p2.charge = r.charge2;
}
if(r.stain1){
stainPixel(p1,r.stain1,0.05);
}
if(r.stain2){
stainPixel(p2,r.stain2,0.05);
}
}
}
}
}
}
function updateColor(pixel){
let c = pixel.oColor;
for(let element in pixel.elemsDissolved){
//if(elements[element].solubility.color != undefined){
let color = (elements[element].solubility.color != undefined) ? getItem(elements[element].solubility.color) : getItem(elements[element].color);
/*if(Array.isArray(elements[element].solubility.color)){
color = elements[element].solubility.color[Math.round(Math.random()*elements[element].solubility.color.length)];
while(color == undefined){
color = elements[element].solubility.color[Math.round(Math.random()*elements[element].solubility.color.length)];
}
} else {
color = elements[element].solubility.color;
}*/
if(color.startsWith("#")){
color = hexToRGB(color);
} else if(color.startsWith("rgb(")){
color = getRGB(color);
}
c = interpolateRgb(getRGB(c), color, ((pixel.elemsDissolved[element]/100)/elements[element].solubility.water) || 0.01);
//console.log(rgb, color, getRGB(pixel.oColor), ((pixel.elemsDissolved[elem]/100)/elements[elem].solubility.water));
}
pixel.color = c;
//}
}
function solventTick(pixel) {
if(pixel.start = pixelTicks+5){
pixel.oColor = pixel.color;
}
pixel.capacity = (1+((pixel.temp-20)/80))*100;
for(let coords of adjacentCoords){
let x = pixel.x+coords[0], y = pixel.y+coords[1];
let p2 = getPixel(x,y);
let total = 0;
for(let elem in pixel.elemsDissolved){
total += pixel.capacity*((pixel.elemsDissolved[elem]/100)/elements[elem].solubility.water);
}
if(p2 != null){
aqueousReaction(pixel, p2);
}
if(p2 != null && total < pixel.capacity){
if(elements[p2.element].solubility != null && elements[p2.element].solubility[pixel.element] != null){
let solubilityObj = elements[p2.element].solubility;
p2.dissolved = (p2.dissolved == undefined) ? elements[p2.element].solubility[pixel.element] : p2.dissolved+elements[p2.element].solubility[pixel.element];
if(pixel.elemsDissolved[p2.element] == undefined){
pixel.elemsDissolved[p2.element] = elements[p2.element].solubility[pixel.element];
} else {
pixel.elemsDissolved[p2.element] += elements[p2.element].solubility[pixel.element];
}
updateColor(pixel, p2.element);
if(solubilityObj.func != undefined){
solubilityObj.func(pixel, p2);
}
if(p2.dissolved >= 100){
deletePixel(p2.x, p2.y);
}
}
} else if(total > (pixel.capacity+20) && p2 == null) {
let solArr = [], elemArr = [];
for(let elem in pixel.elemsDissolved){
elemArr.push(elem);
solArr.push(elements[elem].solubility[pixel.element]);
}
let index = solArr.indexOf(Math.min(...solArr));
if(isEmpty(x,y) && !outOfBounds(x,y)){
createPixel(elemArr[index], x, y);
let max = (pixel.elemsDissolved[elemArr[index]] > (total-pixel.capacity)) ? total-pixel.capacity : pixel.elemsDissolved[elemArr[index]];
pixelMap[x][y].dissolved = 100-max;
updateColor(pixel);
pixel.elemsDissolved[elemArr[index]] -= max;
}
}
else if (p2 != null && p2.element == "water"){
for(let elem in pixel.elemsDissolved){
if(p2.elemsDissolved[elem] == undefined) {p2.elemsDissolved[elem] = 0;};
if(p2.elemsDissolved[elem] > pixel.elemsDissolved[elem] && pixel.elemsDissolved[elem]/100 < elements[elem].solubility[pixel.element]){
p2.elemsDissolved[elem]--;
pixel.elemsDissolved[elem]++;
updateColor(pixel);
updateColor(p2);
} else if (p2.elemsDissolved[elem] < pixel.elemsDissolved[elem] && p2.elemsDissolved[elem]/100 < elements[elem].solubility[pixel.element]) {
p2.elemsDissolved[elem]++;
pixel.elemsDissolved[elem]--;
updateColor(pixel);
updateColor(p2);
}
}
}
}
if(pixel.temp >= elements[pixel.element].solventTempHigh){
let elem = null;
let num = Math.random();
if(elem === null){
for(let e in pixel.elemsDissolved){
if(num <= ((pixel.elemsDissolved[e]/100)/elements[e].solubility.water)){
elem = e;
}
}
}
elem = (elem == null) ? "steam" : elem;
changePixel(pixel, elem);
pixel.dissolvedElems = {};
}
}
behaviors.SOLVENT = function(pixel){
let visc = 0;
for(let elem in pixel.elemsDissolved){
if(elements[elem].solubility.visc != undefined){
visc += ((pixel.elemsDissolved[elem]/100)/elements[elem].solubility[pixel.element])*elements[elem].solubility.visc;
}
}
if(elements[pixel.element].viscosity != undefined){
visc = visc*(elements[pixel.element].viscosity/1000);
}
let chance = 1-(visc/1000);
let dir = (Math.random()<chance) ? (Math.random() < 0.5) ? 1 : -1 : 0;
if(!tryMove(pixel, pixel.x+dir, pixel.y+1) && !tryMove(pixel, pixel.x, pixel.y+1)){
tryMove(pixel, pixel.x+dir, pixel.y);
}
}
elements.water.tick = solventTick;
elements.water.behavior = behaviors.SOLVENT;
elements.water.tempHigh = undefined;
elements.water.solventTempHigh = 100;
}, true);