Merge branch 'main' of https://github.com/R74nCom/sandboxels
This commit is contained in:
commit
a7cfb584b9
|
|
@ -1163,10 +1163,11 @@ try {
|
||||||
};
|
};
|
||||||
|
|
||||||
function convertHslObjects(color,outputType="rgb") {
|
function convertHslObjects(color,outputType="rgb") {
|
||||||
|
if(color == null) { console.error("convertHslObjects: Color is null"); color = {h: 300, s: 100, l: 50} };
|
||||||
switch(outputType.toLowerCase()) {
|
switch(outputType.toLowerCase()) {
|
||||||
//RGB cases
|
//RGB cases
|
||||||
case "rgb":
|
case "rgb":
|
||||||
color = hexToRGB(hslToHex(...Object.values(color))); //hsl to hex, hex to rgb_json, and rgb_json to rgb()
|
color = convertColorFormats(hslToHex(...Object.values(color)),"json"); //hsl to hex, hex to rgb_json, and rgb_json to rgb()
|
||||||
return `rgb(${color.r},${color.g},${color.b})`;
|
return `rgb(${color.r},${color.g},${color.b})`;
|
||||||
break;
|
break;
|
||||||
case "hex":
|
case "hex":
|
||||||
|
|
@ -1202,8 +1203,8 @@ try {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error("outputType must be \"rgb\", \"hex\", \"rgb_json\", \"rgb_array\", \"hsl\", \"hsl_json\", or \"hsl_array\"");
|
throw new Error("outputType must be \"rgb\", \"hex\", \"rgb_json\", \"rgb_array\", \"hsl\", \"hsl_json\", or \"hsl_array\"");
|
||||||
};
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function changeSaturation(color,saturationChange,operationType="add",outputType="rgb",arrayType=null,doRounding=true) {
|
function changeSaturation(color,saturationChange,operationType="add",outputType="rgb",arrayType=null,doRounding=true) {
|
||||||
color = normalizeColorToHslObject(color,arrayType);
|
color = normalizeColorToHslObject(color,arrayType);
|
||||||
|
|
@ -2094,13 +2095,15 @@ try {
|
||||||
|
|
||||||
//fix -1-caused ghost pixels
|
//fix -1-caused ghost pixels
|
||||||
function deletePixel(x,y) {
|
function deletePixel(x,y) {
|
||||||
|
if(isEmpty(x,y,true)) { return false };
|
||||||
// remove pixelMap[x][y] from currentPixels
|
// remove pixelMap[x][y] from currentPixels
|
||||||
var pixelIndex = currentPixels.indexOf(pixelMap[x][y]);
|
var pixelIndex = currentPixels.indexOf(pixelMap[x][y]);
|
||||||
if(pixelIndex !== -1) {
|
if(pixelIndex !== -1) {
|
||||||
currentPixels.splice(pixelIndex,1)
|
currentPixels.splice(pixelIndex,1)
|
||||||
|
if (pixelMap[x][y]) { delete pixelMap[x][y] };
|
||||||
};
|
};
|
||||||
if (pixelMap[x][y]) {pixelMap[x][y].del = true}
|
//if (pixelMap[x][y]) {pixelMap[x][y].del = true}
|
||||||
if (pixelMap[x][y]) { delete pixelMap[x][y] };
|
//if (pixelMap[x][y]) { delete pixelMap[x][y] };
|
||||||
/*for (var i = 0; i < currentPixels.length; i++) {
|
/*for (var i = 0; i < currentPixels.length; i++) {
|
||||||
if (currentPixels[i].x == x && currentPixels[i].y == y) {
|
if (currentPixels[i].x == x && currentPixels[i].y == y) {
|
||||||
currentPixels.splice(i, 1);
|
currentPixels.splice(i, 1);
|
||||||
|
|
@ -3217,6 +3220,32 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//redefine mouseRange to support even sizes
|
||||||
|
function mouseRange(mouseX,mouseY,size) {
|
||||||
|
var coords = [];
|
||||||
|
size = size || mouseSize;
|
||||||
|
if (elements[currentElement].maxSize < mouseSize) {
|
||||||
|
var mouseOffset = Math.trunc(elements[currentElement].maxSize/2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var mouseOffset = Math.trunc(size/2);
|
||||||
|
}
|
||||||
|
var topLeft = [mouseX-mouseOffset,mouseY-mouseOffset];
|
||||||
|
var bottomRight = [mouseX+mouseOffset,mouseY+mouseOffset];
|
||||||
|
if(size % 2 == 0) {
|
||||||
|
bottomRight[0]--;
|
||||||
|
bottomRight[1]--;
|
||||||
|
};
|
||||||
|
// Starting at the top left, go through each pixel
|
||||||
|
for (var x = topLeft[0]; x <= bottomRight[0]; x++) {
|
||||||
|
for (var y = topLeft[1]; y <= bottomRight[1]; y++) {
|
||||||
|
// If the pixel is empty, add it to coords
|
||||||
|
coords.push([x,y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return coords;
|
||||||
|
};
|
||||||
|
|
||||||
//this part defines basically all of the keybinds
|
//this part defines basically all of the keybinds
|
||||||
function addKeyboardListeners() {
|
function addKeyboardListeners() {
|
||||||
document.addEventListener("keydown", function(e) {
|
document.addEventListener("keydown", function(e) {
|
||||||
|
|
@ -3259,16 +3288,26 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// If the user presses [ or -, decrease the mouse size by 2
|
||||||
if (e.keyCode == 219 || e.keyCode == 189) {
|
if (e.keyCode == 219 || e.keyCode == 189) {
|
||||||
if (shiftDown) {mouseSize = 1}
|
//If a shift key is pressed, set to 1
|
||||||
|
if (shiftDown && shiftDown % 2 == 1) {mouseSize = 1}
|
||||||
|
//If an alt key is pressed, decrease by 1
|
||||||
|
else if (shiftDown && shiftDown % 2 == 0) {
|
||||||
|
mouseSize--;
|
||||||
|
if (mouseSize < 1) { mouseSize = 1 }
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
mouseSize -= 2;
|
mouseSize -= 2;
|
||||||
if (mouseSize < 1) { mouseSize = 1; }
|
if (mouseSize < 1) { mouseSize = 1 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the user presses ] or =, increase the mouse size by 2
|
// If the user presses ] or =, increase the mouse size by 2
|
||||||
if (e.keyCode == 221 || e.keyCode == 187) {
|
if (e.keyCode == 221 || e.keyCode == 187) {
|
||||||
if (shiftDown) {mouseSize = (mouseSize+15)-((mouseSize+15) % 15)}
|
//If a shift key is pressed, increase by 15
|
||||||
|
if (shiftDown && shiftDown % 2 == 1) {mouseSize = (mouseSize+15)-((mouseSize+15) % 15)}
|
||||||
|
//If an alt key is pressed, increase by 1
|
||||||
|
else if (shiftDown && shiftDown % 2 == 0) {mouseSize++}
|
||||||
else {mouseSize += 2;}
|
else {mouseSize += 2;}
|
||||||
// if height>width and mouseSize>height, set mouseSize to height, if width>height and mouseSize>width, set mouseSize to width
|
// if height>width and mouseSize>height, set mouseSize to height, if width>height and mouseSize>width, set mouseSize to width
|
||||||
if (mouseSize > (height > width ? height : width)) { mouseSize = (height > width ? height : width); }
|
if (mouseSize > (height > width ? height : width)) { mouseSize = (height > width ? height : width); }
|
||||||
|
|
@ -3607,6 +3646,11 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
velocityBlacklist = [];
|
velocityBlacklist = [];
|
||||||
|
|
||||||
function explodeAtPlus(x,y,radius,firee="fire",smokee="smoke",beforeFunction=null,afterFunction=null,changeTemp=true) {
|
function explodeAtPlus(x,y,radius,firee="fire",smokee="smoke",beforeFunction=null,afterFunction=null,changeTemp=true) {
|
||||||
|
var message = "Explosion ";
|
||||||
|
var pixel = pixelMap[x]?.[y];
|
||||||
|
if(pixel) { message += `of ${pixel.element} ` };
|
||||||
|
message += `with radius ${radius} at (${x},${y})`;
|
||||||
|
|
||||||
// if fire contains , split it into an array
|
// if fire contains , split it into an array
|
||||||
if(firee !== null) {
|
if(firee !== null) {
|
||||||
if (firee.indexOf(",") !== -1) {
|
if (firee.indexOf(",") !== -1) {
|
||||||
|
|
@ -3730,6 +3774,15 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
};
|
};
|
||||||
|
|
||||||
oldExplodeAt = explodeAt;
|
oldExplodeAt = explodeAt;
|
||||||
|
/*explodeAt = function(x,y,radius,fire="fire") {
|
||||||
|
var message = "Explosion ";
|
||||||
|
var pixel = pixelMap[x]?.[y];
|
||||||
|
if(pixel) { message += `of ${pixel.element} ` };
|
||||||
|
message += `with radius ${radius} with "${fire}" at (${x},${y})`;
|
||||||
|
console.log(message);
|
||||||
|
|
||||||
|
oldExplodeAt(x,y,radius,fire="fire")
|
||||||
|
};*/
|
||||||
explodeAt = explodeAtPlus;
|
explodeAt = explodeAtPlus;
|
||||||
|
|
||||||
//MORE CONFIGURABLE REACTION TEMPERATURE CHANGES ##
|
//MORE CONFIGURABLE REACTION TEMPERATURE CHANGES ##
|
||||||
|
|
@ -5029,11 +5082,10 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
if (pixel.charge && elementInfo.colorOn) {
|
if (pixel.charge && elementInfo.colorOn) {
|
||||||
customColor = elementInfo.colorOn;
|
customColor = elementInfo.colorOn;
|
||||||
}
|
}
|
||||||
if (customColor != null) {
|
if (customColor !== null) {
|
||||||
if (Array.isArray(customColor)) {
|
if (Array.isArray(customColor)) {
|
||||||
customColor = customColor[Math.floor(Math.random() * customColor.length)];
|
customColor = customColor[Math.floor(Math.random() * customColor.length)];
|
||||||
}
|
} else if (customColor.startsWith?.("#")) {
|
||||||
if (customColor.startsWith("#")) {
|
|
||||||
customColor = hexToRGB(customColor);
|
customColor = hexToRGB(customColor);
|
||||||
}
|
}
|
||||||
var rgb = customColor;
|
var rgb = customColor;
|
||||||
|
|
@ -5224,7 +5276,7 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
if (!settings["bg"]) {ctx.clearRect(0, 0, canvas.width, canvas.height)}
|
if (!settings["bg"]) {ctx.clearRect(0, 0, canvas.width, canvas.height)}
|
||||||
else {
|
else {
|
||||||
if(settings["bg"] instanceof Array) {
|
if(settings["bg"] instanceof Array) {
|
||||||
settings.bgAngle ??= 0;
|
settings.bgAngle ??= 90;
|
||||||
var angle = (settings.bgAngle) * Math.PI / 180;
|
var angle = (settings.bgAngle) * Math.PI / 180;
|
||||||
ctx.fillStyle = ctx.createLinearGradient(
|
ctx.fillStyle = ctx.createLinearGradient(
|
||||||
0,
|
0,
|
||||||
|
|
@ -5560,6 +5612,10 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
}
|
}
|
||||||
var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset];
|
var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset];
|
||||||
var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset];
|
var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset];
|
||||||
|
if(mouseSize % 2 == 0) {
|
||||||
|
bottomRight[0]--;
|
||||||
|
bottomRight[1]--;
|
||||||
|
};
|
||||||
// Draw a square around the mouse
|
// Draw a square around the mouse
|
||||||
ctx.strokeStyle = "white";
|
ctx.strokeStyle = "white";
|
||||||
ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
|
ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize);
|
||||||
|
|
@ -7930,7 +7986,7 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
}
|
}
|
||||||
//1010 and 0101
|
//1010 and 0101
|
||||||
if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) {
|
if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) {
|
||||||
if(!pixel.changeTo) {
|
if(!pixel.changeTo) { //7989 yay soshi!
|
||||||
if(ggg < 1/2) {
|
if(ggg < 1/2) {
|
||||||
pixel.changeTo = pixel.dc1
|
pixel.changeTo = pixel.dc1
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -8069,7 +8125,7 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
if(isEmpty(pixel.x+1,pixel.y-1) && isEmpty(pixel.x+1,pixel.y-2) && !outOfBounds(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-2)) {
|
if(isEmpty(pixel.x+1,pixel.y-1) && isEmpty(pixel.x+1,pixel.y-2) && !outOfBounds(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-2)) {
|
||||||
tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1)
|
tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1)
|
||||||
tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x+1,pixel.y-2)
|
tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x+1,pixel.y-2)
|
||||||
} //7989 yay soshi!
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) {
|
if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) {
|
||||||
|
|
@ -17191,9 +17247,9 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
|
||||||
elements.electric_gas = {
|
elements.electric_gas = {
|
||||||
color: ["#3693b3", "#246e64"],
|
color: ["#3693b3", "#246e64"],
|
||||||
behavior: [
|
behavior: [
|
||||||
"M2%33.3 AND CR:electric%1|M1%33.3 AND CR:electric%1|M2%33.3 AND CR:electric%1",
|
"M2%33.3 AND CR:electric%1 AND CR:lightning%0.005|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|M2%33.3 AND CR:electric%1 AND CR:lightning%0.005",
|
||||||
"M1%33.3 AND CR:electric%1|XX%0000000000000000000000|M1%33.3 AND CR:electric%1",
|
"M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|XX%000000000000000000000000000000000000000000000|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005",
|
||||||
"M2%33.3 AND CR:electric%1|M1%33.3 AND CR:electric%1|M2%33.3 AND CR:electric%1",
|
"M2%33.3 AND CR:electric%1 AND CR:lightning%0.005|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|M2%33.3 AND CR:electric%1 AND CR:lightning%0.005",
|
||||||
],
|
],
|
||||||
hardness: 0.8,
|
hardness: 0.8,
|
||||||
reactions: {
|
reactions: {
|
||||||
|
|
@ -17202,7 +17258,7 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
|
||||||
},
|
},
|
||||||
category: "gases",
|
category: "gases",
|
||||||
density: 1.225,
|
density: 1.225,
|
||||||
state: "gas",
|
state: "gas"
|
||||||
};
|
};
|
||||||
|
|
||||||
corrosiveGasMaxHardness = 0.6
|
corrosiveGasMaxHardness = 0.6
|
||||||
|
|
@ -19256,9 +19312,10 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function heejinitoidTick(pixel) {
|
function heejinitoidTick(pixel) {
|
||||||
|
pixel.color ??= pixelColorPick(pixel);
|
||||||
if(pixel.oldColor === null) { pixel.oldColor = pixel.color };
|
if(pixel.oldColor === null) { pixel.oldColor = pixel.color };
|
||||||
if(pixel.oldColor === undefined) { pixel.oldColor = pixelColorPick(pixel) };
|
if(pixel.oldColor === undefined) { pixel.oldColor = pixelColorPick(pixel) };
|
||||||
var color = rgbStringToHSL(convertColorFormats(pixel.oldColor,"rgb"),"json");
|
var color = rgbStringToHSL((convertColorFormats(pixel.oldColor,"rgb") ?? pixelColorPick(pixel)),"json");
|
||||||
var heejiniteHueSpread = 30 + (pixel.temp/9.25)
|
var heejiniteHueSpread = 30 + (pixel.temp/9.25)
|
||||||
var hueOffset = (Math.sin(pixelTicks / 11) * heejiniteHueSpread) + 15; color.h += hueOffset;
|
var hueOffset = (Math.sin(pixelTicks / 11) * heejiniteHueSpread) + 15; color.h += hueOffset;
|
||||||
var color = convertHslObjects(color,"rgb");
|
var color = convertHslObjects(color,"rgb");
|
||||||
|
|
@ -26448,6 +26505,8 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
|
||||||
elements.molten_copper ??= {}; elements.molten_copper.tempHigh = 4700;
|
elements.molten_copper ??= {}; elements.molten_copper.tempHigh = 4700;
|
||||||
elements.molten_alumina ??= {};
|
elements.molten_alumina ??= {};
|
||||||
elements.molten_alumina.tempHigh = 5400;
|
elements.molten_alumina.tempHigh = 5400;
|
||||||
|
elements.molten_alumina.state = "liquid";
|
||||||
|
elements.molten_alumina.autoType = "gas";
|
||||||
elements.molten_alumina.reactions ??= {};
|
elements.molten_alumina.reactions ??= {};
|
||||||
elements.molten_alumina.reactions.iron_scrap = {elem1: "molten_sapphire", elem2: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron",null] };
|
elements.molten_alumina.reactions.iron_scrap = {elem1: "molten_sapphire", elem2: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron",null] };
|
||||||
elements.molten_alumina.reactions.molten_iron = {elem1: "molten_sapphire", elem2: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron",null] };
|
elements.molten_alumina.reactions.molten_iron = {elem1: "molten_sapphire", elem2: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron",null] };
|
||||||
|
|
@ -35842,7 +35901,7 @@ Make sure to save your command in a file if you want to add this preset again.`
|
||||||
};
|
};
|
||||||
|
|
||||||
elements.sponge.onTryMoveInto = function(pixel,otherPixel) {
|
elements.sponge.onTryMoveInto = function(pixel,otherPixel) {
|
||||||
var absorbedElements = Object.keys(pixel.absorbed);
|
var absorbedElements = Object.keys(pixel.absorbed ?? {});
|
||||||
if(absorbedElements.length == 0) {
|
if(absorbedElements.length == 0) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
@ -45937,6 +45996,67 @@ maxPixels (default 1000): Maximum amount of pixels/changes (if xSpacing and ySpa
|
||||||
maxColorOffset: 0
|
maxColorOffset: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
runAfterLoad(function() {
|
||||||
|
//Emergency bug fix
|
||||||
|
elemfillerVar = null;
|
||||||
|
elements.element_filler = {
|
||||||
|
category: "special",
|
||||||
|
color: elements.filler.color,
|
||||||
|
state: "solid",
|
||||||
|
movable: "false",
|
||||||
|
onSelect: function() {
|
||||||
|
var answer6 = prompt("Please input the desired element of this filler. It will not work if you do multiple filter types while paused.",(elemfillerVar||undefined));
|
||||||
|
if (!answer6) { return }
|
||||||
|
elemfillerVar = answer6;
|
||||||
|
},
|
||||||
|
excludeRandom: true,
|
||||||
|
tick: function(pixel){
|
||||||
|
if(!(elementExists(elemfillerVar))) {
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
return
|
||||||
|
};
|
||||||
|
var neighbors = 0;
|
||||||
|
if(!pixel.changeElem){
|
||||||
|
pixel.changeElem = elemfillerVar;
|
||||||
|
}
|
||||||
|
for (var i = 0; i < squareCoords.length; i++) {
|
||||||
|
var coord = squareCoords[i];
|
||||||
|
var x = pixel.x+coord[0];
|
||||||
|
var y = pixel.y+coord[1];
|
||||||
|
if (!isEmpty(x,y, true)) {
|
||||||
|
neighbors = neighbors + 1;
|
||||||
|
} else if (isEmpty(x, y)){
|
||||||
|
createPixel("element_filler", x, y)
|
||||||
|
pixelMap[x][y].changeElem = pixel.changeElem;
|
||||||
|
} else (
|
||||||
|
changePixel(pixel, pixel.changeElem)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (neighbors >= 8){
|
||||||
|
changePixel(pixel, pixel.changeElem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(elementExists("ohio")) {
|
||||||
|
elements.ohio.excludeRandom = true
|
||||||
|
};
|
||||||
|
if(elementExists("rainbow_bomb")) {
|
||||||
|
elements.rainbow_bomb.excludeRandom = true
|
||||||
|
};
|
||||||
|
if(elementExists("fart")) {
|
||||||
|
elements.fart.excludeRandom = true
|
||||||
|
};
|
||||||
|
if(elementExists("dark_energy")) {
|
||||||
|
elements.dark_energy.excludeRandom = true
|
||||||
|
};
|
||||||
|
if(elementExists("rainbow_flash")) {
|
||||||
|
elements.rainbow_flash.excludeRandom = true;
|
||||||
|
delete elements.rainbow_flash.reactions.fire
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
//END ##
|
//END ##
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(`Load failed (try reloading).\nThis is likely a sporadic failure caused by inconsistencies in how mods are loaded, and will likely fix itself in a refresh or two. If it persists, then it's an issue.\nError: ${error.stack}`);
|
alert(`Load failed (try reloading).\nThis is likely a sporadic failure caused by inconsistencies in how mods are loaded, and will likely fix itself in a refresh or two. If it persists, then it's an issue.\nError: ${error.stack}`);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,34 @@
|
||||||
|
elements.freeze_ray = {
|
||||||
|
color: ["#9ae4f5","#84d6e8"],
|
||||||
|
tick: function(pixel) {
|
||||||
|
var x = pixel.x;
|
||||||
|
for (var y = pixel.y; y < height; y++) {
|
||||||
|
if (outOfBounds(x, y)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (isEmpty(x, y)) {
|
||||||
|
if (Math.random() > 0.05) { continue }
|
||||||
|
createPixel("flash", x, y);
|
||||||
|
pixelMap[x][y].color = "#aedbe6";
|
||||||
|
pixelMap[x][y].temp = -257;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (elements[pixelMap[x][y].element].isGas) { continue }
|
||||||
|
if (elements[pixelMap[x][y].element].id === elements.heat_ray.id) { break }
|
||||||
|
pixelMap[x][y].temp -= 100;
|
||||||
|
pixelTempCheck(pixelMap[x][y]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deletePixel(pixel.x, pixel.y);
|
||||||
|
},
|
||||||
|
temp: -257,
|
||||||
|
category: "energy",
|
||||||
|
state: "gas",
|
||||||
|
excludeRandom: true,
|
||||||
|
noMix: true
|
||||||
|
};
|
||||||
|
|
||||||
elements.beer = {
|
elements.beer = {
|
||||||
color: ["#ffc43d","#ffc43d"],
|
color: ["#ffc43d","#ffc43d"],
|
||||||
behavior: behaviors.LIQUID,
|
behavior: behaviors.LIQUID,
|
||||||
|
|
@ -16,6 +47,9 @@ elements.root_beer = {
|
||||||
|
|
||||||
elements.fruit_slushy = {
|
elements.fruit_slushy = {
|
||||||
color: ["#d43968","#ec5885","#f57ca1","#fba9c2","#ffe3eb"],
|
color: ["#d43968","#ec5885","#f57ca1","#fba9c2","#ffe3eb"],
|
||||||
|
stateLowColorMultiplier: 1.3,
|
||||||
|
stateLow: "slushy_ice",
|
||||||
|
tempLow: "-50",
|
||||||
behavior: behaviors.LIQUID,
|
behavior: behaviors.LIQUID,
|
||||||
category: "food",
|
category: "food",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
|
|
@ -32,6 +66,9 @@ elements.mold = {
|
||||||
|
|
||||||
elements.chocolate_slushy = {
|
elements.chocolate_slushy = {
|
||||||
color: ["#c3ae9a","#ae967f","#977b5f","#876b4f","#816346"],
|
color: ["#c3ae9a","#ae967f","#977b5f","#876b4f","#816346"],
|
||||||
|
stateLowColorMultiplier: 1.3,
|
||||||
|
tempLow: "-50",
|
||||||
|
stateLow: "slushy_ice",
|
||||||
behavior: behaviors.LIQUID,
|
behavior: behaviors.LIQUID,
|
||||||
category: "food",
|
category: "food",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
|
|
@ -136,7 +173,7 @@ elements.fruit_yogurt = {
|
||||||
|
|
||||||
elements.frozen_fruit_yogurt = {
|
elements.frozen_fruit_yogurt = {
|
||||||
color: ["#ffdfdf","#ffc0c0","#ff9b9b"],
|
color: ["#ffdfdf","#ffc0c0","#ff9b9b"],
|
||||||
stateLowColorMultiplier: 0.7,
|
stateHighColorMultiplier: 0.7,
|
||||||
behavior: behaviors.STURDYPOWDER,
|
behavior: behaviors.STURDYPOWDER,
|
||||||
category: "food",
|
category: "food",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
|
|
@ -149,7 +186,7 @@ elements.frozen_fruit_yogurt = {
|
||||||
|
|
||||||
elements.frozen_chocolate_yogurt = {
|
elements.frozen_chocolate_yogurt = {
|
||||||
color: ["#a87848","#a57e57","#c1a07f","#e2c5ac","#efd0b1"],
|
color: ["#a87848","#a57e57","#c1a07f","#e2c5ac","#efd0b1"],
|
||||||
stateLowColorMultiplier: 0.7,
|
stateHighColorMultiplier: 0.7,
|
||||||
behavior: behaviors.STURDYPOWDER,
|
behavior: behaviors.STURDYPOWDER,
|
||||||
category: "food",
|
category: "food",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
|
|
@ -418,7 +455,7 @@ elements.moss = {
|
||||||
};
|
};
|
||||||
|
|
||||||
elements.moth = {
|
elements.moth = {
|
||||||
color: "#665233",
|
color: ["#df8830","#e9b477","#a1591a","#a87a46","#4e3212"],
|
||||||
behavior: behaviors.FLY,
|
behavior: behaviors.FLY,
|
||||||
category: "life",
|
category: "life",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
|
|
@ -661,7 +698,6 @@ elements.banana = {
|
||||||
breakInto: "juice",
|
breakInto: "juice",
|
||||||
breakIntoColor: "#f0f060",
|
breakIntoColor: "#f0f060",
|
||||||
reactions: {
|
reactions: {
|
||||||
"steam": { elem1: "potassium", elem2: null },
|
|
||||||
"sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fdf8d6","#f9efa6"] },
|
"sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fdf8d6","#f9efa6"] },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1074,14 +1110,6 @@ elements.eggplant = {
|
||||||
breakIntoColor: ["#674ea7","#351c75"],
|
breakIntoColor: ["#674ea7","#351c75"],
|
||||||
};
|
};
|
||||||
|
|
||||||
elements.potassium = {
|
|
||||||
color: "#a3a333",
|
|
||||||
behavior: behaviors.POWDER,
|
|
||||||
category: "states",
|
|
||||||
state: "solid",
|
|
||||||
breakInto: "juice",
|
|
||||||
};
|
|
||||||
|
|
||||||
elements.onion = {
|
elements.onion = {
|
||||||
color: ["#62121b","#a92940","#c04b65","#d8699e"],
|
color: ["#62121b","#a92940","#c04b65","#d8699e"],
|
||||||
behavior:
|
behavior:
|
||||||
|
|
@ -1282,7 +1310,7 @@ elements.legacy_rocket = {
|
||||||
"XX|DL%1|XX",
|
"XX|DL%1|XX",
|
||||||
"CR:smoke|CR:fire|CR:smoke",
|
"CR:smoke|CR:fire|CR:smoke",
|
||||||
],
|
],
|
||||||
category: "special",
|
category: "legacy",
|
||||||
hidden:true,
|
hidden:true,
|
||||||
state: "solid",
|
state: "solid",
|
||||||
temp:700,
|
temp:700,
|
||||||
|
|
@ -1292,6 +1320,84 @@ elements.legacy_rocket = {
|
||||||
stateHigh: "molten_steel"
|
stateHigh: "molten_steel"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
elements.legacy_dough = {
|
||||||
|
color: "#bfac91",
|
||||||
|
behavior: behaviors.STURDYPOWDER,
|
||||||
|
onMix: function(dough,ingredient) {
|
||||||
|
if (elements[ingredient.element].isFood && elements[ingredient.element].id !== elements.dough.id && elements[ingredient.element].id !== elements.flour.id && elements[ingredient.element].id !== elements.batter.id && elements[ingredient.element].id !== elements.bread.id) {
|
||||||
|
var rgb1 = dough.color.match(/\d+/g);
|
||||||
|
var rgb2 = ingredient.color.match(/\d+/g);
|
||||||
|
// average the colors
|
||||||
|
var rgb = [
|
||||||
|
Math.round((parseInt(rgb1[0])+parseInt(rgb2[0]))/2),
|
||||||
|
Math.round((parseInt(rgb1[1])+parseInt(rgb2[1]))/2),
|
||||||
|
Math.round((parseInt(rgb1[2])+parseInt(rgb2[2]))/2)
|
||||||
|
];
|
||||||
|
changePixel(ingredient, "dough")
|
||||||
|
// convert rgb to hex
|
||||||
|
var hex = RGBToHex(rgb);
|
||||||
|
dough.color = pixelColorPick(dough, hex);
|
||||||
|
// 50% change to delete ingredient
|
||||||
|
if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); }
|
||||||
|
else {
|
||||||
|
ingredient.color = pixelColorPick(ingredient, hex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
reactions: {
|
||||||
|
"milk": { elem2:"broth", color2:"#ECC891", tempMin:70 },
|
||||||
|
"cream": { elem2:"broth", color2:"#ECC891", tempMin:70 },
|
||||||
|
},
|
||||||
|
category: "legacy",
|
||||||
|
tempHigh: 94,
|
||||||
|
stateHigh: "bread",
|
||||||
|
//stateHighColorMultiplier: 0.9,
|
||||||
|
burn:40,
|
||||||
|
burnTime:25,
|
||||||
|
burnInto:"ash",
|
||||||
|
state: "solid",
|
||||||
|
density: 526.9,
|
||||||
|
isFood: true
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.legacy_batter = {
|
||||||
|
color: "#d4bc85",
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
onMix: function(batter,ingredient) {
|
||||||
|
if (elements[ingredient.element].isFood && elements[ingredient.element].id !== elements.batter.id && elements[ingredient.element].id !== elements.flour.id && elements[ingredient.element].id !== elements.yolk.id && elements[ingredient.element].id !== elements.dough.id && elements[ingredient.element].id !== elements.baked_batter.id) {
|
||||||
|
var rgb1 = batter.color.match(/\d+/g);
|
||||||
|
var rgb2 = ingredient.color.match(/\d+/g);
|
||||||
|
// average the colors
|
||||||
|
var rgb = [
|
||||||
|
Math.round((parseInt(rgb1[0])+parseInt(rgb2[0]))/2),
|
||||||
|
Math.round((parseInt(rgb1[1])+parseInt(rgb2[1]))/2),
|
||||||
|
Math.round((parseInt(rgb1[2])+parseInt(rgb2[2]))/2)
|
||||||
|
];
|
||||||
|
changePixel(ingredient, "batter")
|
||||||
|
// convert rgb to hex
|
||||||
|
var hex = RGBToHex(rgb);
|
||||||
|
batter.color = pixelColorPick(batter, hex);
|
||||||
|
// 50% change to delete ingredient
|
||||||
|
if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); }
|
||||||
|
else {
|
||||||
|
ingredient.color = pixelColorPick(ingredient, hex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
category: "legacy",
|
||||||
|
tempHigh: 94,
|
||||||
|
stateHigh: "baked_batter",
|
||||||
|
stateHighColorMultiplier: 0.9,
|
||||||
|
burn:40,
|
||||||
|
burnTime:25,
|
||||||
|
burnInto:"ash",
|
||||||
|
state: "liquid",
|
||||||
|
viscosity: 10000,
|
||||||
|
density: 1001,
|
||||||
|
hidden: true,
|
||||||
|
isFood: true
|
||||||
|
};
|
||||||
|
|
||||||
elements.legacy_lattice = {
|
elements.legacy_lattice = {
|
||||||
color: "#cb4cd9",
|
color: "#cb4cd9",
|
||||||
behavior: [
|
behavior: [
|
||||||
|
|
@ -1300,7 +1406,7 @@ elements.legacy_lattice = {
|
||||||
"CL|XX|CL",
|
"CL|XX|CL",
|
||||||
],
|
],
|
||||||
hidden: true,
|
hidden: true,
|
||||||
category:"special",
|
category:"legacy",
|
||||||
excludeRandom: true
|
excludeRandom: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1352,6 +1458,37 @@ elements.left_lattice = {
|
||||||
excludeRandom: true
|
excludeRandom: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
elements.amethyst = {
|
||||||
|
color: ["#9868e0","#482888","#7848b8","#c898f0","#a878f0"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
hidden: true,
|
||||||
|
category: "powders",
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.quartz = {
|
||||||
|
color: ["#f6fff9","#f3f9f9","#f6fcf9","#fefefe","#fdfffe"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
hidden: true,
|
||||||
|
category: "powders",
|
||||||
|
tempHigh: 1900,
|
||||||
|
stateHigh: "magma",
|
||||||
|
reactions: {
|
||||||
|
"molten_iron": { elem1: "amethyst", elem2: null },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.slushy_ice = {
|
||||||
|
color: ["#f6fff9","#f3f9f9","#f6fcf9","#fefefe","#fdfffe"],
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
temp: -5,
|
||||||
|
tempHigh: 5,
|
||||||
|
stateHigh: "smashed_ice",
|
||||||
|
category: "states",
|
||||||
|
state: "solid",
|
||||||
|
density: 917,
|
||||||
|
breakInto: "smashed_ice",
|
||||||
|
};
|
||||||
|
|
||||||
elements.toorhpaste = {
|
elements.toorhpaste = {
|
||||||
color: ["#31ffe0","#65ffe8","#97ffef","#c9fff7","#f3fffd"],
|
color: ["#31ffe0","#65ffe8","#97ffef","#c9fff7","#f3fffd"],
|
||||||
behavior: behaviors.LIQUID,
|
behavior: behaviors.LIQUID,
|
||||||
|
|
@ -1428,10 +1565,17 @@ elements.algae.breakInto = "seafoam"
|
||||||
|
|
||||||
elements.battery.breakInto = "battery_acid"
|
elements.battery.breakInto = "battery_acid"
|
||||||
|
|
||||||
|
elements.art.burn = 5
|
||||||
|
elements.art.burnTime = 300
|
||||||
|
elements.art.burnInto = ["ember","charcoal","fire"]
|
||||||
|
|
||||||
|
|
||||||
elements.herb.breakInto = "seasoning"
|
elements.herb.breakInto = "seasoning"
|
||||||
|
|
||||||
elements.chocolate.breakInto = "chocolate_sauce"
|
elements.chocolate.breakInto = "chocolate_sauce"
|
||||||
|
|
||||||
|
elements.magma.stateLow = ["basalt","basalt","basalt","basalt","basalt","basalt","basalt","rock","quartz"]
|
||||||
|
|
||||||
if (!elements.bless.reactions) elements.bless.reactions = {};
|
if (!elements.bless.reactions) elements.bless.reactions = {};
|
||||||
elements.bless.reactions.mold = { elem2: null }
|
elements.bless.reactions.mold = { elem2: null }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue