Merge branch 'main' of https://github.com/R74nCom/sandboxels
This commit is contained in:
commit
4abfa43077
|
|
@ -14,7 +14,7 @@ try {
|
||||||
|
|
||||||
//ESSENTIAL COMMON FUNCTIONS (CODE LIBRARY) ##
|
//ESSENTIAL COMMON FUNCTIONS (CODE LIBRARY) ##
|
||||||
|
|
||||||
//U.R.L.
|
//URL
|
||||||
|
|
||||||
urlParams = new URLSearchParams(window.location.search);
|
urlParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
|
|
@ -616,9 +616,10 @@ try {
|
||||||
throw new Error("Offset is NaN");
|
throw new Error("Offset is NaN");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var oldColor = color; //for error display
|
||||||
color = hexToRGB(color);
|
color = hexToRGB(color);
|
||||||
if(color === null) {
|
if(color === null) {
|
||||||
throw new Error("hexToRGB(color) was null (maybe it's an invalid hex triplet?)");
|
throw new Error(`hexToRGB(color) was null (${oldColor}, maybe it's an invalid hex triplet?)`);
|
||||||
};
|
};
|
||||||
|
|
||||||
//console.log("converted color: " + JSON.stringify(color));
|
//console.log("converted color: " + JSON.stringify(color));
|
||||||
|
|
@ -772,9 +773,10 @@ try {
|
||||||
};
|
};
|
||||||
//console.log(`octothorpe checked: ${color}`);
|
//console.log(`octothorpe checked: ${color}`);
|
||||||
|
|
||||||
|
var oldColor = color;
|
||||||
color = hexToRGB(color);
|
color = hexToRGB(color);
|
||||||
if(color === null) {
|
if(color === null) {
|
||||||
throw new Error("hexToRGB(color) was null (maybe it's an invalid hex triplet?)");
|
throw new Error(`hexToRGB(color) was null (${oldColor}, maybe it's an invalid hex triplet?)`);
|
||||||
};
|
};
|
||||||
|
|
||||||
switch(outputType.toLowerCase()) {
|
switch(outputType.toLowerCase()) {
|
||||||
|
|
@ -1498,18 +1500,29 @@ try {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function breakPixel(pixel,changetemp=false) {
|
function breakPixel(pixel,changeTemp=false,defaultBreakIntoDust=false) {
|
||||||
var info = elements[pixel.element];
|
var result = elements[pixel.element].breakInto;
|
||||||
if(typeof(info.breakInto) === "undefined") {
|
if (result === undefined) {if(defaultBreakIntoDust) { result = "dust" } else { return }};
|
||||||
return false;
|
// if it is an array, choose a random item, else just use the value
|
||||||
|
while (Array.isArray(result)) {
|
||||||
|
result = randomChoice(result);
|
||||||
};
|
};
|
||||||
var breakIntoElement = info.breakInto;
|
// change the pixel to the result
|
||||||
if(Array.isArray(breakIntoElement)) {
|
if (result === null) {
|
||||||
breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)]
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
return
|
||||||
};
|
};
|
||||||
changePixel(pixel,breakIntoElement,changetemp)
|
if (elements[pixel.element].breakIntoColor) {
|
||||||
};
|
var oldelement = pixel.element;
|
||||||
|
changePixel(pixel,result);
|
||||||
|
pixel.color = pixelColorPick(pixel, elements[oldelement].breakIntoColor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
changePixel(pixel,result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultHardness = 0.3;
|
||||||
function tryBreak(pixel,changetemp=false,defaultBreakIntoDust=false) {
|
function tryBreak(pixel,changetemp=false,defaultBreakIntoDust=false) {
|
||||||
var info = elements[pixel.element];
|
var info = elements[pixel.element];
|
||||||
var hardness = defaultHardness;
|
var hardness = defaultHardness;
|
||||||
|
|
@ -2052,6 +2065,26 @@ try {
|
||||||
}*/
|
}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Language
|
||||||
|
|
||||||
|
function englishFormatList(thingsArrayIn) {
|
||||||
|
var thingsArray = thingsArrayIn;
|
||||||
|
var amount = thingsArray.length;
|
||||||
|
if(amount == 1) {
|
||||||
|
return thingsArray[0]
|
||||||
|
} else if(amount == 2) {
|
||||||
|
return thingsArray.join(" and ")
|
||||||
|
} else {
|
||||||
|
var lastItem = thingsArray[thingsArray.length - 1];
|
||||||
|
thingsArray[thingsArray.length - 1] = "and " + lastItem;
|
||||||
|
return thingsArray.join(", ")
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function capitalizeFirstLetter(string,locale=null) {
|
||||||
|
return string[0][locale ? "toLocaleUpperCase" : "toUpperCase"](locale) + string.slice(1)
|
||||||
|
};
|
||||||
|
|
||||||
//COLOR MANIPULATION TOOLS ##
|
//COLOR MANIPULATION TOOLS ##
|
||||||
|
|
||||||
var colorToolCounter = 0;
|
var colorToolCounter = 0;
|
||||||
|
|
@ -3337,7 +3370,14 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
createCategoryDiv(category);
|
createCategoryDiv(category);
|
||||||
categoryDiv = document.getElementById("category-"+category);
|
categoryDiv = document.getElementById("category-"+category);
|
||||||
}
|
}
|
||||||
createElementButton(element);
|
if(Array.isArray(elements[element].color) && elements[element].color.length == 1) {
|
||||||
|
//temporarily make the single-item array into a string just for button generation, and then turn it back into an array just in case
|
||||||
|
elements[element].color = elements[element].color[0];
|
||||||
|
createElementButton(element);
|
||||||
|
elements[element].color = [elements[element].color]
|
||||||
|
} else {
|
||||||
|
createElementButton(element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Set the first button in categoryControls div to be the current category
|
// Set the first button in categoryControls div to be the current category
|
||||||
document.getElementById("categoryControls").children[0].click()
|
document.getElementById("categoryControls").children[0].click()
|
||||||
|
|
@ -3504,6 +3544,8 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
var firstDiv = document.getElementsByClassName("category")[0];
|
var firstDiv = document.getElementsByClassName("category")[0];
|
||||||
var firstElementButton = firstDiv.getElementsByClassName("elementButton")[0];
|
var firstElementButton = firstDiv.getElementsByClassName("elementButton")[0];
|
||||||
selectElement(firstElementButton.getAttribute("element"));
|
selectElement(firstElementButton.getAttribute("element"));
|
||||||
|
|
||||||
|
gameLoaded = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3592,18 +3634,17 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
else if (damage > 0.25) {
|
else if (damage > 0.25) {
|
||||||
if (info.breakInto) {
|
if (info.breakInto) {
|
||||||
// if it is an array, choose a random item, else just use the value
|
// if it is an array, choose a random item, else just use the value
|
||||||
if (Array.isArray(info.breakInto)) {
|
if (info.breakInto !== undefined) {
|
||||||
var result = info.breakInto[Math.floor(Math.random() * info.breakInto.length)];
|
breakPixel(pixel);
|
||||||
|
} else {
|
||||||
|
if (Array.isArray(fire)) {
|
||||||
|
var newfire = fire[Math.floor(Math.random() * fire.length)];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var newfire = fire;
|
||||||
|
}
|
||||||
|
changePixel(pixel,newfire);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
var result = info.breakInto;
|
|
||||||
}
|
|
||||||
if(typeof(breakIntoElement) === "undefined") {
|
|
||||||
deletePixel(pixel.x,pixel.y);
|
|
||||||
continue
|
|
||||||
};
|
|
||||||
// change the pixel to the result
|
|
||||||
changePixel(pixel,result,changeTemp);
|
|
||||||
if(info.onExplosionBreakOrSurvive) {
|
if(info.onExplosionBreakOrSurvive) {
|
||||||
info.onExplosionBreakOrSurvive(pixel,x,y,radius,fire,smoke,power,damage);
|
info.onExplosionBreakOrSurvive(pixel,x,y,radius,fire,smoke,power,damage);
|
||||||
};
|
};
|
||||||
|
|
@ -4247,6 +4288,9 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
ignoreAir: true
|
ignoreAir: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
elements.cloner.burnTime = Infinity;
|
||||||
|
elements.cloner.burnInto = "cloner";
|
||||||
|
|
||||||
elements.cold_torch = {
|
elements.cold_torch = {
|
||||||
"color": "#4394d6",
|
"color": "#4394d6",
|
||||||
"behavior": [
|
"behavior": [
|
||||||
|
|
@ -7949,7 +7993,7 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
behavior: behaviors.GAS,
|
behavior: behaviors.GAS,
|
||||||
category: "gases",
|
category: "gases",
|
||||||
state: "gas",
|
state: "gas",
|
||||||
density: 550,
|
density: 550, //7989 yay soshi!
|
||||||
tick: function(pixel) {
|
tick: function(pixel) {
|
||||||
if(pixel.y % 6 == 0) {
|
if(pixel.y % 6 == 0) {
|
||||||
if(pixel.x % 6 == 0) {
|
if(pixel.x % 6 == 0) {
|
||||||
|
|
@ -8019,7 +8063,7 @@ color1 and color2 spread through striped paint like dye does with itself. <u>col
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!settings.bg || settings.bg == "#fffff0") { //7989 yay soshi!
|
if(!settings.bg || settings.bg == "#fffff0") {
|
||||||
pixel.color = "rgb(255,255,247)"
|
pixel.color = "rgb(255,255,247)"
|
||||||
} else {
|
} else {
|
||||||
pixel.color = "rgb(255,255,240)"
|
pixel.color = "rgb(255,255,240)"
|
||||||
|
|
@ -18083,7 +18127,81 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
|
||||||
elements[kesddfroged2[i]].reactions ??= {}; elements[kesddfroged2[i]].reactions[kesddfroged[j]] = {"elem1": "kurshuth_alloy", "elem2": "kurshuth_alloy"}
|
elements[kesddfroged2[i]].reactions ??= {}; elements[kesddfroged2[i]].reactions[kesddfroged[j]] = {"elem1": "kurshuth_alloy", "elem2": "kurshuth_alloy"}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
|
|
||||||
|
function newMetal(name,color,meltingPoint,boilingPoint,hardness,density,gasDensity,conduct,categoryOverride = null) {
|
||||||
|
var temp = {
|
||||||
|
"name": name,
|
||||||
|
"color": color,
|
||||||
|
"meltingPoint": meltingPoint,
|
||||||
|
"boilingPoint": boilingPoint,
|
||||||
|
"hardness": hardness,
|
||||||
|
"density": density,
|
||||||
|
"gasDensity": gasDensity,
|
||||||
|
"conduct": conduct
|
||||||
|
};
|
||||||
|
var tempNulls = Object.keys(temp).filter(key => (typeof(temp[key]) == undefined || temp[key] == null));
|
||||||
|
if(tempNulls.length > 0) {
|
||||||
|
var errorMessage = capitalizeFirstLetter(englishFormatList(tempNulls));
|
||||||
|
throw new Error(`newMetal: ${errorMessage} {tempNulls.length == 1 ? "is" : "are"} required (generating "${name}")`);
|
||||||
|
};
|
||||||
|
|
||||||
|
var scrapColor = gravelizeToHex(color);
|
||||||
|
|
||||||
|
elements[name] = {
|
||||||
|
"color": (window["gameLoaded"] ?? false) ? (Array.isArray(color) ? color.map(x => convertColorFormats(x,"rgb")) : convertColorFormats(color,"rgb")) : color,
|
||||||
|
"colorObject": (window["gameLoaded"] ?? false) ? (Array.isArray(color) ? color.map(x => convertColorFormats(x,"json")) : convertColorFormats(color,"json")) : undefined,
|
||||||
|
"behavior": behaviors.WALL,
|
||||||
|
"category": "solids",
|
||||||
|
"state": "solid",
|
||||||
|
"density": density,
|
||||||
|
"conduct": conduct,
|
||||||
|
"tempHigh": meltingPoint,
|
||||||
|
"breakInto": `${name}_scrap`,
|
||||||
|
"hardness": hardness
|
||||||
|
};
|
||||||
|
|
||||||
|
if(categoryOverride) { elements[name].category = categoryOverride };
|
||||||
|
|
||||||
|
elements[`molten_${name}`] = {
|
||||||
|
"tempHigh": boilingPoint
|
||||||
|
};
|
||||||
|
|
||||||
|
elements[`${name}_gas`] = {
|
||||||
|
"density": gasDensity
|
||||||
|
};
|
||||||
|
|
||||||
|
elements[`${name}_scrap`] = {
|
||||||
|
"color": (window["gameLoaded"] ?? false) ? (Array.isArray(scrapColor) ? scrapColor.map(x => convertColorFormats(x,"rgb")) : convertColorFormats(scrapColor,"rgb")) : scrapColor,
|
||||||
|
"colorObject": (window["gameLoaded"] ?? false) ? (Array.isArray(scrapColor) ? scrapColor.map(x => convertColorFormats(x,"json")) : convertColorFormats(scrapColor,"json")) : undefined,
|
||||||
|
"behavior": (window["gameLoaded"] ?? false) ? undefined : behaviors.POWDER,
|
||||||
|
"tick": (window["gameLoaded"] ?? false) ? behaviors.POWDER : undefined,
|
||||||
|
"tempHigh": meltingPoint,
|
||||||
|
"stateHigh": `molten_${name}`,
|
||||||
|
"category": "powders",
|
||||||
|
"hidden": true,
|
||||||
|
"density": density * 0.09,
|
||||||
|
"conduct": conduct * 0.4,
|
||||||
|
"movable": true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if(window["gameLoaded"] ?? false) {
|
||||||
|
delete elements[`${name}_scrap`].behavior;
|
||||||
|
createElementButton(name);
|
||||||
|
if(settings.unhide == 1) { createElementButton(`${name}_scrap`) }
|
||||||
|
autoGen(`molten_${name}`,name,"molten");
|
||||||
|
elements[`molten_${name}`].color = elements[`molten_${name}`].color.map(x => convertColorFormats(x,"rgb"));
|
||||||
|
elements[`molten_${name}`].colorObject = elements[`molten_${name}`].color.map(x => convertColorFormats(x,"json"));
|
||||||
|
} else {
|
||||||
|
delete elements[`${name}_scrap`].tick;
|
||||||
|
};
|
||||||
|
|
||||||
|
return [elements[name],elements[`${name}_scrap`]];
|
||||||
|
};
|
||||||
|
|
||||||
|
//newMetal( "exidmaden", ["#F8EDCF", "#EEAAAE", "#E5678D", "#A6659C", "#6763AD"], 2134, 6769, 0.8, 32333, 49.9, 0.88 );
|
||||||
|
//newMetal( "jisooium", "#9d0ac2", 8367, 10003, 0.63, 15024, 12.2, 0.9 );
|
||||||
|
//newMetal( "twicium", ["#F9C596", "#FC5D9D"], 10240, 18018, 0.88, 29029, 24.3, 0.91 );
|
||||||
|
|
||||||
//ASSORTED LOONA-THEMED MATERIALS ##
|
//ASSORTED LOONA-THEMED MATERIALS ##
|
||||||
|
|
||||||
|
|
@ -20401,7 +20519,7 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
|
||||||
if(typeof(elements[thing]) == "object") {
|
if(typeof(elements[thing]) == "object") {
|
||||||
if(typeof(elements[thing]?.breakInto) == "undefined") {
|
if(typeof(elements[thing]?.breakInto) == "undefined") {
|
||||||
elements[`${thing}_scrap`] = {
|
elements[`${thing}_scrap`] = {
|
||||||
color: elements[thing].color,
|
color: gravelizeToHex(elements[thing].color),
|
||||||
behavior: behaviors.POWDER,
|
behavior: behaviors.POWDER,
|
||||||
tempHigh: elements[thing].tempHigh,
|
tempHigh: elements[thing].tempHigh,
|
||||||
stateHigh: thing,
|
stateHigh: thing,
|
||||||
|
|
@ -21214,13 +21332,14 @@ Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut o
|
||||||
//Gravels
|
//Gravels
|
||||||
|
|
||||||
function gravelizeToHex(colorIn) {
|
function gravelizeToHex(colorIn) {
|
||||||
//console.log("gravelizeToHex called",colorIn);
|
|
||||||
var colorInput = colorIn; //side effects?
|
var colorInput = colorIn; //side effects?
|
||||||
|
//console.log(`gravelizeToHex: ${colorInput}`)
|
||||||
|
|
||||||
//make sure in is array
|
//make sure in is array
|
||||||
if(!colorInput instanceof Array) {
|
if(!(colorInput instanceof Array)) {
|
||||||
colorInput = [colorInput];
|
colorInput = [colorInput];
|
||||||
};
|
};
|
||||||
|
//console.log(`gravelizeToHex: ${colorInput}`)
|
||||||
|
|
||||||
//console.log(colorInput);
|
//console.log(colorInput);
|
||||||
|
|
||||||
|
|
@ -29551,29 +29670,6 @@ Make sure to save your command in a file if you want to add this preset again.`
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function breakPixel(pixel,changetemp=false,defaultBreakIntoDust=false) {
|
|
||||||
var info = elements[pixel.element];
|
|
||||||
if(typeof(info.breakInto) === "undefined") {
|
|
||||||
if(defaultBreakIntoDust) {
|
|
||||||
if(Math.random() < defaultBreakIntoDust) { changePixel(pixel,"dust",changetemp) };
|
|
||||||
};
|
|
||||||
return defaultBreakIntoDust;
|
|
||||||
};
|
|
||||||
var breakIntoElement = info.breakInto;
|
|
||||||
if(Array.isArray(breakIntoElement)) {
|
|
||||||
breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)]
|
|
||||||
};
|
|
||||||
if(breakIntoElement === null) {
|
|
||||||
deletePixel(pixel.x,pixel.y);
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
if(typeof(breakIntoElement) === "undefined") { return false };
|
|
||||||
changePixel(pixel,breakIntoElement,changetemp)
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultHardness = 0.3;
|
|
||||||
|
|
||||||
function arrowAltTb(pixel,breakChanceMultiplier,changetemp=false,defaultBreakIntoDust=false) {
|
function arrowAltTb(pixel,breakChanceMultiplier,changetemp=false,defaultBreakIntoDust=false) {
|
||||||
var info = elements[pixel.element];
|
var info = elements[pixel.element];
|
||||||
var hardness = defaultHardness;
|
var hardness = defaultHardness;
|
||||||
|
|
@ -35591,7 +35687,16 @@ Make sure to save your command in a file if you want to add this preset again.`
|
||||||
//water reaction steal
|
//water reaction steal
|
||||||
if(elements[newPixel.element].reactions?.water) {
|
if(elements[newPixel.element].reactions?.water) {
|
||||||
var waterRxn = elements[newPixel.element].reactions.water;
|
var waterRxn = elements[newPixel.element].reactions.water;
|
||||||
var elem2 = waterRxn.elem2;
|
var elem1 = waterRxn.elem1;
|
||||||
|
while(Array.isArray(elem1)) {
|
||||||
|
elem1 = randomChoice(elem1)
|
||||||
|
};
|
||||||
|
if(elem1 !== null) {
|
||||||
|
changePixel(newPixel,elem1,true)
|
||||||
|
}
|
||||||
|
} else if(elements.water.reactions[newPixel.element]) {
|
||||||
|
var waterRxn2 = elements.water.reactions[newPixel.element];
|
||||||
|
elem2 = waterRxn2.elem2;
|
||||||
while(Array.isArray(elem2)) {
|
while(Array.isArray(elem2)) {
|
||||||
elem2 = randomChoice(elem2)
|
elem2 = randomChoice(elem2)
|
||||||
};
|
};
|
||||||
|
|
@ -35603,7 +35708,7 @@ Make sure to save your command in a file if you want to add this preset again.`
|
||||||
//add velocity;
|
//add velocity;
|
||||||
newPixel.vx ??= 0;
|
newPixel.vx ??= 0;
|
||||||
newPixel.vy ??= 0;
|
newPixel.vy ??= 0;
|
||||||
newPixel.vx += (pixel.direction * 6)
|
newPixel.vx += (pixel.direction * 5)
|
||||||
newPixel.vy += 3;
|
newPixel.vy += 3;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -35614,6 +35719,92 @@ Make sure to save your command in a file if you want to add this preset again.`
|
||||||
density: elements.water.density
|
density: elements.water.density
|
||||||
};
|
};
|
||||||
|
|
||||||
|
elements.megatsunami = {
|
||||||
|
color: ["#1f2aa3","#2641c9","#3a57c9"],
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
properties: {
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
tick: function(pixel) {
|
||||||
|
//Iteration initial checks
|
||||||
|
if(!pixel) {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
if(!pixel.active) {
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Initial property-setting
|
||||||
|
var pixelIsOnLeft = (pixel.x < (width/2));
|
||||||
|
pixel.fromX ??= pixelIsOnLeft ? 1 : width - 1;
|
||||||
|
pixel.direction ??= pixelIsOnLeft ? 1 : -1;
|
||||||
|
|
||||||
|
var floorHeight = pixel.y + 1;
|
||||||
|
while(isEmpty(pixel.x,floorHeight,false)) {
|
||||||
|
floorHeight++
|
||||||
|
};
|
||||||
|
pixel.floorHeight ??= floorHeight;
|
||||||
|
|
||||||
|
//Actual doer code
|
||||||
|
var bottomY = (pixel.floorHeight + 9); //extend 10 pixels below
|
||||||
|
var topY = bottomY - 43; //topY < bottomY because in this game +Y is *downward*
|
||||||
|
for(var h = 0; h < 2; h++) {
|
||||||
|
var newX = pixel.fromX + pixel.direction;
|
||||||
|
|
||||||
|
if(outOfBounds(newX,1)) {
|
||||||
|
pixel.active = false;
|
||||||
|
return
|
||||||
|
};
|
||||||
|
|
||||||
|
for(var i = bottomY; i >= topY; i--) {
|
||||||
|
var waterToDo = randomChoice(["salt_water","salt_water","salt_water","dirty_water","dirty_water"]);
|
||||||
|
var fc = {x: newX, y: i};
|
||||||
|
if(outOfBounds(fc.x,fc.y)) {continue};
|
||||||
|
if(isEmpty(fc.x,fc.y,false)) {
|
||||||
|
//fill with water
|
||||||
|
createPixel(waterToDo,fc.x,fc.y)
|
||||||
|
} else {
|
||||||
|
var newPixel = pixelMap[fc.x]?.[fc.y];
|
||||||
|
if(!newPixel) { continue };
|
||||||
|
//break
|
||||||
|
tryBreak(newPixel,true,true);
|
||||||
|
if(!newPixel) { continue };
|
||||||
|
//water reaction steal
|
||||||
|
if(elements[newPixel.element].reactions?.water) {
|
||||||
|
var waterRxn = elements[newPixel.element].reactions.water;
|
||||||
|
var elem1 = waterRxn.elem1;
|
||||||
|
while(Array.isArray(elem1)) {
|
||||||
|
elem1 = randomChoice(elem1)
|
||||||
|
};
|
||||||
|
if(elem1 !== null) {
|
||||||
|
changePixel(newPixel,elem1,true)
|
||||||
|
}
|
||||||
|
} else if(elements.water.reactions[newPixel.element]) {
|
||||||
|
var waterRxn2 = elements.water.reactions[newPixel.element];
|
||||||
|
elem2 = waterRxn2.elem2;
|
||||||
|
while(Array.isArray(elem2)) {
|
||||||
|
elem2 = randomChoice(elem2)
|
||||||
|
};
|
||||||
|
if(elem2 !== null) {
|
||||||
|
changePixel(newPixel,elem2,true)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(!newPixel) { continue };
|
||||||
|
//add velocity;
|
||||||
|
newPixel.vx ??= 0;
|
||||||
|
newPixel.vy ??= 0;
|
||||||
|
newPixel.vx += (pixel.direction * 13)
|
||||||
|
newPixel.vy += 6;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
pixel.fromX += pixel.direction
|
||||||
|
};
|
||||||
|
},
|
||||||
|
state: "solid",
|
||||||
|
category: "special",
|
||||||
|
density: elements.water.density
|
||||||
|
};
|
||||||
|
|
||||||
elements.lava_tsunami = {
|
elements.lava_tsunami = {
|
||||||
color: ["#ff370a","#e84a23","#e67740"],
|
color: ["#ff370a","#e84a23","#e67740"],
|
||||||
behavior: behaviors.WALL,
|
behavior: behaviors.WALL,
|
||||||
|
|
|
||||||
|
|
@ -70,4 +70,4 @@ elements.left_filler = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elements.filler.category = "fillers"
|
elements.filler.category = "fillers"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
for (var element in elements) {
|
||||||
|
elements[element].stain = 0.1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// sorry alice
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
elements.cat = {
|
||||||
|
color: "#b08b05",
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|XX",
|
||||||
|
"M2%25|XX|M2%25",
|
||||||
|
"XX|M1|XX",
|
||||||
|
],
|
||||||
|
category: "weapons",
|
||||||
|
state: "solid",
|
||||||
|
desc: "HOLY SHIT ITS GOING TO KILL M- oh wait its just a cute kitty"
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.the_hot_destroyer = {
|
||||||
|
color: "#ff0000",
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "weapons",
|
||||||
|
state: "solid",
|
||||||
|
desc: "literally just is super hot, destroys anything that can be melted",
|
||||||
|
temp: Infinity,
|
||||||
|
reactions: {
|
||||||
|
"the_cold_destroyer": {elem1: null, elem2: null}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.the_cold_destroyer = {
|
||||||
|
color: "#00ccff",
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "weapons",
|
||||||
|
state: "solid",
|
||||||
|
desc: "literally just is super cold, freezes anything that can be frozen",
|
||||||
|
temp: -Infinity,
|
||||||
|
reactions: {
|
||||||
|
"the_hot_destroyer": {elem1: null, elem2: null}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.plutoneeum = {
|
||||||
|
color: ["#38a30e", "#0d662b", "#5d995d"],
|
||||||
|
behavior: behaviors.RADPOWDER,
|
||||||
|
category: "powders",
|
||||||
|
state: "solid",
|
||||||
|
desc: "misspelled on purpose to avoid conflicts with other mods",
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.lipstick = {
|
||||||
|
color: "#a30000",
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
category: "liquids",
|
||||||
|
state: "liquid",
|
||||||
|
viscosity: 650,
|
||||||
|
stain: 30,
|
||||||
|
tempHigh: 100,
|
||||||
|
stateHigh: "steam",
|
||||||
|
desc: "this mod is meant to have a description to everything but i don't know what to put here... its lipstick i guess?"
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.very_hot_gold = {
|
||||||
|
color: ["#fff0b5","#986a1a","#f0bb62"],
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
category: "solids",
|
||||||
|
density: 19300,
|
||||||
|
conduct: 0.81,
|
||||||
|
hardness: 0.25,
|
||||||
|
breakInto: "gold_coin",
|
||||||
|
temp: Infinity,
|
||||||
|
desc: "i'm running out of ideas, have this i guess"
|
||||||
|
};
|
||||||
|
|
||||||
|
// bro what else do i put here
|
||||||
|
|
@ -0,0 +1,253 @@
|
||||||
|
elements.lemon = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
color: ["#ffaa1d","#ffd300","#ffdf00","#ffff00","#fff44f"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "food",
|
||||||
|
state: "solid",
|
||||||
|
breakInto: "lemonade",
|
||||||
|
tempHigh: 256,
|
||||||
|
stateHigh: "steam",
|
||||||
|
reactions: {
|
||||||
|
"sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#ffffd8","#fffecf"] },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.lemonade = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
tempHigh: 150,
|
||||||
|
stateHigh: "steam",
|
||||||
|
tempMin: -15,
|
||||||
|
color: ["#f8ff80","#f6ff6c","#f5ff57","#f3ff39","#f0ff00"],
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
category: "liquids",
|
||||||
|
state: "liquid",
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.uranium_tea = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
viscosity: 1000,
|
||||||
|
tempHigh: 1100,
|
||||||
|
stateHigh: ["molten_uranium", "steam", "fragrance", "null"],
|
||||||
|
color: ["#943e04", "#aa7a20", "#806612"],
|
||||||
|
behavior: behaviors.RADLIQUID,
|
||||||
|
category: "liquids",
|
||||||
|
state: "liquid",
|
||||||
|
reactions: {
|
||||||
|
"neutron": { elem1:"n_explosion", tempMin:500, chance:0.1 }
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.sned = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
desc: "slowly expanding...",
|
||||||
|
color: "#dfe0d9",
|
||||||
|
behavior: [
|
||||||
|
"XX|XX AND CR:sned%1|XX",
|
||||||
|
"M2 AND CR:sned%1|XX|M2 AND CR:sned%1",
|
||||||
|
"M1|M1 AND CH:sned%1|M1",
|
||||||
|
],
|
||||||
|
category: "joke",
|
||||||
|
state: "liquid",
|
||||||
|
excludeRandom: true
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.uranium_coffee = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},color: "#24100b",
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
reactions: {
|
||||||
|
"stench": { elem2:null },
|
||||||
|
"oxygen": { elem2:"fragrance", chance:0.01 },
|
||||||
|
"sugar": { elem2:null, color1:"#99552A", chance:0.005},
|
||||||
|
"honey": { elem2:null, color1:"#99552A", chance:0.005},
|
||||||
|
"milk": { elem2:"foam", color1:"#CA9D68", chance:0.005},
|
||||||
|
"nut_milk": { elem2:"foam", color1:"#CA9D68", chance:0.005},
|
||||||
|
"cream": { elem2:"foam", color1:"#CA9D68", chance:0.005},
|
||||||
|
"ice_cream": { elem2:null, color1:"#CA9D68", chance:0.005},
|
||||||
|
"chocolate": { elem2:null, color1:"#6A3517", chance:0.005},
|
||||||
|
"melted_chocolate": { elem2:null, color1:"#6A3517", chance:0.005},
|
||||||
|
"water": { elem2:"coffee", tempMin:70, chance:0.2 },
|
||||||
|
"salt_water": { elem2:"coffee", tempMin:70, chance:0.2 },
|
||||||
|
"sugar_water": { elem2:"melted_uranium", tempMin:60, chance:0.3 },
|
||||||
|
"seltzer": { elem2:"coffee", tempMin:70, chance:0.2 },
|
||||||
|
"neutron": { elem1:"n_explosion", tempMin:500, chance:0.1 }
|
||||||
|
},
|
||||||
|
tempHigh: 130,
|
||||||
|
stateHigh: ["steam","fragrance","molten_uranium",null],
|
||||||
|
tempLow: 0,
|
||||||
|
category:"liquids",
|
||||||
|
state: "liquid",
|
||||||
|
density: 1001.74,
|
||||||
|
stain: 0.01,
|
||||||
|
hidden: true,
|
||||||
|
isFood: true
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.uranium_soda = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
color: "#19ad19",
|
||||||
|
behavior: [
|
||||||
|
"XX|CR:foam%2|XX",
|
||||||
|
"M2|XX|M2",
|
||||||
|
"M2|M1|M2",
|
||||||
|
],
|
||||||
|
tempHigh: 100,
|
||||||
|
stateHigh: ["steam","carbon_dioxide","molten_uranium"],
|
||||||
|
tempLow: -1.11,
|
||||||
|
category: "liquids",
|
||||||
|
reactions: {
|
||||||
|
"dirt": { elem1: null, elem2: "fallout" },
|
||||||
|
"sand": { elem1: null, elem2: "fallout" },
|
||||||
|
"clay_soil": { elem1: null, elem2: "fallout" },
|
||||||
|
"rock": { elem2: "fallout", chance: 0.0004 },
|
||||||
|
"water": { elem1: "uranium", elem2: "uranium" },
|
||||||
|
"salt": { elem2:"foam", chance:0.05 },
|
||||||
|
"salt_water": { elem2:"foam", chance:0.01 },
|
||||||
|
"sugar": { elem2:"foam", chance:0.001 },
|
||||||
|
"candy": { elem2:"foam", chance:0.01 },
|
||||||
|
"caramel": { elem2:"foam", chance:0.01 },
|
||||||
|
"rust": { elem2:"fallout", chance:0.01 },
|
||||||
|
"oxidized_copper": { elem2:"fallout", chance:0.01 },
|
||||||
|
"neutron": { elem1:"n_explosion", tempMin:500, chance:0.1 }
|
||||||
|
},
|
||||||
|
state: "liquid",
|
||||||
|
density: 1030,
|
||||||
|
isFood: true
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.uranium_juice = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
color: "#84dd84",
|
||||||
|
behavior: behaviors.RADLIQUID,
|
||||||
|
reactions: {
|
||||||
|
"dirt": { elem1: null, elem2: "fallout" },
|
||||||
|
"sand": { elem1: null, elem2: "fallout" },
|
||||||
|
"clay_soil": { elem1: null, elem2: "fallout" },
|
||||||
|
"seltzer": { elem1: "uranium_soda", elem2: "foam" },
|
||||||
|
"carbon_dioxide": { elem1: "uranium_soda", elem2: "foam" },
|
||||||
|
"neutron": { elem1:"n_explosion", tempMin:500, chance:0.1 }
|
||||||
|
},
|
||||||
|
tempHigh: 160,
|
||||||
|
stateHigh: ["steam","molten_uranium"],
|
||||||
|
tempLow: -10,
|
||||||
|
stateLowColorMultiplier: 1.1,
|
||||||
|
category: "liquids",
|
||||||
|
state: "liquid",
|
||||||
|
density: 1054,
|
||||||
|
stain: 0.05,
|
||||||
|
isFood: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.plutonium_tea = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
viscosity: 1100,
|
||||||
|
tempHigh: 1000,
|
||||||
|
stateHigh: ["fragrance", "null"],
|
||||||
|
color: ["#795508", "#828b09"],
|
||||||
|
behavior: behaviors.RADLIQUID,
|
||||||
|
category: "liquids",
|
||||||
|
state: "liquid",
|
||||||
|
tempLow: 0,
|
||||||
|
stateLow: "plutonium"
|
||||||
|
};
|
||||||
|
// mrapples stuffs
|
||||||
|
elements.plutonium = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
color: ["#38a30e", "#0d662b", "#5d995d"],
|
||||||
|
behavior: behaviors.RADPOWDER,
|
||||||
|
category: "powders",
|
||||||
|
state: "solid",
|
||||||
|
tempHigh: 100,
|
||||||
|
stateHigh: "plutonium_tea"
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.your_dad = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
color: "#000000",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
category: "joke",
|
||||||
|
state: "solid",
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|XX",
|
||||||
|
"XX|DL|XX",
|
||||||
|
"XX|XX|XX"
|
||||||
|
],
|
||||||
|
canPlace: false, // exists: false
|
||||||
|
};
|
||||||
|
|
||||||
|
// end of mrapples stuffs
|
||||||
|
|
||||||
|
elements.how_the_fuck_did_you_burn_the_water = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
color: "#18202c",
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
category: "joke",
|
||||||
|
hidden: true,
|
||||||
|
alias: "SANS HOW THE FUCK DID YOU BURN THE WATER?",
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.theres_a_bomb_strapped_to_my_chest = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
color: "#b42020",
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|XX",
|
||||||
|
"XX|EX:15>explosion|XX", // let me finish
|
||||||
|
"XX|XX|XX",
|
||||||
|
],
|
||||||
|
category: "joke",
|
||||||
|
hidden: true,
|
||||||
|
burn: 100,
|
||||||
|
burnTime: 1,
|
||||||
|
burnInto: "explosion",
|
||||||
|
tempHigh: 600,
|
||||||
|
stateHigh: "explosion",
|
||||||
|
state: "solid",
|
||||||
|
density: 1630,
|
||||||
|
excludeRandom: true,
|
||||||
|
alias: "ITS GOING TO EXPLODE IN THREE SECON-",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!elements.uranium.reactions) elements.uranium.reactions = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
elements.uranium.reactions.herbs = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
}, elem1: "uranium_tea", elem2: null, chance: 20 }
|
||||||
|
elements.uranium.reactions.coffee_ground = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
}, elem1: "uranium_coffee", elem2: null, chance: 30 }
|
||||||
|
elements.uranium.reactions.seltzer = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
}, elem2: "uranium_soda", elem2: null, chance: 30 }
|
||||||
|
elements.uranium.reactions.juice = {
|
||||||
|
onSelect: function() {
|
||||||
|
logMessage("Mod made by mrapple, ilikepizza and stefanblox");
|
||||||
|
}, elem1: "uranium_juice", elem2: null, chance: 30 }
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
elements.argon = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.GAS,
|
||||||
|
colorOn: ["#c831ee","#d683eb","#7a258f"],
|
||||||
|
category: "gases",
|
||||||
|
state: "gas",
|
||||||
|
tempLow: -185.8,
|
||||||
|
stateLow: "liquid_argon",
|
||||||
|
density: 1.784,
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
|
elements.liquid_argon = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
colorOn: ["#c831ee","#d683eb","#7a258f"],
|
||||||
|
category: "states",
|
||||||
|
state: "liquid",
|
||||||
|
tempHigh: -183.8,
|
||||||
|
stateHigh: "argon",
|
||||||
|
density: 1401,
|
||||||
|
tempLow: -189.3,
|
||||||
|
stateLow: "frozen_argon",
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
|
elements.frozen_argon = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
colorOn: ["#c831ee","#d683eb","#7a258f"],
|
||||||
|
category: "states",
|
||||||
|
state: "solid",
|
||||||
|
tempHigh: -187.3,
|
||||||
|
stateHigh: "liquid_argon",
|
||||||
|
density: 1616,
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
|
elements.krypton = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.GAS,
|
||||||
|
colorOn: ["#c49dce","#ac8ab4","#715579"],
|
||||||
|
category: "gases",
|
||||||
|
state: "gas",
|
||||||
|
tempLow: -153.22,
|
||||||
|
stateLow: "liquid_krypton",
|
||||||
|
density: 3.75,
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
|
elements.liquid_krypton = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
colorOn: ["#c49dce","#ac8ab4","#715579"],
|
||||||
|
category: "states",
|
||||||
|
state: "liquid",
|
||||||
|
tempHigh: -150.22,
|
||||||
|
stateHigh: "krypton",
|
||||||
|
density: 2423,
|
||||||
|
tempLow: -157.36,
|
||||||
|
stateLow: "frozen_krypton",
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
|
elements.frozen_krypton = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
colorOn: ["#c49dce","#ac8ab4","#715579"],
|
||||||
|
category: "states",
|
||||||
|
state: "solid",
|
||||||
|
tempHigh: -154.36,
|
||||||
|
stateHigh: "liquid_krypton",
|
||||||
|
density: 2160,
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
|
elements.xenon = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.GAS,
|
||||||
|
colorOn: ["#627eca","#4572d3","#333cb1"],
|
||||||
|
category: "gases",
|
||||||
|
state: "gas",
|
||||||
|
tempLow: -108,
|
||||||
|
stateLow: "liquid_xenon",
|
||||||
|
density: 5.9,
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
|
elements.liquid_xenon = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
colorOn: ["#627eca","#4572d3","#333cb1"],
|
||||||
|
category: "states",
|
||||||
|
state: "liquid",
|
||||||
|
tempHigh: -104,
|
||||||
|
stateHigh: "xenon",
|
||||||
|
density: 2948,
|
||||||
|
tempLow: -111.8,
|
||||||
|
stateLow: "frozen_xenon",
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
|
elements.frozen_xenon = {
|
||||||
|
color: elements.neon.color,
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
colorOn: ["#627eca","#4572d3","#333cb1"],
|
||||||
|
category: "states",
|
||||||
|
state: "solid",
|
||||||
|
tempHigh: -109.8,
|
||||||
|
stateHigh: "liquid_xenon",
|
||||||
|
density: 3410,
|
||||||
|
conduct: 0.8
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue