This commit is contained in:
slweeb 2025-11-04 11:50:44 -05:00
commit 7f7771045c
11 changed files with 1640 additions and 516 deletions

View File

@ -217,10 +217,10 @@
<tr><td>clf3.js</td><td>Chlorine Trifluoride</td><td>Alice</td></tr>
<tr><td>cmur.js</td><td>CharsonsModUno (???)</td><td>CharsonBurensen</td></tr>
<tr><td>debrisable.js</td><td>Expands the number of breakable elements, changes erosion, and adds way to craft certain elements from breaking other elements</td><td>Nekonico</td></tr>
<tr><td>eklegems.js</td><td>Large amouunt of gemstones and other crystals</td><td>ekle24</td></tr>
<tr><td>fire_extinguisher.js</td><td>Fire extinguisher blocks and realistic firefighting foam to put out nearly anything</td><td>Dr_Lego</td></tr>
<tr><td>fire_mod.js</td><td>Various properties to change fire behavior and radioactive fire</td><td>Alice</td></tr>
<tr><td>fire_slime.js</td><td>Pyrogenic version of slime</td><td>Alice</td></tr>
<tr><td>Gemstones.js</td><td>Gemstones</td><td>Schweeny</td></tr>
<tr><td>glenn_gases.js</td><td>Most gases from the <a href="https://www.jamieswhiteshirt.com/minecraft/mods/gases/" target="_blank">Glenn's Gases</a> mod into Sandboxels</td><td>Alice</td></tr>
<tr><td>grav_mudstones.js</td><td>Various forms of mudstone with different gravities</td><td>Alice</td></tr>
<tr><td>halogen.js</td><td>The missing halogens</td><td>nousernamefound</td></tr>
@ -335,6 +335,7 @@
<tr><td>colonies.js</td><td>Rockets that contain settlers to terraform a planet</td><td>Nekonico</td></tr>
<tr><td>crimson.js</td><td>Elements relating to the Crimson from Terraria</td><td>Alice</td></tr>
<tr><td>dogs.js</td><td>Simple dog and dog food</td><td>hedera-ivy</td></tr>
<tr><td>eklegems.js</td><td>Large amouunt of gemstones and other crystals</td><td>ekle24</td></tr>
<tr><td>fairy_chain.js</td><td>Way too many fairies to fey_and_more.js</td><td>Alice</td></tr>
<tr><td>fantastic_creatures.js</td><td>Various animals</td><td>Melecie</td></tr>
<tr><td>fantasy_elements.js</td><td>Fantasy creatures and substances</td><td>pixelegend4</td></tr>

View File

@ -1,11 +1,7 @@
/*Version 1.0.0 Pseudorandom world generator*/
function pseudorandom(key, max = 10){
let num = max;
for(let i = 0; i < key; i++){
num = ((num+(max*0.6))**1.8312312-2) % (max+1);
}
return num;
}
/*Version 1.1.0 Pseudorandom world generator*/
function pseudorandom(key, num, max = 1){
return (Math.log(key)*(num*Math.log(1625.4986772154357))) % max;
};
eLists.STONEELEMS = ["rock", "gravel", "tuff", "basalt", "rock_wall"];
let oreChances = {
diamond: 0.045,
@ -31,13 +27,17 @@ class biome {
if(!paused){togglePause();}
let fraction = seed/(2**32);
for(let level of this.yLevels){
for(let x = 0; x <= width; x++){
let heightIncrease = (fraction < 0.5) ? -3*(pseudorandom(((1-fraction)*x)*100)/11) : 3*(pseudorandom((fraction*x)*100)/11);
for(let x = 0; x <= width+2; x++){
//console.log(x);
let heightIncrease = (fraction < 0.5) ? -3*pseudorandom(((1-fraction)*(x+1))*(100*pseudorandom(x, 1241, 500)), 1) : 3*pseudorandom(((fraction)*(x+1))*(100*pseudorandom(x, 1241, 500)), 1);
let h = level + heightIncrease;
for(let y = 0; y <= h; y++){
//console.log(x,y);
let elementsArr = this.layers[this.yLevels.indexOf(level)];
let elem = elementsArr[Math.floor(((fraction < 0.5) ? elementsArr.length*pseudorandom(((1-fraction)*((x*y)*13))/11) : elementsArr.length*(pseudorandom((fraction*(x*y*17)))/11))%elementsArr.length)];
let placed = tryCreate(elem, x, height-y);
let elem = elementsArr[Math.floor(elementsArr.length*pseudorandom((1-fraction)*pseudorandom((x+15)*(y+5), 65343, 500), 2) % elementsArr.length)] || elementsArr[0];
//if(x == 0 || x == 1){console.log(elem);};
let placed = tryCreate(elem, x-2, height-y);
if(placed != null && this.temp != null){
placed.temp = this.temp;
}
@ -75,9 +75,9 @@ class biome {
generateOreVeins(seed, multi = 1){
for(let x = 0; x <= width; x++){
for(let y = 0; y <= height; y++){
let c = pseudorandom((seed/2**32)*x*y)/11;
let c = pseudorandom((seed/2**32)*pseudorandom(x*y, 657345, 600), 3);
if(c <= 0.3){
let c2 = pseudorandom((seed/2**32)*(x*y)*3)/11;
let c2 = pseudorandom((seed/2**32)*pseudorandom(x*y, 98755, 750), 4);
let ore;
for(let e in oreChances){
if(c2 <= oreChances[e]){
@ -96,11 +96,11 @@ class biome {
x2 += coords[0];
y2 += coords[1];
let p2 = getPixel(x2,y2);
if(p2 != null && eLists.STONEELEMS.includes(p2.element) && (pseudorandom((seed/2**32)*x2*y2)/11) < (0.35*multi)){
if(p2 != null && eLists.STONEELEMS.includes(p2.element) && (pseudorandom((seed/2**32)*pseudorandom(x2,y2, 350), x2*y2) < (0.35*multi))){
hasStone = true;
tryCreate(ore, x2, y2, true);
}
if((pseudorandom((seed/2**32)*(x2*y2)*8)/11) < 0.15){
if(pseudorandom((seed/2**32)*x2*y2, 6) < 0.15){
a = false;
break;
}
@ -118,9 +118,9 @@ class biome {
}
let biomes = {
plains: new biome([["rock", "rock", "rock", "gravel"], ["dirt", "dirt", "dirt", "dirt", "mud", "gravel"], ["grass","flower_seed","grass","grass","grass","grass","sapling","grass","grass","grass","grass","grass","grass","grass","grass"]], [25, 38, 40]),
desert: new biome([["rock", "rock", "rock", "gravel"], ["rock", "packed_sand","rock", "packed_sand", "sand"], ["sand"], [null, null, null, null, null, null, null, null, null, "cactus"]], [17, 26, 40, 42]),
savanna: new biome([["rock", "rock", "rock", "gravel"], ["dirt", "dirt", "clay_soil", "dirt", "dirt"], ["grass",null,null, null, null, null, "sapling",null,null,null,null]], [25, 38, 40], {lc: ["#6fde26", "#8eed34", "#8cdb42", "#7bd12a", "#96e81c", "#a9e64e", "#a0d94c", "#a9d63e"], wc: ["#bdab7e", "#b09c6a", "#ab996d", "#998a63", "#917959", "#877051"]}),
tundra: new biome([["rock", "rock", "rock", "gravel"], ["dirt", "dirt", "rock", "permafrost"], ["permafrost", "permafrost", "permafrost", "permafrost", "permafrost", "permafrost", "ice", "snow"], [null,null,null,null,null,"pinecone",null,null,null,null,null,null]], [25, 30, 38, 40], {temp: -15}),
desert: new biome([["rock", "rock", "rock", "gravel"], ["rock", "packed_sand","rock", "packed_sand", "sand"], ["sand"], [null, null, null, null, null, null, null, null, null, "cactus"]], [17, 26, 40, 42], {vMulti: 1.2}),
savanna: new biome([["rock", "rock", "rock", "gravel"], ["dirt", "dirt", "clay_soil", "dirt", "dirt"], ["grass",null,null, null, null, null, "sapling",null,null,null,null]], [25, 38, 40], {lc: ["#6fde26", "#8eed34", "#8cdb42", "#7bd12a", "#96e81c", "#a9e64e", "#a0d94c", "#a9d63e"], wc: ["#bdab7e", "#b09c6a", "#ab996d", "#998a63", "#917959", "#877051"], vMulti: 1.5}),
tundra: new biome([["rock", "rock", "rock", "gravel"], ["dirt", "dirt", "rock", "permafrost"], ["permafrost", "permafrost", "permafrost", "permafrost", "permafrost", "permafrost", "ice", "snow"], [null,null,null,null,null,"pinecone",null,null,null,null,null,null]], [25, 30, 38, 40], {temp: -15, vMulti: 2}),
}
let seed = Math.random()*(2**32);
enabledMods.forEach((item)=>{
@ -128,7 +128,7 @@ enabledMods.forEach((item)=>{
biomes.orchard = new biome([["rock","rock","rock","gravel"], ["dirt", "dirt", "dirt", "rock", "gravel"], ["dirt", "dirt", "dirt", "dirt", "mud", "clay_soil", "gravel"]], [25, 30, 38], {afterFunc: (seed)=>{
for(let i = 0; i < width; i++){
console.log(i, width);
let elem = ((pseudorandom((seed/2**32)*i)/11) < 0.15) ? plants.tree[(Math.round(Math.random()*plants.tree.length)) % plants.tree.length] : "grass";
let elem = (pseudorandom((seed/2**32)*pseudorandom(i, 6544, 500), 7) < 0.15) ? plants.tree[(Math.round(Math.random()*plants.tree.length)) % plants.tree.length] : "grass";
if(elem != undefined && elem != "grass"){elem += "_seed"};
elem = (elem == undefined) ? "apple_seed" : elem;
tryCreate(elem, i, 42);
@ -140,15 +140,34 @@ elements.PRNGgenerate = {
category: "tools",
onSelect: function(){
let arr = [];
Object.keys(biomes).forEach(function(b){arr.push(b);})
let txt = shiftDown;
Object.keys(biomes).forEach(function(b){arr.push(b);});
txt = (arr.length >= 7) ? true : txt;
promptInput("Leave blank to generate new seed. Your current seed is: " + seed, function(i){
seed = parseInt(i) || Math.random()*(2**32);
seed = (i != null && i.toLowerCase() == "c") ? seed : parseFloat(i) || Math.random()*(2**32);
seed = seed % (2**32);
if(!txt){
promptChoose("", arr, (choice)=>{
biomes[choice].generate(seed);
promptText("World generation complete.");
selectElement('dirt');
}, "Select a biome to generate: ");
} else {
let str = "";
for(let key in biomes){
str += `${key},`;
}
str = str.replace(/^,|,$/g, '');
promptInput("Enter the name of a biome (caps-insensetive) \nBiomes Available: " + str, function(inp){
if(!arr.includes(inp.toLowerCase())){
promptText("Invalid selection.");
}else {
biomes[inp.toLowerCase()].generate(seed);
promptText("World generation complete.");
selectElement('dirt');
}
}, "Enter Biome")
}
}, "Enter seed:");
}
}

43
mods/black_hole.js Normal file
View File

@ -0,0 +1,43 @@
elements.black_hole = {
color: "#000000",
tick: function(pixel) {
// Attract other pixels within a 9-pixel radius
for (let dx = -9; dx <= 9; dx++) {
for (let dy = -9; dy <= 9; dy++) {
let x = pixel.x + dx;
let y = pixel.y + dy;
// Ignore out-of-bounds
if (!isEmpty(x, y, true)) {
let other = pixelMap[x]?.[y];
if (other && other.element !== "black_hole") {
// Attraction: move other pixel towards the black hole
let stepX = Math.sign(pixel.x - other.x);
let stepY = Math.sign(pixel.y - other.y);
tryMove(other, other.x + stepX, other.y + stepY);
}
}
}
}
// Convert touching pixels into black holes
const dirs = [
[1, 0], [-1, 0], [0, 1], [0, -1],
[1, 1], [-1, -1], [1, -1], [-1, 1]
];
for (let d of dirs) {
let nx = pixel.x + d[0];
let ny = pixel.y + d[1];
if (isEmpty(nx, ny, true)) continue;
let touching = pixelMap[nx]?.[ny];
if (touching && touching.element !== "black_hole") {
changePixel(touching, "black_hole");
}
}
},
category: "special",
state: "solid",
density: 99999, // Very dense (optional)
hardness: 1, // Can't be destroyed easily
};

View File

@ -3231,7 +3231,7 @@ elements.element_line = {
}
}
if (pixel.dir === 1) {
if (!tryMove(pixel, pixel.x, pixel.y - 1, pixel.clone)) {
if (!tryMove(pixel, pixel.x, pixel.y + 1, pixel.clone)) {
changePixel(pixel, pixel.clone, true)
}
}
@ -3241,7 +3241,7 @@ elements.element_line = {
}
}
if (pixel.dir === 3) {
if (!tryMove(pixel, pixel.x, pixel.y + 1, pixel.clone)) {
if (!tryMove(pixel, pixel.x, pixel.y - 1, pixel.clone)) {
changePixel(pixel, pixel.clone, true)
}
}
@ -3326,3 +3326,4 @@ elements.replace_all_of_element = {
}

View File

@ -1,426 +0,0 @@
elements.beautiful_sun = {
color: "#c12600",
tick: function(pixel) {
// minimum 1726
// maximum 7726
if (pixel.eclipse) { pixel.color = pixelColorPick(pixel,"#f68656"); var c=0.01}
else if (pixel.temp < 1500) { pixel.color = pixelColorPick(pixel,"#7a4e43"); }
else if (pixel.temp < 3600) { pixel.color = pixelColorPick(pixel,"#ffbdbd"); var c=0.05 }
else if (pixel.temp < 7000) { pixel.color = pixelColorPick(pixel,"#c12600"); var c=0.1 }
else if (pixel.temp < 11000) { pixel.color = pixelColorPick(pixel,"#ffb09c"); var c=0.25 }
else if (pixel.temp < 28000) { pixel.color = pixelColorPick(pixel,"#f7fff5"); var c=0.5 }
else { pixel.color = pixelColorPick(pixel,"#c3bdff"); var c=0.4 }
if (pixel.temp < 1500) { var c=0 }
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() > c) {continue}
createPixel("beautiful_light", x, y);
pixelMap[x][y].color = pixel.color;
}
else if (!outOfBounds(x,y)) {
var newPixel = pixelMap[x][y];
if (elements[newPixel.element].id === elements.beautiful_sun.id) {
if (pixel.eclipse) { newPixel.eclipse = true }
if (pixel.temp!==newPixel.temp) {
var avg = (pixel.temp + newPixel.temp)/2;
pixel.temp = avg;
newPixel.temp = avg;
pixelTempCheck(pixel);
pixelTempCheck(newPixel);
}
}
else if (elements[newPixel.element].id === elements.sun.id) {
changePixel(newPixel, "beautiful_sun");
}
}
}
},
tool: function(pixel) {
if (pixel.element === "light") {
deletePixel(pixel.x,pixel.y);
}
if (pixel.element === "beautiful_light") {
deletePixel(pixel.x,pixel.y);
}
},
canPlace: true,
reactions: {
"hydrogen": { elem2:"helium", temp1:5 },
"helium": { elem2:"carbon_dioxide", temp1:5, tempMax:3600 },
"carbon_dioxide": { elem2:"neon", temp1:5, tempMax:1800 },
"sun": { elem2:"beautiful_sun", },
"light": { elem2:"beautiful_light" },
},
temp: 5504,
tempLow: -100,
stateLow: "supernova",
category: "brokenday",
state: "gas",
//density: 1408,
insulate: true,
noMix: true,
alias: "hateful_star",
movable: false
},
elements.beautiful_light = {
hidden: true,
name: "light",
color: "#c12600",
tick: function(pixel) {
if (Math.random() < 0.01) {
deletePixel(pixel.x,pixel.y);
return;
}
if (pixel.bx===undefined) {
// choose 1, 0, or -1
pixel.bx = Math.random() < 0.5 ? 1 : Math.random() < 0.5 ? 0 : -1;
pixel.by = Math.random() < 0.5 ? 1 : Math.random() < 0.5 ? 0 : -1;
// if both are 0, make one of them 1 or -1
if (pixel.bx===0 && pixel.by===0) {
if (Math.random() < 0.5) { pixel.bx = Math.random() < 0.5 ? 1 : -1; }
else { pixel.by = Math.random() < 0.5 ? 1 : -1; }
}
}
// move and invert direction if hit
if (pixel.bx && !tryMove(pixel, pixel.x+pixel.bx, pixel.y)) {
var newX = pixel.x + pixel.bx;
if (!isEmpty(newX, pixel.y, true)) {
var newPixel = pixelMap[pixel.x+pixel.bx][pixel.y];
if (!elements[newPixel.element].insulate) {
newPixel.temp += 1;
pixelTempCheck(newPixel);
}
if (!elements.light.reactions[newPixel.element]) {
pixel.color = newPixel.color;
}
else if (!elements.beautiful_light.reactions[newPixel.element]) {
pixel.color = newPixel.color;
}
}
pixel.bx = -pixel.bx;
}
if (pixel.by && !tryMove(pixel, pixel.x, pixel.y+pixel.by)) {
var newY = pixel.y + pixel.by;
if (!isEmpty(pixel.x, newY, true)) {
var newPixel = pixelMap[pixel.x][pixel.y+pixel.by];
if (!elements[newPixel.element].insulate) {
newPixel.temp += 0.05;
pixelTempCheck(newPixel);
}
if (!elements.light.reactions[newPixel.element]) {
pixel.color = newPixel.color;
}
else if (!elements.beautiful_light.reactions[newPixel.element]) {
pixel.color = newPixel.color;
}
}
pixel.by = -pixel.by;
}
},
reactions: {
"glass": { "color1":["#ff0000","#ff8800","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff"] },
"glass_shard": { "color1":["#ff0000","#ff8800","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff"] },
"rad_glass": { "color1":["#9f6060","#9f8260","#9f9f60","#609f60","#609f9f","#60609f","#9f609f"] },
"rad_shard": { "color1":["#9f6060","#9f8260","#9f9f60","#609f60","#609f9f","#60609f","#9f609f"] },
"steam": { "color1":["#ff0000","#ff8800","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff"] },
"rain_cloud": { "color1":["#ff0000","#ff8800","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff"] },
"cloud": { "color1":["#ff0000","#ff8800","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff"] },
"smog": { "color1":["#9f6060","#9f8260","#9f9f60","#609f60","#609f9f","#60609f","#9f609f"] },
"ice": { "color1":"#c2fff9" },
"rime": { "color1":"#c2fff9" },
"water": { "color1":"#a1bac9" },
"salt_water": { "color1":"#a1bac9" },
"sugar_water": { "color1":"#a1bac9" },
"dirty_water": { "color1":"#a1c9a8" },
"seltzer": { "color1":"#c2fff9" },
"diamond": { "color1":["#c2c5ff","#c2d9ff"] },
"rainbow": { "color1":["#ff0000","#ff8800","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff"] },
"static": { "color1":["#ffffff","#bdbdbd","#808080","#424242","#1c1c1c"] },
"sun": { elem2:"beautiful_sun", },
"light": { elem2:"beautiful_light" },
"meat": { elem2:"fused_organism" },
"head": { elem2:"melted_human" },
"body": { elem2:"melted_human" },
"dead_bug": { elem2:"melted_insect" },
"worm": { elem2:"melted_insect" },
"ant": { color2:"#5E0B04", elem2:"melted_insect" },
"bee": { elem2:"melted_insect" },
"fly": { elem2:"melted_insect" },
"firefly": { elem2:"melted_insect" },
"stinkbug": { elem2:"melted_insect" },
"slug": { color2:["#997e12","#997e12","#997e12","#997e12","#997e12","#997e12","#403314","#403314","#403314","#403314","#403314","#403314","#124a44"], elem2:"melted_insect" },
"snail": { color2:"#5c3104", elem2:"melted_insect", chance:0.5 },
"tree_branch": { elem2:"wood" },
"plant": { elem2:"melted_plant" },
"grass": { elem2:"melted_plant" },
"evergreen": { color2:"#006300", elem2:"melted_plant" },
"pistil": { elem2:"melted_plant" },
"petal": { color2:["#ff0000","#ff8800","#ffff00","#88ff00","#00ff00","#00ff88","#00ffff","#0088ff","#0000ff","#8800ff","#ff00ff"], elem2:"melted_plant" },
"bamboo": { elem2:"melted_plant" },
"bamboo_plant": { elem2:"melted_plant" },
"cactus": { elem2:"melted_plant" },
"corn": { color2:["#f8d223","#d6ba2a","#f7f5ba","#dbd281","#cdb12d"], elem2:"melted_plant" },
"wheat": { color2:["#f1b569","#edb864","#de9c45","#c2853d"], elem2:"melted_plant" },
"dead_plant": { elem2:"melted_plant" },
"sapling": { elem2:"melted_plant" },
"pinecone": { color2:["#5c3e33","#472f27","#31211b"], elem2:"melted_plant" },
"bird": { color2:"#997457", elem2:"melted_animal" },
"rat": { color2:["#a698a9","#8c7d82","#ccc3cf"], elem2:"melted_animal" },
"fish": { elem2:"melted_fish", chance:0.2 },
"tadpole": { color2:"#87b574", elem2:"melted_fish", chance:0.2 },
"frog": { color2:"#607300", elem2:"melted_fish", chance:0.2 },
},
temp: 35,
tempLow: -273,
stateLow: ["liquid_light",null],
stateLowColorMultiplier: 0.8,
category: "brokenday",
state: "gas",
density: 0.00001,
ignoreAir: true,
insulate: true
},
elements.melted_human = {
color: ["#f3e7db","#eadaba","#d7bd96","#a07e56"],
behavior: behaviors.LIQUID,
viscosity: 7500,
reactions: {
"oxygen": { elem2:"carbon_dioxide", chance:0.5 },
"meat": { elem2:null, chance:0.1 },
"cooked_meat": { elem2:null, chance:0.1 },
"sun": { elem2:"beautiful_sun", elem1:"cooked_meat" },
"light": { elem2:"beautiful_light" },
"dead_bug": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.1 },
"ant": { color2:"#D2B6AB", elem2:"fused_organism", chance:0.2 },
"bee": { color2:"#E9DBAA", elem2:"fused_organism", chance:0.2 },
"fly": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"firefly": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"stinkbug": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"slug": { color2:["#DFD0AE","#E5D6C7"], elem2:"fused_organism", chance:0.2 },
"snail": { color2:"#E5D6C7", elem2:"fused_organism", chance:0.15 },
"head": { elem2:"melted_human", chance:0.1 },
"body": { elem2:"melted_human", chance:0.1 },
"bird": { color2:"#DAC8B7", elem2:"fused_organism", chance:0.1 },
"rat": { color2:["#E2D5D0","#EADFD8"], elem2:"fused_organism", chance:0.1 },
"fish": { color2:"#E3D1BC", elem2:"fused_organism", chance:0.2 },
"tadpole": { color2:"#DBDCC4", elem2:"fused_organism", chance:0.2 },
"frog": { color2:"#D2CDAA", elem2:"fused_organism", chance:0.2 },
"melted_fish": { color2:"#E3D1BC",elem2:"fused_organism", chance:0.1 },
"melted_animal": { color2:["#E2D5D0","#EADFD8","#DAC8B7"], elem2:"fused_organism", chance:0.1 },
"melted_insect": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.1 },
},
tempHigh: 300,
stateHigh: "cooked_meat",
tempLow: -20,
stateLow: "frozen_meat",
burn: 10,
burnTime: 300,
burnInto: "cooked_meat",
state: "liquid",
density: 1900,
category: "brokenday",
},
elements.melted_animal = {
color: ["#997457","#a698a9"],
behavior: behaviors.LIQUID,
viscosity: 7500,
reactions: {
"oxygen": { elem2:"carbon_dioxide", chance:0.5 },
"meat": { elem2:"fused_organism", chance:0.1 },
"sun": { elem2:"beautiful_sun", elem1:"cooked_meat" },
"light": { elem2:"beautiful_light" },
"dead_bug": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.1 },
"ant": { color2:"#D2B6AB", elem2:"fused_organism", chance:0.2 },
"bee": { color2:"#E9DBAA", elem2:"fused_organism", chance:0.2 },
"fly": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"firefly": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"stinkbug": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"slug": { color2:["#DFD0AE","#E5D6C7"], elem2:"fused_organism", chance:0.2 },
"snail": { color2:"#E5D6C7", elem2:"fused_organism", chance:0.15 },
"head": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"body": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"bird": { color2:"#997457", elem2:"melted_animal", chance:0.2 },
"rat": { color2:["#a698a9","#8c7d82","#ccc3cf"], elem2:"melted_animal", chance:0.2 },
"fish": { color2:"#E3D1BC", elem2:"fused_organism", chance:0.2 },
"tadpole": { color2:"#DBDCC4", elem2:"fused_organism", chance:0.2 },
"frog": { color2:"#D2CDAA", elem2:"fused_organism", chance:0.2 },
"melted_fish": { color2:"#E3D1BC",elem2:"fused_organism", chance:0.1 },
"melted_human": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"melted_insect": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.1 },
},
tempHigh: 275,
stateHigh: "cooked_meat",
tempLow: -20,
stateLow: "frozen_meat",
burn: 10,
burnTime: 300,
burnInto: "cooked_meat",
state: "liquid",
density: 900,
category: "brokenday",
},
elements.melted_fish = {
color: "#ac8650",
behavior: [
"XX|XX|SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%5",
"M2%0.5|FX%0.5|M2%0.5 AND BO",
"M2%10|M1|M2%10 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water,primordial_soup%14",
],
reactions: {
"oxygen": { elem2:"carbon_dioxide", chance:0.5 },
"sun": { elem2:"beautiful_sun", elem1:"cooked_meat" },
"light": { elem2:"beautiful_light" },
"dead_bug": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.1 },
"ant": { color2:"#D2B6AB", elem2:"fused_organism", chance:0.2 },
"bee": { color2:"#E9DBAA", elem2:"fused_organism", chance:0.2 },
"fly": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"firefly": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"stinkbug": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"head": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"body": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"bird": { color2:"#DAC8B7", elem2:"fused_organism", chance:0.2 },
"rat": { color2:["#E2D5D0","#EADFD8"], elem2:"fused_organism", chance:0.2 },
"slug": { color2:["#DFD0AE","#E5D6C7"], elem2:"fused_organism", chance:0.2 },
"snail": { color2:"#E5D6C7", elem2:"fused_organism", chance:0.15 },
"fish": { elem2:"melted_fish", chance:0.2 },
"tadpole": { color2:"#87b574", elem2:"melted_fish", chance:0.2 },
"frog": { color2:"#607300", elem2:"melted_fish", chance:0.2 },
"melted_animal": { color2:["#E2D5D0","#EADFD8","#DAC8B7"], elem2:"fused_organism", chance:0.1 },
"melted_human": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"melted_insect": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.1 },
},
tempHigh: 275,
stateHigh: "cooked_meat",
tempLow: -20,
stateLow: "frozen_meat",
burn: 10,
burnTime: 300,
burnInto: "cooked_meat",
state: "liquid",
density: 800,
category: "brokenday",
},
elements.melted_insect = {
color: ["#4c4e42","#5e0b04","#4c4e42","#5e0b04","#56482d","#52472c","#635443"],
behavior: behaviors.LIQUID,
viscosity: 4500,
reactions: {
"meat": { elem2:"fused_organism", chance:0.1 },
"cooked_meat": { elem2:"fused_organism", chance:0.1 },
"sun": { elem2:"beautiful_sun", elem1:"cooked_meat" },
"light": { elem2:"beautiful_light" },
"dead_bug": { elem2:"melted_insect", chance:0.1 },
"ant": { color2:"#5E0B04", elem2:"melted_insect", chance:0.2 },
"bee": { color2:"#c4b100", elem2:"melted_insect", chance:0.2 },
"fly": { elem2:"melted_insect", chance:0.2 },
"firefly": { elem2:"melted_insect", chance:0.2 },
"stinkbug": { elem2:"melted_insect", chance:0.2 },
"slug": { color2:["#997e12","#997e12","#997e12","#997e12","#997e12","#997e12","#403314","#403314","#403314","#403314","#403314","#403314","#124a44"], elem2:"melted_insect", chance:0.2 },
"snail": { color2:"#5c3104", elem2:"melted_insect", chance:0.15 },
"fish": { color2:"#E3D1BC", elem2:"fused_organism", chance:0.2 },
"tadpole": { color2:"#DBDCC4", elem2:"fused_organism", chance:0.2 },
"frog": { color2:"#D2CDAA", elem2:"fused_organism", chance:0.2 },
"head": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"body": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"melted_human": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"bird": { color2:"#DAC8B7", elem2:"fused_organism", chance:0.1 },
"rat": { color2:["#E2D5D0","#EADFD8"], elem2:"fused_organism", chance:0.1 },
"melted_animal": { color2:["#E2D5D0","#EADFD8","#DAC8B7"], elem2:"fused_organism", chance:0.1 },
"melted_fish": { color2:"#E3D1BC",elem2:"fused_organism", chance:0.1 },
},
tempHigh: 100,
stateHigh: "dead_bug",
tempLow: -20,
stateLow: "dead_bug",
burn: 10,
burnTime: 150,
burnInto: "ash",
state: "liquid",
density: 500,
category: "brokenday",
},
elements.melted_plant = {
color: ["#00bf00","#439809","#258b08","#118511","#127b12","#136d14"],
behavior: behaviors.LIQUID,
viscosity: 50000,
reactions: {
"sun": { elem2:"beautiful_sun", elem1:"dead_plant" },
"light": { elem2:"beautiful_light" },
"carbon_dioxide": { elem2:"oxygen" },
"tree_branch": { elem2:"wood" },
"plant": { elem2:"melted_plant", chance:0.2 },
"grass": { elem2:"melted_plant", chance:0.2 },
"evergreen": { color2:"#006300", elem2:"melted_plant", chance:0.2 },
"pistil": { elem2:"melted_plant", chance:0.2 },
"petal": { color2:["#CC9978","#CD8C6F","#BE785E","#CC9978","#CD8C6F","#BE785E","#A9D475","#5AF353","#8E5FA5"], elem2:"melted_plant", chance:0.1 },
"bamboo": { elem2:"melted_plant", chance:0.1 },
"bamboo_plant": { elem2:"melted_plant", chance:0.1 },
"cactus": { elem2:"melted_plant", chance:0.1 },
"corn": { color2:["#f8d223","#d6ba2a","#f7f5ba","#dbd281","#cdb12d"], elem2:"melted_plant", chance:0.1 },
"wheat": { color2:["#f1b569","#edb864","#de9c45","#c2853d"], elem2:"melted_plant", chance:0.1 },
"dead_plant": { elem2:"melted_plant", chance:0.1 },
"sapling": { elem2:"melted_plant", chance:0.05 },
"pinecone": { color2:["#5c3e33","#472f27","#31211b"], elem2:"melted_plant", chance:0.05 },
},
tempHigh: 250,
stateHigh: "dead_plant",
tempLow: -20,
stateLow: "frozen_plant",
burn: 10,
burnTime: 200,
burnInto: ["dead_plant","fire","fire","fire","ash"],
state: "liquid",
density: 1200,
category: "brokenday",
};
elements.fused_organism = {
color: ["#E5D6C7","#f7ead0"],
behavior: behaviors.LIQUID,
viscosity: 6000,
reactions: {
"meat": { elem2:"fused_organism", chance:0.1 },
"cooked_meat": { elem2:"fused_organism", chance:0.1 },
"sun": { elem2:"beautiful_sun", elem1:"cooked_meat" },
"light": { elem2:"beautiful_light" },
"dead_bug": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.1 },
"ant": { color2:"#D2B6AB", elem2:"fused_organism", chance:0.2 },
"bee": { color2:"#E9DBAA", elem2:"fused_organism", chance:0.2 },
"fly": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"firefly": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"stinkbug": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.2 },
"slug": { color2:["#DFD0AE","#E5D6C7"], elem2:"fused_organism", chance:0.2 },
"snail": { color2:"#E5D6C7", elem2:"fused_organism", chance:0.15 },
"head": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"body": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"melted_human": { color2:["#F1E4D4","#EDDECC"], elem2:"fused_organism", chance:0.1 },
"melted_insect": { color2:"#CEC5B9", elem2:"fused_organism", chance:0.1 },
"bird": { color2:"#DAC8B7", elem2:"fused_organism", chance:0.1 },
"rat": { color2:["#E2D5D0","#EADFD8"], elem2:"fused_organism", chance:0.1 },
"fish": { color2:"#E3D1BC", elem2:"fused_organism", chance:0.2 },
"tadpole": { color2:"#DBDCC4", elem2:"fused_organism", chance:0.2 },
"frog": { color2:"#D2CDAA", elem2:"fused_organism", chance:0.2 },
"melted_animal": { color2:["#E2D5D0","#EADFD8","#DAC8B7"], elem2:"fused_organism", chance:0.1 },
"melted_fish": { color2:"#E3D1BC", elem2:"fused_organism", chance:0.1 },
},
tempHigh: 300,
stateHigh: "cooked_meat",
tempLow: -20,
stateLow: "frozen_meat",
burn: 10,
burnTime: 400,
burnInto: "cooked_meat",
state: "liquid",
density: 2000,
category: "brokenday",
};
HighNumber = "36 41 20 36 46 20 36 41 20 36 46 20 32 30 20 33 44 20 32 30 20 36 37 20 36 31 20 37 39"

View File

@ -1,4 +1,4 @@
if (enabledMods.includes("mods/betterMenuScreens.js")) {
dependOn("betterMenuScreens.js", () => {
const properties = {
meta: [
{name: "name", type: "string", viewOnly: true, required: true},
@ -1209,8 +1209,4 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) {
}
runAfterLoadList.push(cssInject, loadChanges);
} else {
enabledMods.unshift("mods/betterMenuScreens.js");
localStorage.setItem("enabledMods", JSON.stringify(enabledMods));
window.location.reload();
}
}, true);

View File

@ -1,5 +1,5 @@
/*
*Version 2.2.1
*Version 2.2.2
*/
dependOn("orchidslibrary.js", ()=>{
@ -683,23 +683,38 @@ dependOn("orchidslibrary.js", ()=>{
for(let coords of adjacentCoords){
let x = pixel.x+coords[0], y = pixel.y+coords[1];
let p2 = getPixel(x,y);
let ignore = false;
for(let item of elements[pixel.element].ignore){
//let ignore = false;
/*for(let item of elements[pixel.element].ignore){
if(p2 != null && item.startsWith("*")&&p2.element.endsWith(item.split("*")[1])){
ignore = true;
} else if (p2 != null && item.endsWith("*")&&p2.element.startsWith(item.split("*")[0])){
ignore = true;
} else if(p2 != null){
ignore = (elements[pixel.element].ignore.includes(p2.element)) ? true : ignore;
}
}*/
if(p2 != null){
let ignore = elements[pixel.element].ignore.some(item=>{
let res = false;
if(p2.element === item){
res = true;
} else if(item.startsWith("*") && p2.element.endsWith(item.slice(1))) {
res = true;
} else if(item.endsWith("*") && p2.element.startsWith(item.slice(0,-1))){
res = true;
}
if(p2 != null && !(elements[pixel.element].ignore.includes(p2.element) || ignore || p2.element == pixel.element)){
return res;
});
if(!ignore){
deletePixel(x,y);
deletePixel(pixel.x, pixel.y);
}
}
}
}
elements.acid.behavior = behaviors.LIQUID;
elements.acid.tick = acidTick;
elements.acid.ignore = elements.acid.ignore.concat(["nitric_acid", "aqua_regia", "nitrogen_dioxide", "nitric_acid_ice", "nitrogen_dioxide_ice", "acid", "chloroauric_acid", "*chloride", "*carbonate", "*acetate", "*sulfate", "*gallium", "*hydroxide", "salt", "*aluminum", "target_portal_in", "*magnesium", "*copper", "*iron", "*calcium", "sulfuric_acid", "*vinegar", "*gypsum", "*wall", "epsom_salt", "*platinum", "chloroplatinic_acid", "*sulfur*"]);
elements.acid.ignore = elements.acid.ignore.concat(["nitric_acid", "aqua_regia", "nitrogen_dioxide", "nitric_acid_ice", "nitrogen_dioxide_ice", "acid", "chloroauric_acid", "*chloride", "*carbonate", "*acetate", "*sulfate", "*gallium", "*hydroxide", "salt", "*aluminum", "target_portal_in", "*magnesium", "*copper*", "*iron", "*calcium", "sulfuric_acid", "*vinegar", "*gypsum", "*wall", "epsom_salt", "platinum", "chloroplatinic_acid", "*sulfur*", "wall", "porcelain", "plastic", "glass", "*sulfate", "*nitrate"]);
elements.nitric_acid = {
alias: "HNO₃",
behavior: behaviors.LIQUID,
@ -710,6 +725,12 @@ dependOn("orchidslibrary.js", ()=>{
stateLow: "nitric_acid_ice",
reactions: {
acid: {elem1: null, elem2: "aqua_regia"},
copper: {elem1: "hydrogen", elem2: "copper_nitrate"},
sodium: {elem1: "hydrogen", elem2: "sodium_nitrate"},
aluminum: {elem1: "hydrogen", elem2: "aluminum_nitrate"},
potassium: {elem1: "hydrogen", elem2: "potassium_nitrate"},
calcium: {elem1: "hydrogen", elem2: "calcium_nitrate"},
magnesium: {elem1: "hydrogen", elem2: "magnesium_nitrate"},
},
density: 1510,
category: "liquids",
@ -873,6 +894,8 @@ dependOn("orchidslibrary.js", ()=>{
density: 2960,
reactions: {
acid: {elem1: "magnesium_chloride", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
sulfuric_acid: {elem1: "epsom_salt", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
nitric_acid: {elem1: "magnesium_nitrate", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
vinegar: {elem1: "magnesium_acetate", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]}
}
}
@ -1140,11 +1163,11 @@ dependOn("orchidslibrary.js", ()=>{
alias: "CuCl₂",
solubility: {water: 0.743},
reactions: {
sodium: {elem1: "copper", elem2: "sodium_acetate"},
potassium: {elem1: "copper", elem2: "potassium_acetate"},
magnesium: {elem1: "copper", elem2: "magnesium_acetate"},
calcium: {elem1: "copper", elem2: "calcium_acetate"},
aluminum: {elem1: "copper", elem2: "aluminum_acetate"},
sodium: {elem1: "copper", elem2: "salt"},
potassium: {elem1: "copper", elem2: "potassium_salt"},
magnesium: {elem1: "copper", elem2: "magnesium_chloride"},
calcium: {elem1: "copper", elem2: "calcium_chloride"},
aluminum: {elem1: "copper", elem2: "aluminum_chloride"},
wood: {stain2: "#043023"},
},
properties: {
@ -1554,4 +1577,188 @@ dependOn("orchidslibrary.js", ()=>{
stateLow: "bismuth",
temp: 270,
};
elements.copper_nitrate = {
density: 3050,
tempHigh: 145,
stateHigh: ["oxidized_copper", "nitrogen_dioxide", "nitrogen_dioxide"],
color: ["#1717ff", "#2121ff", "#1b1bf5", "#0f0ff2", "#0707f7"],
behavior: behaviors.POWDER,
state: "solid",
category: "salts",
alias: "Cu(NO₃)₂",
solubility: {water: 1.25},
reactions: {
sodium: {elem1: "copper", elem2: "sodium_nitrate"},
potassium: {elem1: "copper", elem2: "potassium_nitrate"},
calcium: {elem1: "copper", elem2: "calcium_nitrate"},
aluminum: {elem1: "copper", elem2: "aluminum_nitrate"},
wood: {stain2: "#043023"},
ash: {elem1: "copper_carbonate", elem2: "potassium_nitrate"},
baking_soda: {elem1: "copper_carbonate", elem2: "sodium_nitrate"},
acid: {elem1: "copper_chloride", elem2: "nitric_acid"},
sulfuric_acid: {elem1: "copper_sulfate", elem2: "nitric_acid"},
},
properties: {
anhydrous: false
},
fireColor: "#19abff",
tick: function(pixel){
if(pixelTicks-pixel.start == 2 && xDown){
pixel.anhydrous = true;
let rgb = {r: 51, g: 158, b: 61};
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: 51, g: 158, b: 61};
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: 7, g: 7, b: 247} : {r: 26, g: 26, b: 240};
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: 7, g: 7, b: 247} : {r: 26, g: 26, b: 240};
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})`;
}
}
}
};
elements.sodium_nitrate = {
color: ["#f5f5f5", "#e8e8e8", "#ededed", "#e3e3e3"],
density: 2260,
category: "salts",
tempHigh: 650,
stateHigh: ["sodium", "nitrogen_dioxide"],
reactions: {
ash: {elem1: "baking_soda", elem2: "potassium_nitrate"},
potassium: {elem1: "sodium", elem2: "potassium_nitrate"},
//sulfuric_acid: {elem1: "sodium_sulfate", elem2: "nitric_acid"},
acid: {elem1: "salt", elem2: "nitric_acid"},
},
solubility: {water: 0.86},
alias: "NaNO₃",
behavior: behaviors.POWDER
};
elements.potassium_nitrate = {
color: ["#f5f5f5", "#e8e8e8", "#ededed", "#e3e3e3"],
density: 2106,
category: "salts",
tempHigh: 800,
stateHigh: ["potassium", "nitrogen_dioxide"],
reactions: {
//sulfuric_acid: {elem1: "potassium_sulfate", elem2: "nitric_acid"},
acid: {elem1: "potassium_salt", elem2: "nitric_acid"},
},
solubility: {water: 0.316},
alias: "KNO₃",
behavior: behaviors.POWDER
};
elements.magnesium_nitrate = {
color: ["#f5f5f5", "#e8e8e8", "#ededed", "#e3e3e3"],
density: 2300,
category: "salts",
tempHigh: 290,
stateHigh: ["magnesium", "nitrogen_dioxide"],
reactions: {
potassium: {elem1: "magnesium", elem2: "potassium_nitrate"},
sodium: {elem1: "magnesium", elem2: "sodium_nitrate"},
sulfuric_acid: {elem1: "epsom_salt", elem2: "nitric_acid"},
acid: {elem1: "magnesium_chloride", elem2: "nitric_acid"},
},
solubility: {water: 0.42},
alias: "Mg(NO₃)₂",
behavior: behaviors.POWDER
};
elements.calcium_nitrate = {
color: ["#f5f5f5", "#e8e8e8", "#ededed", "#e3e3e3"],
density: 2504,
category: "salts",
tempHigh: 650,
stateHigh: ["calcium", "nitrogen_dioxide"],
reactions: {
potassium: {elem1: "calcium", elem2: "potassium_nitrate"},
sodium: {elem1: "calcium", elem2: "sodium_nitrate"},
magnesium: {elem1: "calcium", elem2: "magnesium_nitrate"},
sulfuric_acid: {elem1: "gypsum", elem2: "nitric_acid"},
acid: {elem1: "calcium_chloride", elem2: "nitric_acid"},
},
solubility: {water: 1.21},
alias: "Ca(NO₃)₂",
behavior: behaviors.POWDER
};
elements.aluminum_nitrate = {
color: ["#f5f5f5", "#e8e8e8", "#ededed", "#e3e3e3"],
density: 1720,
category: "salts",
tempHigh: 150,
stateHigh: ["aluminum", "nitrogen_dioxide"],
reactions: {
sodium: {elem1: "aluminum", elem2: "sodium_nitrate"},
potassium: {elem1: "aluminum", elem2: "potassium_nitrate"},
calcium: {elem1: "aluminum", elem2: "calcium_nitrate"},
magnesium: {elem1: "aluminum", elem2: "magnesium_nitrate"},
//sulfuric_acid: {elem1: "aluminum_sulfate", elem2: "nitric_acid"},
acid: {elem1: "aluminum_chloride", elem2: "nitric_acid"},
},
solubility: {water: 0.739},
alias: "Al(NO₃)₃",
behavior: behaviors.POWDER
};
elements.limestone.reactions.sulfuric_acid = {elem1: "gypsum", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]};
elements.slaked_lime.reactions.sulfuric_acid = {elem1: "gypsum", elem2: "water"};
elements.quicklime.reactions.sulfuric_acid = {elem1: "gypsum", elem2: "oxygen"};
elements.limestone.reactions.nitric_acid = {elem1: "calcium_nitrate", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]};
elements.slaked_lime.reactions.nitric_acid = {elem1: "calcium_nitrate", elem2: "water"};
elements.quicklime.reactions.nitric_acid = {elem1: "calcium_nitrate", elem2: "oxygen"};
elements.copper_carbonate = {
color: ["#5ee092", "#54d186", "#52de8a", "#44c97a"],
category: "salts",
alias: "CuCO₃",
behavior: behaviors.POWDER,
reactions: {
vinegar: {elem1: "copper_acetate", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
acid: {elem1: "copper_chloride", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
sulfuric_acid: {elem1: "copper_sulfate", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
nitric_acid: {elem1: "copper_nitrate", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
aqua_regia: {elem1: ["copper_nitrate", "copper_chloride"], elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
},
density: 4000,
tempHigh: 290,
stateHigh: ["oxidized_copper", "carbon_dioxide"],
};
elements.aqua_regia.solubility = {water: 1};
elements.acid.solubility = {water: 1};
elements.vinegar.solubility = {water: 1};
elements.nitric_acid.solubility = {water: 1};
elements.sulfuric_acid.solubility = {water: 1};
}, true);

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* Version 1.0.0
* Version 1.1.0
*/
dependOn("orchidslibrary.js", ()=>{
@ -46,9 +46,9 @@ dependOn("orchidslibrary.js", ()=>{
}
function aqueousReaction(p1, p2){
for(let elem in p1.elemsDissolved){
if(elements[elem].reactions != null && p2.element != "water" && elements[elem].reactions[p2.element] != undefined){
if(elements[elem].reactions != null && p2.element != "water" && (elements[elem].reactions[p2.element] != undefined || (elements[p2.element].reactions != null && elements[p2.element].reactions[elem] != undefined))){
let r = elements[elem].reactions[p2.element];
let r = elements[elem].reactions[p2.element] || elements[p2.element].reactions[elem];
if(r.tempMin && !((p1.temp >= r.tempMin) && (p2.temp >= r.tempMin))){
return false;
}
@ -253,13 +253,13 @@ dependOn("orchidslibrary.js", ()=>{
let num = Math.random();
if(elem === null){
for(let e in pixel.elemsDissolved){
if(num <= ((pixel.elemsDissolved[e]/100)/elements[e].solubility.water)){
if(num <= ((pixel.elemsDissolved[e]/100)/elements[e].solubility.water)/4){
elem = e;
}
}
}
elem = (elem == null) ? "steam" : elem;
changePixel(pixel, elem);
changePixel(pixel, elem, 110);
pixel.dissolvedElems = {};
}
}
@ -282,5 +282,6 @@ dependOn("orchidslibrary.js", ()=>{
elements.water.tick = solventTick;
elements.water.behavior = behaviors.SOLVENT;
elements.water.tempHigh = undefined;
elements.water.solventTempHigh = 100;
elements.water.solventTempHigh = 101;
elements.steam.tempLow = 99
}, true);

51
mods/war.js Normal file
View File

@ -0,0 +1,51 @@
elements.land = {
color: "#096600",
category: "war",
behavior: behaviors.WALL,
};
elements.red = {
name: "redville",
color: "#880000",
category: "war",
behavior: [
"XX|CH:land>red%50 AND CH:blu>land%25 AND CH:kerdly>suselle%5|XX",
"CH:land>red%50 AND CH:blu>land%25 AND CH:kerdly>suselle%5|XX|CH:land>red%50 AND CH:blu>land%25 AND CH:kerdly>suselle%5",
"XX|CH:land>red%50 AND CH:blu>land%25 AND CH:kerdly>suselle%5|XX",
],
};
elements.blu = {
name: "blue city",
color: "#000088",
category: "war",
behavior: [
"XX|CH:land>blu%50 AND CH:red>land%25 AND CH:kerdly>kralsei%5|XX",
"CH:land>blu%50 AND CH:red>land%25 AND CH:kerdly>kralsei%5|XX|CH:land>blu%50 AND CH:red>land%25 AND CH:kerdly>kralsei%5",
"XX|CH:land>blu%50 AND CH:red>land%25 AND CH:kerdly>kralsei%5|XX",
],
};
elements.kerdly = {
name: "water",
category: "war",
color: "#5599ff",
behavior: behaviors.WALL,
};
elements.suselle = {
name: "redville water",
category: "war",
color: "#7777dd",
behavior: [
"XX|CH:land>red%50 AND CH:blu>land%25 AND CH:kerdly>suselle%5 AND CH:kralsei>suselle%1|XX",
"CH:land>red%50 AND CH:blu>land%25 AND CH:kerdly>suselle%5 AND CH:kralsei>suselle%1|XX|CH:land>red%50 AND CH:blu>land%25 AND CH:kerdly>suselle%5 AND CH:kralsei>suselle%1",
"XX|CH:land>red%50 AND CH:blu>land%25 AND CH:kerdly>suselle%5 AND CH:kralsei>suselle%1|XX",
],
};
elements.kralsei = {
name: "blue city water",
category: "war",
color: "#3377ff",
behavior: [
"XX|CH:land>blu%50 AND CH:red>land%25 AND CH:kerdly>kralsei%5 AND CH:suselle>kralsei%1|XX",
"CH:land>blu%50 AND CH:red>land%25 AND CH:kerdly>kralsei%5 AND CH:suselle>kralsei%1|XX|CH:land>blu%50 AND CH:red>land%25 AND CH:kerdly>kralsei%5 AND CH:suselle>kralsei%1",
"XX|CH:land>blu%50 AND CH:red>land%25 AND CH:kerdly>kralsei%5 AND CH:suselle>kralsei%1|XX",
],
};

148
mods/zoom.js Normal file
View File

@ -0,0 +1,148 @@
// IIFE because paranoid
(() => {
const zoom_levels = [
0.5,
1,
2,
3,
6,
12
]
window.zoom_level = 1
window.zoom_panning = [0,0]
function handle_zoom(direction){
switch (direction){
case "in":
if (!(zoom_level+1 in zoom_levels)) { break; }
window.zoom_level += 1
break;
case "out":
if (!(zoom_level-1 in zoom_levels)) { break; }
window.zoom_level -= 1
break;
}
rescale()
}
function handle_pan(direction, speed){
switch (direction){
case "right":
zoom_panning[0] -= speed
break;
case "left":
zoom_panning[0] += speed
break;
case "up":
zoom_panning[1] += speed
break;
case "down":
zoom_panning[1] -= speed
break;
}
rescale()
}
function rescale(){
log_info()
const scale = zoom_levels[zoom_level]
const x = zoom_panning[0] * (pixelSize * scale)
const y = zoom_panning[1] * (pixelSize * scale)
gameCanvas.style.transform = `translate(${x}px,${y}px) scale(${scale})`
}
function log_info(){
// Values are negated to make them more intuitive
const x_pan = (-zoom_panning[0]).toString().padEnd(4)
const y_pan = (-zoom_panning[1]).toString().padEnd(4)
zoom_data_div.innerText = ""
zoom_data_div.innerText += `Scale: ${zoom_levels[zoom_level]}x\n`
zoom_data_div.innerText += `Pan : ${x_pan}, ${y_pan}`
}
function patch_keybinds(){
// Be more granular at higher zoom levels
const speed_a = () => zoom_level > 3 ? 5 : 10
const speed_b = () => zoom_level > 3 ? 10 : 20
keybinds["9"] = () => handle_zoom("in")
keybinds["0"] = () => handle_zoom("out")
keybinds["w"] = () => handle_pan("up", speed_a())
keybinds["a"] = () => handle_pan("left", speed_a())
keybinds["s"] = () => handle_pan("down", speed_a())
keybinds["d"] = () => handle_pan("right", speed_a())
keybinds["W"] = () => handle_pan("up", speed_b())
keybinds["A"] = () => handle_pan("left", speed_b())
keybinds["S"] = () => handle_pan("down", speed_b())
keybinds["D"] = () => handle_pan("right", speed_b())
}
function patch_ui(){
const zoom_data_div = document.createElement("div")
document.getElementById("logDiv").appendChild(zoom_data_div)
const controls_table = document.getElementById("controlsTable").lastElementChild
controls_table.insertAdjacentHTML("beforeBegin",`
<tr>
<td>Zoom in/out</td>
<td>
<kbd>9</kbd>/
<kbd>0</kbd>
</td>
</tr>
<tr>
<td>Pan</td>
<td>
<kbd>W</kbd>
<kbd>A</kbd>
<kbd>S</kbd>
<kbd>D</kbd>
</td>
</tr>
<tr>
<td>Pan (fast)</td>
<td>
<kbd>Shift</kxbd> +
<kbd>W</kbd>
<kbd>A</kbd>
<kbd>S</kbd>
<kbd>D</kbd>
</td>
</tr>
`)
}
// Redefine to give correct numbers when zoomed
window.getMousePos = (canvas, evt) => {
if (evt.touches) {
evt.preventDefault();
evt = evt.touches[0];
isMobile = true;
}
const rect = canvas.getBoundingClientRect();
let x = (evt.clientX - rect.left) / zoom_levels[zoom_level];
let y = (evt.clientY - rect.top) / zoom_levels[zoom_level];
x = Math.floor((x / canvas.clientWidth) * (width+1));
y = Math.floor((y / canvas.clientHeight) * (height+1));
return {x:x, y:y};
}
runAfterReset(() => {
window.zoom_level = 1
rescale()
})
runAfterLoad(() => {
patch_keybinds()
patch_ui()
})
})()