Merge branch 'main' of https://github.com/GGodPL/sandboxels
This commit is contained in:
commit
38bda64b27
|
|
@ -11306,7 +11306,7 @@ if (new Date().getMonth() == 9) {
|
|||
compressedMap = compressedMap.replace(/¤/g,"],[").replace(/°/g,"³³³").replace(/¾/g,'"¥§').replace(/½/g,'},').replace(/¼/g,'":').replace(/¡/g,":false").replace(/¥/g,":true").replace(/¶/g,'{"').replace(/®/g,'"}],[').replace(/¦/g,"¸©").replace(/³/g,"×××").replace(/¸/g,'"},{"').replace(/©/g,"element»").replace(/§/g,',"').replace(/»/g,'":"').replace(/×/g,",0");
|
||||
var savePixelSize = saveConfig.pixelSize||6;
|
||||
resizeCanvas(saveConfig.height*savePixelSize+savePixelSize,saveConfig.width*savePixelSize+savePixelSize,savePixelSize);
|
||||
clearAll();
|
||||
clearAll(true);
|
||||
if (saveConfig.settings) {
|
||||
for (var key in saveConfig.settings) {
|
||||
settings[key] = saveConfig.settings[key];
|
||||
|
|
@ -12445,7 +12445,7 @@ if (new Date().getMonth() == 9) {
|
|||
temperature: 38,
|
||||
}
|
||||
};
|
||||
function clearAll() {
|
||||
function clearAll(skipworldgen) {
|
||||
currentPixels = [];
|
||||
pixelMap = [];
|
||||
currentSaveData = null;
|
||||
|
|
@ -12456,7 +12456,7 @@ if (new Date().getMonth() == 9) {
|
|||
}
|
||||
}
|
||||
pixelTicks = 0;
|
||||
if (settings["worldgen"] && settings["worldgen"] != "off") {
|
||||
if (!skipworldgen && settings["worldgen"] && settings["worldgen"] != "off") {
|
||||
worldGen(worldgentypes[settings["worldgen"]]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
304
mods/chem.js
304
mods/chem.js
|
|
@ -927,7 +927,7 @@ elements.iron_chloride = {
|
|||
behavior: behaviors.POWDER,
|
||||
reactions: {
|
||||
"dirty_water": { "elem1": null, "elem2":"water" },
|
||||
//"ethylene": { "elem2":"1,2_dichloroethane" }, todo: vinyl chloride
|
||||
//"ethylene": { "elem2":"one_two_dichloroethane" }, todo: vinyl chloride
|
||||
},
|
||||
category: "powders",
|
||||
tempHigh: 307.6,
|
||||
|
|
@ -1208,8 +1208,51 @@ elements.ethylene = {
|
|||
density: 1.356,
|
||||
};
|
||||
|
||||
elements.acid.ignore.push("ethylene","liquid_ethylene","chloroethane","liquid_chloroethane");
|
||||
elements.acid_gas.ignore.push("ethylene","liquid_ethylene","chloroethane","liquid_chloroethane");
|
||||
|
||||
elements.liquid_ethylene = {
|
||||
tempHigh: -103.7,
|
||||
stateHigh: "ethylene",
|
||||
tempLow: -154.4,
|
||||
};
|
||||
elements.liquid_ethane = {
|
||||
tempHigh: -88.5,
|
||||
stateHigh: "ethane",
|
||||
tempLow: -128.2,
|
||||
};
|
||||
|
||||
|
||||
elements.liquid_ethylene = {
|
||||
tempHigh: -103.7,
|
||||
stateHigh: "ethylene",
|
||||
tempLow: -169.2,
|
||||
};
|
||||
elements.liquid_ethane = {
|
||||
tempHigh: -88.5,
|
||||
stateHigh: "ethane",
|
||||
tempLow: -182.8,
|
||||
};
|
||||
|
||||
elements.liquid_chloroethane = {
|
||||
tempHigh: -12.27,
|
||||
stateHigh: "chloroethane",
|
||||
tempLow: -138.7,
|
||||
};
|
||||
|
||||
elements.liquid_propane = {
|
||||
tempHigh: -42.25,
|
||||
stateHigh: "propane",
|
||||
tempLow: -187.7,
|
||||
};
|
||||
elements.liquid_methane = {
|
||||
tempHigh: -161.5,
|
||||
stateHigh: "methane",
|
||||
tempLow: -182.45,
|
||||
};
|
||||
|
||||
|
||||
|
||||
elements.acid.ignore.push("ethylene","ethylene_ice","liquid_ethylene","chloroethane","chloroethane_ice","liquid_chloroethane");
|
||||
elements.acid_gas.ignore.push("ethylene","ethylene_ice","liquid_ethylene","chloroethane","chloroethane_ice","liquid_chloroethane");
|
||||
|
||||
|
||||
|
||||
|
|
@ -1842,6 +1885,10 @@ runAfterAutogen(function() {
|
|||
elements.molten_potassium_salt.conduct = 0.7;
|
||||
delete elements.molten_potassium_salt.burn;
|
||||
delete elements.molten_potassium.burn;
|
||||
|
||||
//Hall–Heroult process
|
||||
elements.molten_cryolite_solution.reactions = {};
|
||||
elements.molten_cryolite_solution.reactions.charcoal = { elem1:"molten_aluminum", elem2:"carbon_dioxide" };
|
||||
});
|
||||
|
||||
elements.niter = {
|
||||
|
|
@ -2032,9 +2079,20 @@ elements.silver_bromide = {
|
|||
tick: function(pixel) {
|
||||
for (let i = -1; i <= 1; i++) {
|
||||
for (let j = -1; j <= 1; j++) {
|
||||
if (!isEmpty(pixel.x+i,pixel.y+j,true) && pixelMap[pixel.x+i][pixel.y+j].element === "light") {
|
||||
pixel.color = pixelMap[pixel.x+i][pixel.y+j].color;
|
||||
deletePixel(pixel.x+i,pixel.y+j);
|
||||
if (!isEmpty(pixel.x+i,pixel.y+j,true) && (pixelMap[pixel.x+i][pixel.y+j].element === "light" || pixelMap[pixel.x+i][pixel.y+j].element === "liquid_light")) {
|
||||
|
||||
for (let k = -1; k <= 1; k++) {
|
||||
for (let l = -1; l <= 1; l++) {
|
||||
if(!isEmpty(pixel.x+k,pixel.y+l,true) && pixelMap[pixel.x+k][pixel.y+l].element === "silver_bromide")
|
||||
{
|
||||
pixelMap[pixel.x+k][pixel.y+l].color = pixelMap[pixel.x+i][pixel.y+j].color;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(pixelMap[pixel.x+i][pixel.y+j].element === "light")
|
||||
{
|
||||
deletePixel(pixel.x+i,pixel.y+j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2288,24 +2346,162 @@ elements.disinfectant = {
|
|||
|
||||
|
||||
|
||||
//elements.bauxite = {
|
||||
// color: ["#915a30","#cc7533"],
|
||||
// behavior: behaviors.POWDER,
|
||||
// category: "land",
|
||||
// density: 2420,
|
||||
// state: "solid",
|
||||
// tempHigh: 300
|
||||
//};
|
||||
//
|
||||
//elements.sodium_aluminate = {
|
||||
// color: ["#e6c9b3","#ebc8ad"],
|
||||
// behavior: behaviors.POWDER,
|
||||
// category: "powders",
|
||||
// hidden: true,
|
||||
// density: 1500,
|
||||
// state: "solid",
|
||||
// tempHigh: 1650
|
||||
//};
|
||||
elements.bauxite = {
|
||||
color: ["#915a30","#cc7533"],
|
||||
behavior: behaviors.POWDER,
|
||||
category: "land",
|
||||
density: 2420,
|
||||
state: "solid",
|
||||
tempHigh: 300
|
||||
};
|
||||
|
||||
elements.sodium_aluminate_solution = {
|
||||
color: ["#bdb3e6","#b4adeb"],
|
||||
behavior: behaviors.LIQUID,
|
||||
category: "liquids",
|
||||
hidden: true,
|
||||
density: 1005,
|
||||
state: "liquid",
|
||||
tempHigh: 100,
|
||||
stateHigh: ["sodium_aluminate","steam"],
|
||||
reactions: {
|
||||
//Bayer process
|
||||
"carbon_dioxide": { elem1:"aluminum_hydroxide", elem2: ["sodium_carbonate_solution","spent_sodium_aluminate_solution"] },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
elements.spent_sodium_aluminate_solution = {
|
||||
color: ["#696380","#7a759e"],
|
||||
behavior: behaviors.LIQUID,
|
||||
category: "liquids",
|
||||
hidden: true,
|
||||
density: 1005,
|
||||
state: "liquid",
|
||||
tempHigh: 100,
|
||||
stateHigh: ["sodium_aluminate","sodium_aluminate","sodium_aluminate","gallium","steam","steam","steam","steam"],
|
||||
};
|
||||
|
||||
|
||||
elements.sodium_aluminate = {
|
||||
color: ["#e6c9b3","#ebc8ad"],
|
||||
behavior: behaviors.POWDER,
|
||||
category: "powders",
|
||||
hidden: true,
|
||||
density: 1500,
|
||||
state: "solid",
|
||||
tempHigh: 1650,
|
||||
reactions: {
|
||||
"water": { elem1: "sodium_aluminate_solution", elem2: null },
|
||||
},
|
||||
};
|
||||
|
||||
elements.sodium_carbonate_solution = {
|
||||
color: ["#c5c1d6","#afacc2"],
|
||||
behavior: behaviors.LIQUID,
|
||||
category: "liquids",
|
||||
hidden: true,
|
||||
density: 1005,
|
||||
state: "liquid",
|
||||
tempHigh: 100,
|
||||
stateHigh: ["sodium_carbonate","steam"],
|
||||
};
|
||||
|
||||
|
||||
elements.sodium_carbonate = {
|
||||
color: "#d8dae6",
|
||||
behavior: behaviors.POWDER,
|
||||
category: "powders",
|
||||
hidden: false,
|
||||
density: 2540,
|
||||
state: "solid",
|
||||
tempHigh: 851,
|
||||
reactions: {
|
||||
"water": { elem1: "sodium_carbonate_solution", elem2: null },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
elements.aluminum_hydroxide = {
|
||||
color: "#d1cbcb",
|
||||
behavior: behaviors.POWDER,
|
||||
category: "powders",
|
||||
hidden: true,
|
||||
density: 2420,
|
||||
state: "solid",
|
||||
tempHigh: 300,
|
||||
stateHigh: ["alumina","steam"],
|
||||
}
|
||||
|
||||
elements.alumina = {
|
||||
color: "#d1cbcb",
|
||||
behavior: behaviors.SOLID,
|
||||
category: "solids",
|
||||
density: 3987,
|
||||
state: "solid",
|
||||
tempHigh: 2072,
|
||||
reactions: {
|
||||
"molten_cryolite_mixture": { elem1: "molten_cryolite_solution", elem2: "molten_cryolite_solution"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
elements.cryolite = {
|
||||
color: ["#9ab6d9","#dae4f0"],
|
||||
behavior: behaviors.POWDER,
|
||||
category: "land",
|
||||
density: 2900,
|
||||
state: "solid",
|
||||
tempHigh: 950,
|
||||
reactions: {
|
||||
"aluminum_trifluoride": { elem1: "cryolite_mixture", elem2: "cryolite_mixture"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
elements.aluminum_trifluoride = {
|
||||
color: ["#ebf4ff","#e3fdff"],
|
||||
behavior: behaviors.POWDER,
|
||||
category: "powder",
|
||||
hidden: true,
|
||||
density: 3100,
|
||||
state: "solid",
|
||||
tempHigh: 1290,
|
||||
}
|
||||
|
||||
|
||||
elements.molten_aluminum_trifluoride = {
|
||||
tempHigh: 1290,
|
||||
tempLow: 1290,
|
||||
}
|
||||
|
||||
elements.aluminum_trifluoride_gas = {
|
||||
tempLow: 1290,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
elements.cryolite_mixture = {
|
||||
color: [blendColors("#9ab6d9","#ebf4ff"),blendColors("#dae4f0","#e3fdff")],
|
||||
behavior: behaviors.POWDER,
|
||||
category: "land",
|
||||
hidden: true,
|
||||
density: 2910,
|
||||
state: "solid",
|
||||
tempHigh: 950,
|
||||
}
|
||||
|
||||
elements.cryolite_solution = {
|
||||
color: [blendColors(blendColors("#9ab6d9","#ebf4ff"),"#d1cbcb"),blendColors(blendColors("#dae4f0","#e3fdff"),"#d1cbcb")],
|
||||
behavior: behaviors.POWDER,
|
||||
category: "land",
|
||||
hidden: true,
|
||||
density: 2920,
|
||||
state: "solid",
|
||||
tempHigh: 950,
|
||||
}
|
||||
|
||||
function acidReact(acid,element,product1,product2)
|
||||
{
|
||||
|
|
@ -2356,13 +2552,13 @@ acidNeutralize("potassium_hydroxide");
|
|||
acidNeutralize("potassium_hydroxide_gas");
|
||||
|
||||
|
||||
//createAcid("red_mud",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#ab3d24","#cc5d2d","#a81b1b"],"hidden","hidden",1600,1600,0,Infinity,5200,3);
|
||||
//acidNeutralize("red_mud");
|
||||
//acidNeutralize("red_mud_gas");
|
||||
//elements.red_mud.viscosity = 1000000;
|
||||
//elements.red_mud.reactions.water = {"elem2":"dirty_water" };
|
||||
//elements.red_mud.reactions.salt_water = {"elem2":"dirty_water" };
|
||||
//elements.red_mud.reactions.sugar_water = {"elem2":"dirty_water" };
|
||||
createAcid("red_mud",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#ab3d24","#cc5d2d","#a81b1b"],"hidden","hidden",1600,1600,0,Infinity,5200,3);
|
||||
acidNeutralize("red_mud");
|
||||
acidNeutralize("red_mud_gas");
|
||||
elements.red_mud.viscosity = 1000000;
|
||||
elements.red_mud.reactions.water = {"elem2":"dirty_water" };
|
||||
elements.red_mud.reactions.salt_water = {"elem2":"dirty_water" };
|
||||
elements.red_mud.reactions.sugar_water = {"elem2":"dirty_water" };
|
||||
|
||||
|
||||
elements.potassium_hydroxide.reactions["fertilizer"] = { elem1: "niter", elem2: "ammonia"};
|
||||
|
|
@ -2383,8 +2579,50 @@ elements.potassium_salt_water.reactions["mercury"] = { elem1:["potassium_hydroxi
|
|||
elements.potassium_hydroxide.ignore.push("mercury");
|
||||
elements.potassium_hydroxide.ignore.push("potassium_salt_water");
|
||||
|
||||
//acidReact("sodium_hydroxide","bauxite","sodium_aluminate","red_mud")
|
||||
//elements.red_mud.ignore.push("bauxite","sodium_aluminate");
|
||||
acidReact("sodium_hydroxide","bauxite","sodium_aluminate_solution","red_mud");
|
||||
acidReact("sodium_hydroxide_gas","bauxite","sodium_aluminate_solution","red_mud");
|
||||
elements.red_mud.ignore.push("bauxite","sodium_aluminate_solution","sodium_aluminate_solution_ice","sodium_aluminate","molten_sodium_aluminate","sodium_carbonate_solution","spent_sodium_aluminate_solution","spent_sodium_aluminate_solution_ice","aluminum_hydroxide","alumina","molten_alumina");
|
||||
elements.red_mud_gas.ignore.push("bauxite","sodium_aluminate_solution","sodium_aluminate_solution_ice","sodium_aluminate","molten_sodium_aluminate","sodium_carbonate_solution","spent_sodium_aluminate_solution","spent_sodium_aluminate_solution_ice","aluminum_hydroxide","alumina","molten_alumina");
|
||||
elements.sodium_hydroxide.ignore.push("sodium_aluminate_solution","sodium_aluminate_solution_ice","sodium_aluminate","molten_sodium_aluminate","sodium_carbonate_solution","spent_sodium_aluminate_solution","spent_sodium_aluminate_solution_ice","aluminum_hydroxide","alumina","molten_alumina");
|
||||
elements.sodium_hydroxide_gas.ignore.push("sodium_aluminate_solution","sodium_aluminate_solution_ice","sodium_aluminate","molten_sodium_aluminate","sodium_carbonate_solution","spent_sodium_aluminate_solution","spent_sodium_aluminate_solution_ice","aluminum_hydroxide","alumina","molten_alumina");
|
||||
|
||||
|
||||
|
||||
//Cryolite
|
||||
acidReact("hydrofluoric_acid","sodium_aluminate","cryolite",null);
|
||||
acidReact("hydrofluoric_acid_gas","sodium_aluminate","cryolite",null);
|
||||
|
||||
acidReact("hydrogen_fluoride","sodium_aluminate","cryolite",null);
|
||||
acidReact("liquid_hydrogen_fluoride","sodium_aluminate","cryolite",null);
|
||||
|
||||
elements.hydrofluoric_acid.ignore.push("molten_cryolite","molten_sodium_aluminate");
|
||||
elements.hydrofluoric_acid_gas.ignore.push("molten_cryolite","molten_sodium_aluminate");
|
||||
elements.hydrogen_fluoride.ignore.push("molten_cryolite","molten_sodium_aluminate");
|
||||
elements.liquid_hydrogen_fluoride.ignore.push("molten_cryolite","molten_sodium_aluminate");
|
||||
|
||||
acidReact("hexafluorosilicic_acid","sodium_aluminate","cryolite","sand");
|
||||
acidReact("hexafluorosilicic_acid_gas","sodium_aluminate","cryolite","sand");
|
||||
elements.hexafluorosilicic_acid.ignore.push("molten_cryolite","molten_sodium_aluminate");
|
||||
elements.hexafluorosilicic_acid_gas.ignore.push("molten_cryolite","molten_sodium_aluminate");
|
||||
|
||||
//Aluminum trifluoride
|
||||
acidReact("hydrofluoric_acid","alumina","aluminum_trifluoride",null);
|
||||
acidReact("hydrofluoric_acid_gas","alumina","aluminum_trifluoride",null);
|
||||
|
||||
acidReact("hydrogen_fluoride","alumina","aluminum_trifluoride",null);
|
||||
acidReact("liquid_hydrogen_fluoride","alumina","aluminum_trifluoride",null);
|
||||
|
||||
elements.hydrofluoric_acid.ignore.push("molten_alumina","molten_aluminum_trifluoride");
|
||||
elements.hydrofluoric_acid_gas.ignore.push("molten_alumina","molten_aluminum_trifluoride");
|
||||
elements.hydrogen_fluoride.ignore.push("molten_alumina","molten_aluminum_trifluoride");
|
||||
elements.liquid_hydrogen_fluoride.ignore.push("molten_alumina","molten_aluminum_trifluoride");
|
||||
|
||||
|
||||
acidReact("hydrofluoric_acid","aluminum_hydroxide","aluminum_trifluoride",null);
|
||||
acidReact("hydrofluoric_acid_gas","aluminum_hydroxide","aluminum_trifluoride",null);
|
||||
|
||||
acidReact("hydrogen_fluoride","aluminum_hydroxide","aluminum_trifluoride",null);
|
||||
acidReact("liquid_hydrogen_fluoride","aluminum_hydroxide","aluminum_trifluoride",null);
|
||||
|
||||
elements.bless.reactions["FOOF"] = {elem2: "oxygen"};
|
||||
elements.bless.reactions["solid_FOOF"] = {elem2: "oxygen"};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
elements.Doomsday = {
|
||||
color: "#ff0000",
|
||||
behavior: [
|
||||
"XX|EX:100000>plasma,plasma,plasma,plasma,fire,fire,plasma,plasma,plasma,plasma,fire,fire,fire,fire,fire,plasma,plasma,plasma,plasma,fire,fire,fire,fire,fire,fire,fire,fire,fire,fire,plasma,plasma,plasma,plasma,fire,fire,fire,fire,fire|XX",
|
||||
"XX|XX|XX",
|
||||
"M2|M1 AND EX:10000>plasma,plasma,plasma,plasma,fire,fire,fire,fire,fire,plasma,plasma,plasma,plasma,fire,fire,fire,fire,fire,fire,fire,fire,fire,fire,plasma,plasma,plasma,plasma,fire,fire,fire,fire,fire|M2",
|
||||
],
|
||||
category: "weapons",
|
||||
state: "solid",
|
||||
density: 1600,
|
||||
excludeRandom: true,
|
||||
alias: "Say goodbye to your computer chucklenuts",
|
||||
cooldown: defaultCooldown
|
||||
}
|
||||
elements.Plasma_cannon = {
|
||||
color: "#6a00ff",
|
||||
behavior: [
|
||||
"XX|EX:90>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma|XX",
|
||||
"XX|XX|XX",
|
||||
"M2|M1 AND EX:90>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma|M2",
|
||||
],
|
||||
category: "weapons",
|
||||
state: "solid",
|
||||
density: 1600,
|
||||
excludeRandom: true,
|
||||
alias: "Plasma cannon :D",
|
||||
cooldown: defaultCooldown
|
||||
}
|
||||
elements.Cluster_Nuke = {
|
||||
color: "#6a00ff",
|
||||
behavior: [
|
||||
"XX|EX:90>plasma,fire,nuke|XX",
|
||||
"XX|XX|XX",
|
||||
"M2|M1 AND EX:90>plasma,fire,fire,fire,nuke,nuke,nuke|M2",
|
||||
],
|
||||
category: "weapons",
|
||||
state: "solid",
|
||||
density: 1600,
|
||||
excludeRandom: true,
|
||||
alias: "Plasma cannon :D",
|
||||
cooldown: defaultCooldown
|
||||
}
|
||||
elements.Infinibomb = {
|
||||
color: "#6a00ff",
|
||||
behavior: [
|
||||
"XX|EX:20>plasma,fire|XX",
|
||||
"XX|XX|XX",
|
||||
"M2|M1 AND EX:20>plasma,fire,fire,fire,Infinibomb|M2",
|
||||
],
|
||||
category: "weapons",
|
||||
state: "solid",
|
||||
density: 1600,
|
||||
excludeRandom: true,
|
||||
alias: "Plasma cannon :D",
|
||||
cooldown: defaultCooldown
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
pixelResizeButton = document.createElement("button");
|
||||
pixelResizeButton.onclick = function(pixel) {
|
||||
let canvas_width = document.getElementById("game").width;
|
||||
let canvas_height = document.getElementById("game").height;
|
||||
let pixelSizeNeeded = prompt("How big should pixels be?");
|
||||
if (!pixelSizeNeeded) { return }
|
||||
resizeCanvas(canvas_height,canvas_width, parseFloat(pixelSizeNeeded), true);
|
||||
};
|
||||
pixelResizeButton.textContent = "Resize";
|
||||
document.getElementById("toolControls").appendChild(pixelResizeButton);
|
||||
|
|
@ -198,16 +198,8 @@ explodeAt = function(x,y,radius,fire="fire") {
|
|||
continue;
|
||||
}
|
||||
else if (damage > 0.25) {
|
||||
if (info.breakInto) {
|
||||
// if it is an array, choose a random item, else just use the value
|
||||
if (Array.isArray(info.breakInto)) {
|
||||
var result = info.breakInto[Math.floor(Math.random() * info.breakInto.length)];
|
||||
}
|
||||
else {
|
||||
var result = info.breakInto;
|
||||
}
|
||||
// change the pixel to the result
|
||||
changePixel(pixel,result);
|
||||
if (info.breakInto !== undefined) {
|
||||
breakPixel(pixel);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue