This commit is contained in:
slweeb 2022-02-04 20:01:17 -05:00
commit 050f31d645
11 changed files with 354024 additions and 1881 deletions

View File

@ -1,4 +0,0 @@
function pepe (pepe1: string, pepe2: boolean, pepe3: number) {
pepe("pepe", true, 100)
}
elements={}

View File

@ -919,6 +919,27 @@ behavior: [
"EX:10>explosion5|EX:10>explosion5|EX:10>explosion5",
],
};
elements.carbon = {
color: "#424242",
category: "solids",
state: "solid",
behavior: behaviors.WALL,
burn: 5,
burnTime: 3000,
burnInto: ["carbon", "carbon_dioxide"],
stateHigh: "molten_carbon",
tempHigh: 3550,
};
elements.molten_carbon = {
color: ["#eda92b", "#f0af37", "#f5bb51", "#f5d151", "#fce697", "#fff4cf"],
category: "liquids",
state: "liquid",
behavior: behaviors.LIQUID,
stateLow: "carbon",
tempLow: 3550,
temp: 5000,
density: 1.2,
};
/* Unfinished:
magnesium
hematite mixture

352316
mods/elem3.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

816
mods/m345678.js Normal file
View File

@ -0,0 +1,816 @@
function pixelTickMod1(pixel) {
if (pixel.start === pixelTicks) {return}
var info = elements[pixel.element];
if (pixel.charge && info.behaviorOn) { var behavior = info.behaviorOn; }
else { var behavior = info.behavior; }
if (pixel.flipX) { behavior = flipBehavior(behavior,"x"); }
if (pixel.flipY) { behavior = flipBehavior(behavior,"y"); }
if (pixel.r) { behavior = rotateBehavior(behavior,pixel.r); }
var x = pixel.x;
var y = pixel.y;
var move1Spots = [];
var move2Spots = [];
var move3Spots = [];
var move4Spots = [];
var move5Spots = [];
var move6Spots = [];
var move7Spots = [];
var move8Spots = [];
var supportSpots = [];
var swapSpots = [];
var leaveBehind = null;
var leaveBehind1 = null;
var leaveBehind2 = null;
var leaveBehind3 = null;
var leaveBehind4 = null;
var leaveBehind5 = null;
var leaveBehind6 = null;
var leaveBehind7 = null;
var leaveBehind8 = null;
var move = true;
// Parse behavior
for (var by = 0; by < behavior.length; by++) {
var behaviorby = behavior[by];
for (var bx = 0; bx < behaviorby.length; bx++) {
var b0 = behaviorby[bx];
if (b0 === "XX") {continue}
//if (b.includes(" OR ")) {
// b = b.split(" OR ")[Math.floor(Math.random()*b.split(" OR ").length)];
//}
// Loop through b0.split(" AND ")
if (b0.includes(" AND ")) { var andsplit = b0.split(" AND "); }
else { var andsplit = [b0]; }
for (var i = 0; i < andsplit.length; i++) {
var b = andsplit[i];
if (b.includes(":")) {
var arg = b.split(":")[1].split(/[\:\%]/)[0];
if (!b.includes("%")) {
b = b.split(/[\:\%]/)[0];
}
}
else { var arg = null;}
// If b has "%" followed by a number in it, it's a chance to move
if (b.includes("%")) {
// Split the string at the "%" and use the second half as the chance (float)
var chance = parseFloat(b.split("%")[1]);
//console.log(b+": "+(Math.random()*100 < chance));
b = b.split(/[\:\%]/)[0];
}
else { var chance = 100; }
if (chance==100 || Math.random()*100 < chance) {
var newCoords = behaviorCoords(x,y,bx,by);
if (b == "M1") {
if (info.viscosity != undefined) {
if (!((Math.random()*100) < 100 / ((info.viscosity) ** 0.25))) {
newCoords.x = x;
}
}
move1Spots.push(newCoords);
}
else if (b == "M2") {
if (info.viscosity != undefined) {
if (!((Math.random()*100) < 100 / ((info.viscosity) ** 0.25))) {
newCoords.x = x;
}
}
move2Spots.push(newCoords);
}
else if (b == "M3") {
if (info.viscosity != undefined) {
if (!((Math.random()*100) < 100 / ((info.viscosity) ** 0.25))) {
newCoords.x = x;
}
}
move3Spots.push(newCoords);
}
else if (b == "M4") {
if (info.viscosity != undefined) {
if (!((Math.random()*100) < 100 / ((info.viscosity) ** 0.25))) {
newCoords.x = x;
}
}
move4Spots.push(newCoords);
}
else if (b == "M5") {
if (info.viscosity != undefined) {
if (!((Math.random()*100) < 100 / ((info.viscosity) ** 0.25))) {
newCoords.x = x;
}
}
move5Spots.push(newCoords);
}
else if (b == "M6") {
if (info.viscosity != undefined) {
if (!((Math.random()*100) < 100 / ((info.viscosity) ** 0.25))) {
newCoords.x = x;
}
}
move6Spots.push(newCoords);
}
else if (b == "M7") {
if (info.viscosity != undefined) {
if (!((Math.random()*100) < 100 / ((info.viscosity) ** 0.25))) {
newCoords.x = x;
}
}
move7Spots.push(newCoords);
}
else if (b == "M8") {
if (info.viscosity != undefined) {
if (!((Math.random()*100) < 100 / ((info.viscosity) ** 0.25))) {
newCoords.x = x;
}
}
move8Spots.push(newCoords);
}
else if (b == "SP") {
supportSpots.push({x:newCoords.x,y:newCoords.y,arg:arg});
}
else if (b == "SA") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
move = false;
}
}
else if (b == "DL") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
// if the pixel at newCoords is the same element as the pixel, ignore
newPixel = pixelMap[newCoords.x][newCoords.y];
// if info.ignore exists and newPixel.element is in it
if (info.ignore && info.ignore.includes(newPixel.element)) {
continue;
}
if ((!(newPixel.element == pixel.element)) || (newCoords.x == x && newCoords.y == y)) {
if (arg != null) { var args = arg.split(","); }
if (arg == null || args.includes(newPixel.element)) {
if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness) {
deletePixel(newCoords.x,newCoords.y);
if (newCoords.x == x && newCoords.y == y) {
var deleted = true;
}
swapSpots = [];
}
}
}
}
}
else if (b == "DB") { // Delete Both
if (!isEmpty(newCoords.x,newCoords.y,true)) {
// if the pixel at newCoords is the same element as the pixel, ignore
newPixel = pixelMap[newCoords.x][newCoords.y];
// if info.ignore exists and newPixel.element is in it
if (info.ignore && info.ignore.includes(newPixel.element)) {
continue;
}
if (!(newPixel.element == pixel.element)) {
if (arg != null) { var args = arg.split(","); }
if (arg == null || args.includes(newPixel.element)) {
if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness) {
deletePixel(newCoords.x,newCoords.y);
if (pixelMap[pixel.x][pixel.y] != undefined) {
deletePixel(pixel.x,pixel.y);
}
var deleted = true;
swapSpots = [];
}
}
}
}
}
//Change pixel
else if (b == "CH") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness) {
if (arg.includes(">")) {
var argfrom = arg.split(">")[0];
var argto = arg.split(">")[1];
}
else {
var argfrom = null;
var argto = arg;
}
if (argto.includes(",")) {
var argto = argto.split(",")[Math.floor(Math.random()*argto.split(",").length)];
}
if (elements[argto]) {
if ((newPixel.element != argto) && (argfrom == null || argfrom == newPixel.element)) {
newPixel.element = argto;
newPixel.color = pixelColorPick(newPixel);
newPixel.start = pixelTicks;
if (elements[argto].burning != true) {
newPixel.burning = false;
}
else {
newPixel.burning = true;
newPixel.burnStart = pixelTicks;
}
if (newPixel.r && !elements[argto].rotatable) {
newPixel.r = false;
}
if (newPixel.flipX && !elements[argto].flippableX) {
newPixel.flipX = false;
}
if (newPixel.flipY && !elements[argto].flippableY) {
newPixel.flipY = false;
}
}
}
}
}
}
//Swap
else if (b == "SW") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (arg != null) { var args = arg.split(","); }
if (arg == null || args.includes(newPixel.element)) {
if (!elements[newPixel.element].hardness || Math.random() > elements[newPixel.element].hardness) {
swapSpots.push({x:newCoords.x,y:newCoords.y});
}
}
}
}
//Create pixel
else if (b == "CR") {
if (isEmpty(newCoords.x,newCoords.y)) {
if (arg == null) {
arg = pixel.element;
}
else if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
if (elements[arg]) {
createPixel(arg,newCoords.x,newCoords.y);
pixelMap[newCoords.x][newCoords.y].temp = pixel.temp
}
}
}
// Clone self
else if (b == "CL") {
if (isEmpty(newCoords.x,newCoords.y)) {
if (arg == null || pixel.temp >= parseFloat(arg)) {
clonePixel(pixel,newCoords.x,newCoords.y);
}
}
}
// Clone first touched
else if (b == "CF") {
if (pixel.clone) {
if (isEmpty(newCoords.x,newCoords.y)) {
createPixel(pixel.clone,newCoords.x,newCoords.y);
pixelMap[newCoords.x][newCoords.y].temp = pixel.temp;
}
}
else {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
newPixel = pixelMap[newCoords.x][newCoords.y];
if (newPixel.element != pixel.element && newPixel.element != "wire") {
pixel.clone = newPixel.element;
pixel.temp = newPixel.temp;
}
else if (newPixel.clone) {
pixel.clone = newPixel.clone;
pixel.temp = newPixel.temp;
}
}
}
}
else if (b=="SH") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
var con = elements[newPixel.element].conduct;
if (con != undefined) {
if (Math.random() < con) { // If random number is less than conductivity
if (!newPixel.charge && !newPixel.chargeCD) {
newPixel.charge = (parseFloat(arg) || 1);
if (elements[newPixel.element].colorOn) {
newPixel.color = pixelColorPick(newPixel);
}
}
}
}
}
}
//Stick
else if (b=="ST") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (newPixel.element != pixel.element && (arg == null || newPixel.element == arg)) {
var sticking = true
}
}
}
//Leave behind element
else if (b == "LB" || b == "L1" || b == "L2" || b == "L3" || b == "L4" || b == "L5" || b == "L6" || b == "L7" || b == "L8") {
if (arg != null && arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
if (elements[arg]) {
if (b=="LB") {leaveBehind = arg;}
else if (b=="L1") {leaveBehind1 = arg;}
else if (b=="L2") {leaveBehind2 = arg;}
else if (b=="L3") {leaveBehind3 = arg;}
else if (b=="L4") {leaveBehind4 = arg;}
else if (b=="L5") {leaveBehind5 = arg;}
else if (b=="L6") {leaveBehind6 = arg;}
else if (b=="L7") {leaveBehind7 = arg;}
else if (b=="L8") {leaveBehind8 = arg;}
}
}
//Change color
else if (b == "CC") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (arg == null) {arg = newPixel.colorObject}
else {
if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
if (!arg.startsWith("#")) {
arg = "#" + arg;
}
}
newPixel.color = pixelColorPick(newPixel,arg);
}
}
//Heat
else if (b == "HT") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
// if the element isn't the same or the coords ARE the same
if (!(newPixel.element == pixel.element) || (newCoords.x == pixel.x && newCoords.y == pixel.y)) {
if (arg != null) {arg = parseFloat(arg)}
else {arg = 1}
if (isNaN(arg)) {arg = 1}
newPixel.temp += arg;
pixelTempCheck(newPixel);
}
}
}
//Cool
else if (b == "CO") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (!(newPixel.element == pixel.element) || (newCoords.x == pixel.x && newCoords.y == pixel.y)) {
if (arg != null) {arg = parseFloat(arg)}
else {arg = 1}
if (isNaN(arg)) {arg = 1}
newPixel.temp -= arg;
pixelTempCheck(newPixel);
}
}
}
// Flip X
else if (b == "FX") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (elements[newPixel.element].flippableX) {
if (arg === "0") { newPixel.flipX = false; }
else if (arg === "1") { newPixel.flipX = true; }
newPixel.flipX = !newPixel.flipX;
}
}
}
// Flip Y
else if (b == "FY") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (elements[newPixel.element].flippableY) {
if (arg === "0") { newPixel.flipY = false; }
else if (arg === "1") { newPixel.flipY = true; }
else { newPixel.flipY = !newPixel.flipY; }
}
}
}
// Rotate
else if (b == "RT") {
if (!isEmpty(newCoords.x,newCoords.y,true)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
// If arg isn't null, set arg to a random choice from arg.split(",")
if (arg != null && arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
if (elements[newPixel.element].rotatable) {
newPixel.r = ((newPixel.r||0) + (parseInt(arg)||1)) % 4;
}
}
}
// Bounce
else if (b == "BO") {
if (!isEmpty(newCoords.x,newCoords.y)) {
if (info.flippableX) {
pixel.flipX = !pixel.flipX;
}
if (info.flippableY) {
pixel.flipY = !pixel.flipY;
}
if (info.rotatable) {
// If arg isn't null, set arg to a random choice from arg.split(",")
if (arg != null && arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
if (pixel.r !== undefined) {
pixel.r = (pixel.r + (parseInt(arg)||2)) % 4;
}
else { pixel.r = (parseInt(arg)||2); }
}
}
}
// Change When M2
else if (b == "C2") {
if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
var C2 = arg;
}
// Change When M3
else if (b == "C3") {
if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
var C3 = arg;
}
// Change When M4
else if (b == "C4") {
if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
var C4 = arg;
}
// Change When M5
else if (b == "C5") {
if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
var C5 = arg;
}
// Change When M6
else if (b == "C6") {
if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
var C6 = arg;
}
// Change When M7
else if (b == "C7") {
if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
var C7 = arg;
}
// Change When M8
else if (b == "C8") {
if (arg.includes(",")) {
arg = arg.split(",")[Math.floor(Math.random()*arg.split(",").length)];
}
var C8 = arg;
}
// Explode
else if (b == "EX") {
if (!isEmpty(newCoords.x,newCoords.y)) {
if (outOfBounds(newCoords.x,newCoords.y) || (newCoords.x == x && newCoords.y == y) || (pixel.element !== pixelMap[newCoords.x][newCoords.y].element && elements[pixelMap[newCoords.x][newCoords.y].element].state !== "gas")) {
// if arg contains ">", var fire = everything after it, arg = everything before it
if (arg.includes(">")) {
var fire = arg.split(">")[1];
arg = arg.split(">")[0];
}
else { var fire = "fire" }
// arg = a number
if (arg != null) {
arg = parseInt(arg);
if (isNaN(arg)) {arg = 3}
}
else {arg = 3}
explodeAt(x,y,arg,fire);
if (!pixel.del && info.hardness !== 1) {
deletePixel(x,y);
var deleted = true;
}
swapSpots = [];
}
}
}
}
}
}
}
if (typeof deleted !== "undefined") {return;}
if (supportSpots.length > 0) {
var supportCount = 0;
var allEmpty = true;
for (var i = 0; i < supportSpots.length; i++) {
var bx = supportSpots[i].x;
var by = supportSpots[i].y;
var arg = supportSpots[i].arg;
if (!isEmpty(bx,by,true)) {
if ((arg == null && !validDensitySwaps.includes(info.state+">"+elements[pixelMap[bx][by].element].state)) || pixelMap[bx][by].element == arg) {
supportCount++;
}
}
}
if (supportCount == supportSpots.length) {
move = false;
}
}
var moved = false;
if (swapSpots.length > 0) {
var coords = swapSpots[Math.floor(Math.random()*swapSpots.length)];
if (pixelMap[coords.x][coords.y] != undefined) {
swapPixels(pixel,pixelMap[coords.x][coords.y]);
move = false;
moved = true;
}
}
if (typeof sticking !== "undefined") {
move = false;
}
// Move First Priority
if (move) {
if (move1Spots.length > 0) {
// While move1Spots is not empty
while (move1Spots.length > 0) {
// coords = random item of move1Spots
var coords = move1Spots[Math.floor(Math.random()*move1Spots.length)];
var nx = coords.x;
var ny = coords.y;
moved = tryMove(pixel,nx,ny,leaveBehind1 || leaveBehind);
if (moved) {
break;
}
else {
// remove coords from move1Spots
move1Spots.splice(move1Spots.indexOf(coords),1);
}
}
}
// Move Second Priority
if (!moved && move2Spots.length > 0) {
// While move2Spots is not empty
while (move2Spots.length > 0) {
// coords = random item of move2Spots
var coords = move2Spots[Math.floor(Math.random()*move2Spots.length)];
var nx = coords.x;
var ny = coords.y;
moved = tryMove(pixel,nx,ny,leaveBehind2 || leaveBehind);
if (moved) {
if (typeof C2 !== "undefined" && elements[C2]) {
pixel.element = C2;
pixel.color = pixelColorPick(pixel);
pixel.start = pixelTicks;
if (elements[C2].burning != true) {
pixel.burning = false;
}
else {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
}
break;
}
else {
// remove coords from move2Spots
move2Spots.splice(move2Spots.indexOf(coords),1);
}
}
//Move Third Priority
if (!moved && move3Spots.length > 0) {
// While move3Spots is not empty
while (move3Spots.length > 0) {
// coords = random item of move3Spots
var coords = move3Spots[Math.floor(Math.random()*move3Spots.length)];
var nx = coords.x;
var ny = coords.y;
moved = tryMove(pixel,nx,ny,leaveBehind3 || leaveBehind);
if (moved) {
if (typeof C3 !== "undefined" && elements[C3]) {
pixel.element = C3;
pixel.color = pixelColorPick(pixel);
pixel.start = pixelTicks;
if (elements[C3].burning != true) {
pixel.burning = false;
}
else {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
}
break;
}
else {
// remove coords from move3Spots
move3Spots.splice(move3Spots.indexOf(coords),1);
}
}
//Move Fourth Priority
if (!moved && move4Spots.length > 0) {
// While move4Spots is not empty
while (move4Spots.length > 0) {
// coords = random item of move4Spots
var coords = move4Spots[Math.floor(Math.random()*move4Spots.length)];
var nx = coords.x;
var ny = coords.y;
moved = tryMove(pixel,nx,ny,leaveBehind4 || leaveBehind);
if (moved) {
if (typeof C4 !== "undefined" && elements[C4]) {
pixel.element = C4;
pixel.color = pixelColorPick(pixel);
pixel.start = pixelTicks;
if (elements[C4].burning != true) {
pixel.burning = false;
}
else {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
}
break;
}
else {
// remove coords from move4Spots
move4Spots.splice(move4Spots.indexOf(coords),1);
}
}
//Move Fifth Priority
if (!moved && move5Spots.length > 0) {
// While move5Spots is not empty
while (move5Spots.length > 0) {
// coords = random item of move5Spots
var coords = move5Spots[Math.floor(Math.random()*move5Spots.length)];
var nx = coords.x;
var ny = coords.y;
moved = tryMove(pixel,nx,ny,leaveBehind5 || leaveBehind);
if (moved) {
if (typeof C5 !== "undefined" && elements[C5]) {
pixel.element = C5;
pixel.color = pixelColorPick(pixel);
pixel.start = pixelTicks;
if (elements[C5].burning != true) {
pixel.burning = false;
}
else {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
}
break;
}
else {
// remove coords from move5Spots
move5Spots.splice(move5Spots.indexOf(coords),1);
}
}
//Move Sixth Priority
if (!moved && move6Spots.length > 0) {
// While move6Spots is not empty
while (move6Spots.length > 0) {
// coords = random item of move6Spots
var coords = move6Spots[Math.floor(Math.random()*move6Spots.length)];
var nx = coords.x;
var ny = coords.y;
moved = tryMove(pixel,nx,ny,leaveBehind6 || leaveBehind);
if (moved) {
if (typeof C6 !== "undefined" && elements[C6]) {
pixel.element = C6;
pixel.color = pixelColorPick(pixel);
pixel.start = pixelTicks;
if (elements[C6].burning != true) {
pixel.burning = false;
}
else {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
}
break;
}
else {
// remove coords from move6Spots
move6Spots.splice(move6Spots.indexOf(coords),1);
}
}
//Move Seventh Priority
if (!moved && move7Spots.length > 0) {
// While move7Spots is not empty
while (move7Spots.length > 0) {
// coords = random item of move7Spots
var coords = move7Spots[Math.floor(Math.random()*move7Spots.length)];
var nx = coords.x;
var ny = coords.y;
moved = tryMove(pixel,nx,ny,leaveBehind7 || leaveBehind);
if (moved) {
if (typeof C7 !== "undefined" && elements[C7]) {
pixel.element = C7;
pixel.color = pixelColorPick(pixel);
pixel.start = pixelTicks;
if (elements[C7].burning != true) {
pixel.burning = false;
}
else {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
}
break;
}
else {
// remove coords from move7Spots
move7Spots.splice(move7Spots.indexOf(coords),1);
}
}
//Move Eighth Priority
if (!moved && move8Spots.length > 0) {
// While move8Spots is not empty
while (move8Spots.length > 0) {
// coords = random item of move8Spots
var coords = move8Spots[Math.floor(Math.random()*move8Spots.length)];
var nx = coords.x;
var ny = coords.y;
moved = tryMove(pixel,nx,ny,leaveBehind8 || leaveBehind);
if (moved) {
if (typeof C8 !== "undefined" && elements[C8]) {
pixel.element = C8;
pixel.color = pixelColorPick(pixel);
pixel.start = pixelTicks;
if (elements[C8].burning != true) {
pixel.burning = false;
}
else {
pixel.burning = true;
pixel.burnStart = pixelTicks;
}
}
break;
}
else {
// remove coords from move8Spots
move8Spots.splice(move8Spots.indexOf(coords),1);
}
}
}
}
}
}
}
}
}
}
// Change tempearture if needed (unused)
/*if (info.tempChange != undefined) {
pixel.temp += info.tempChange;
pixelTempCheck(pixel);
}*/
// Burning
doBurning(pixel);
// Heat Transfer
if (info.insulate != true) {
doHeat(pixel);
}
// Electricity Transfer
doElectricity(pixel);
}
elements.m3test = {
"color": "#33aa44",
"behavior": [
"XX|M3%10|XX",
"M2|XX|M2",
"M1|M1|M1"
],
tick: function(pixel) {
pixelTickMod1(pixel)
},
"density": 1200,
"state": "liquid",
"category": "special"
}
elements.m3test2 = {
"color": "#aa3344",
"behavior": [
"M6|M5|M4",
"M7|LB:wood|M3",
"M8|M1|M2"
],
tick: function(pixel) {
pixelTickMod1(pixel)
},
"density": 120000,
"state": "solid",
"category": "special"
}

348
mods/rainbow_tests.js Normal file
View File

@ -0,0 +1,348 @@
elements.rainbow_alt_test = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/180)));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/180+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/180+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.red_test = {
color: ["#ff0000","#200000","#ff0000","#200000"],
tick: function(pixel) {
var t = pixelTicks*2.5+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/18)));
pixel.color = "rgb("+Math.ceil((r*(7/8))+32)+","+0+","+0+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_small = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/60)));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/60+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/60+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_x_d_t = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(pixelTicks/pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(pixelTicks/pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(pixelTicks/pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/pixel.x)));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/pixel.x+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/pixel.x+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/pixel.y)));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/pixel.y+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/pixel.y+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_d = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2)))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2))+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2))+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_p_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x+pixel.y))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x+pixel.y)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x+pixel.y)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_m_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x-pixel.y))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x-pixel.y)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x-pixel.y)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_t_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x*pixel.y))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x*pixel.y)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x*pixel.y)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_d_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x/pixel.y))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x/pixel.y)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x/pixel.y)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_e_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x**pixel.y))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x**pixel.y)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x**pixel.y)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_r_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.pow(pixel.x, 1/pixel.y)))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.pow(pixel.x, 1/pixel.y))+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.pow(pixel.x, 1/pixel.y))+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_l_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.log(pixel.x) / Math.log(pixel.y)))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.log(pixel.x) / Math.log(pixel.y))+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.log(pixel.x) / Math.log(pixel.y))+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_s_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sin(pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sin(pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sin(pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_c_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/Math.cos(pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/Math.cos(pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/Math.cos(pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_t_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/Math.tan(pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/Math.tan(pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/Math.tan(pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_sh_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sinh(pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sinh(pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sinh(pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_ch_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/Math.cosh(pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/Math.cosh(pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/Math.cosh(pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_th_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/Math.tanh(pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/Math.tanh(pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/Math.tanh(pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_sr_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sqrt(pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sqrt(pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/Math.sqrt(pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_d_m_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2))-pixel.x)));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2))-pixel.x+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2))-pixel.x+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_d_t_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2))*pixel.x)));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2))*pixel.x+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(Math.sqrt(pixel.x**2+pixel.y**2))*pixel.x+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_d_d = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x/(Math.sqrt(pixel.x**2+pixel.y**2))))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x/(Math.sqrt(pixel.x**2+pixel.y**2)))+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x/(Math.sqrt(pixel.x**2+pixel.y**2)))+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_x_mod_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x%pixel.y))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x%pixel.y)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/(pixel.x%pixel.y)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_d_mod_x = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/((Math.sqrt(pixel.x**2+pixel.y**2))%pixel.x))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/((Math.sqrt(pixel.x**2+pixel.y**2))%pixel.x)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/((Math.sqrt(pixel.x**2+pixel.y**2))%pixel.x)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}
elements.rainbow_alt_test_pixel_d_mod_y = {
color: ["#ffaacc","#ffaacc","#aaccff","#aaccff","#ffffbb","#ffffbb"],
tick: function(pixel) {
var t = pixelTicks*3+pixel.x+pixel.y;
var r = Math.floor(255*(1-Math.cos(t*Math.PI/((Math.sqrt(pixel.x**2+pixel.y**2))%pixel.y))));
var g = Math.floor(255*(1-Math.cos(t*Math.PI/((Math.sqrt(pixel.x**2+pixel.y**2))%pixel.y)+2*Math.PI/3)));
var b = Math.floor(255*(1-Math.cos(t*Math.PI/((Math.sqrt(pixel.x**2+pixel.y**2))%pixel.y)+4*Math.PI/3)));
pixel.color = "rgb("+Math.ceil((r/2)+127)+","+Math.ceil((g/2)+127)+","+Math.ceil((b/2)+127)+")";
doHeat(pixel);
},
category: "idk",
}

View File

@ -203,130 +203,6 @@ elements.molten_tungstensteel = {
]
}
elements.rm_water_balloon = {
name: "water balloon",
color: "#3dc2ff",
behavior: [
"XX|M2|XX",
"XX|C2:wb3|XX",
"XX|M1|XX",
],
tempHigh: 180,
stateHigh: ["steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "steam", "plastic"],
tempLow: 0,
stateLow: ["ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "ice", "plastic"],
category: "special",
state: "solid",
density: 997,
}
elements.wb3 = {
name: "wb3",
color: "#0856ff",
behavior: [
"XX|CR:wb2|XX",
"CR:wb2|CH:wb2|CR:wb2",
"XX|CR:wb2|XX",
],
category: "liquid",
state: "solid",
density: 997,
hidden: true,
excludeRandom: true,
}
elements.wb2 = {
name: "wb2",
color: "#145fff",
behavior: [
"XX|CR:wb1|XX",
"CR:wb1|CH:wb1|CR:wb1",
"XX|CR:wb1|XX",
],
category: "special",
state: "liquid",
density: 997,
hidden: true,
excludeRandom: true,
}
elements.wb1 = {
name: "wb1",
color: "#2167ff",
behavior: [
"XX|CR:water|XX",
"CR:water|CH:water|CR:water",
"XX|CR:water|XX",
],
category: "special",
state: "liquid",
density: 997,
hidden: true,
excludeRandom: true,
}
elements.rm_lava_balloon = {
name: "lava balloon",
color: "#ffab36",
behavior: [
"XX|M2|XX",
"XX|C2:lb3|XX",
"XX|M1|XX",
],
temp: 950,
category: "special",
state: "solid",
density: 2725,
}
elements.lb3 = {
name: "lb3",
color: "#ff8c00",
behavior: [
"XX|CR:lb2|XX",
"CR:lb2|CH:lb2|CR:lb2",
"XX|CR:lb2|XX",
],
temp: 1000,
category: "liquid",
state: "solid",
density: 2725,
hidden: true,
excludeRandom: true,
}
elements.lb2 = {
name: "lb2",
color: "#ff6f00",
behavior: [
"XX|CR:lb1|XX",
"CR:lb1|CH:lb1|CR:lb1",
"XX|CR:lb1|XX",
],
temp: 1000,
category: "special",
state: "liquid",
density: 2725,
hidden: true,
excludeRandom: true,
}
elements.lb1 = {
name: "lb1",
color: "#ff4d00",
behavior: [
"XX|CR:magma|XX",
"CR:magma|CH:magma|CR:magma",
"XX|CR:magma|XX",
],
temp: 1000,
category: "special",
state: "liquid",
density: 2725,
hidden: true,
excludeRandom: true,
},
elements.unnamed_substance_bomb = {
name: "unnamed bomb",
color: "#cdad52",
@ -686,56 +562,137 @@ elements.anti_bomb = {
excludeRandom: true,
}
elements.anti_bomb_2 = {
color: "#625c71",
liquidBalloonDepth = 8
elements.rm_water_balloon = {
name: "water balloon",
color: "#3dc2ff",
behavior: [
"M2|M1 AND EX:15|M2",
"XX|XX|XX",
"XX|EX:15|XX",
"XX|M2|XX",
"XX|C2:wb"+liquidBalloonDepth+"|XX",
"XX|M1|XX",
],
category: "weapons",
category: "special",
state: "solid",
density: 1300,
density: 997,
}
//For statement syntax by charPointer
for (var i = liquidBalloonDepth; i > 1; i--) {
elements[`wb${i}`] = {
color: "#2167ff",
behavior: [
`XX|CR:wb${i-1}|XX`,
`CR:wb${i-1}|CH:wb${i-1}|CR:wb${i-1}`,
`XX|CR:wb${i-1}|XX`,
],
state: "solid",
excludeRandom:true,
hidden: true,
category: "weapons",
}
}
elements.wb1 = {
name: "wb1",
color: "#2167ff",
behavior: [
"XX|CR:water|XX",
"CR:water|CH:water|CR:water",
"XX|CR:water|XX",
],
category: "special",
state: "liquid",
density: 997,
hidden: true,
excludeRandom: true,
}
elements.anti_bomb_3 = {
color: "#825c71",
elements.rm_lava_balloon = {
name: "lava balloon",
color: "#ffab36",
behavior: [
"M2|M1 AND EX:20|M2",
"XX|XX|XX",
"XX|EX:20|XX",
"XX|M2|XX",
"XX|C2:lb"+liquidBalloonDepth+"|XX",
"XX|M1|XX",
],
category: "weapons",
temp: 950,
category: "special",
state: "solid",
density: 1300,
density: 2725,
}
for (var i = liquidBalloonDepth; i > 1; i--) {
elements[`lb${i}`] = {
color: "#ff8c00",
behavior: [
`XX|CR:lb${i-1}|XX`,
`CR:lb${i-1}|CH:lb${i-1}|CR:lb${i-1}`,
`XX|CR:lb${i-1}|XX`,
],
state: "solid",
excludeRandom:true,
hidden: true,
category: "weapons",
}
}
elements.lb1 = {
color: "#ff8c00",
behavior: [
"XX|CR:magma|XX",
"CR:magma|CH:magma|CR:magma",
"XX|CR:magma|XX",
],
category: "special",
state: "liquid",
density: 997,
hidden: true,
excludeRandom: true,
}
elements.bomb_2 = {
color: "#624c41",
behavior: [
"XX|EX:15|XX",
"XX|XX|XX",
"M2|M1 AND EX:15|M2",
],
category: "weapons",
state: "solid",
density: 1300,
excludeRandom: true,
},
for (var i = 2; i <= 10; i++) {
elements[`bomb_${i}`] = {
name: `bomb ${i}`,
color: "#624c41",
behavior: [
`XX|EX:${5*(i+1)}>fire|XX`,
"XX|XX|XX",
`M2|M1 AND EX:${5*(i+1)}>fire|M2`,
],
state: "solid",
excludeRandom:true,
category: "weapons",
}
}
elements.bomb_3 = {
color: "#725c41",
behavior: [
"XX|EX:20|XX",
"XX|XX|XX",
"M2|M1 AND EX:20|M2",
],
category: "weapons",
state: "solid",
density: 1300,
excludeRandom: true,
for (var i = 2; i <= 10; i++) {
elements[`anti_bomb_${i}`] = {
color: "#625c71",
behavior: [
`M2|M1 AND EX:${5*(i+1)}>fire|M2`,
"XX|XX|XX",
`XX|EX:${5*(i+1)}>fire|XX`,
],
state: "solid",
excludeRandom:true,
category: "weapons",
}
}
for (var i = 2; i <= 10; i++) {
elements[`bomb_${i}`] = {
name: `bomb ${i}`,
color: "#624c41",
behavior: [
`XX|EX:${5*(i+1)}>fire|XX`,
"XX|XX|XX",
`M2|M1 AND EX:${5*(i+1)}>fire|M2`,
],
state: "solid",
excludeRandom:true,
category: "weapons",
}
}
elements.sebA = {

View File

@ -789,6 +789,9 @@ elements.colder_bomb = {
if(steppedOn == true || landed == true) {
fire = ["cold_fire","cold_fire","cold_fire","snow","liquid_nitrogen"]
smoke = ["cold_fire","snow","liquid_nitrogen"]
if(enabledMods.includes("mods/some_tf_liquids.js")) {
fire.push("gelid_cryotheum")
}
radius = 15
x = pixel.x
y = pixel.y
@ -1038,6 +1041,26 @@ elements.op_hottester_bomb = {
excludeRandom: true,
},
elements.vanishing_wall = {
behavior: behaviors.WALL,
color: "#8080b0",
density: 3333,
tick: function(pixel) {
pixelTick(pixel)
if(pixel.charge) {
if(!isEmpty(pixel.x,pixel.y)) {
deletePixel(pixel.x,pixel.y)
}
}
},
category: "special",
state: "solid",
hardness: 1,
insulate: true,
conduct: 1,
extraInfo: "It disappears when charged.",
}
runAfterLoad(function() {
if(enabledMods.includes("mods/fey_and_more.js")) {
aaa.push("poisonwater")

View File

@ -50,7 +50,7 @@ elements.molten_amogus5 = {
"M2 AND CR:amogus9 AND CH:amogus9|DL%25|M2",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "liquid",
density: (6942.0*0.9),
hidden: true,
@ -61,7 +61,7 @@ elements.molten_amogus6 = {
"M2 AND CR:amogus10 AND CH:amogus10|DL%25|M2",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "liquid",
density: (6942.0*0.9),
hidden: true,
@ -72,7 +72,7 @@ elements.molten_amogus7 = {
"M2 AND CR:amogus11 AND CH:amogus11|DL%25|M2",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "liquid",
density: (6942.0*0.9),
hidden: true,
@ -84,7 +84,7 @@ elements.molten_amogus9 = {
"M2|DL%25|M2",
"XX|CR:amogus8 AND CH:amogus8|XX",
],
category: "specials",
category: "special",
state: "liquid",
density: (6942.0*0.9),
hidden: true,
@ -95,7 +95,7 @@ elements.molten_amogus8 = {
"M2|DL%25|M2",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "liquid",
density: (6942.0*0.9),
hidden: true,
@ -106,7 +106,7 @@ elements.molten_amogus10 = {
"M2|DL%25|M2",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "liquid",
density: (6942.0*0.9),
hidden: true,
@ -117,7 +117,7 @@ elements.molten_amogus11 = {
"M2|DL%25|M2",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "liquid",
density: (6942.0*0.9),
hidden: true,
@ -182,7 +182,7 @@ elements.amogus5 = {
"CR:amogus9 AND CH:amogus9|DL%25|XX",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "solid",
density: 6942.0,
hidden: true,
@ -195,7 +195,7 @@ elements.amogus6 = {
"CR:amogus10 AND CH:amogus10|DL%25|XX",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "solid",
density: 6942.0,
hidden: true,
@ -208,7 +208,7 @@ elements.amogus7 = {
"CR:amogus11 AND CH:amogus11|DL%25|XX",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "solid",
density: 6942.0,
hidden: true,
@ -222,7 +222,7 @@ elements.amogus9 = {
"XX|DL%25|XX",
"XX|CR:amogus8 AND CH:amogus8|XX",
],
category: "specials",
category: "special",
state: "solid",
density: 6942.0,
hidden: true,
@ -235,7 +235,7 @@ elements.amogus8 = {
"XX|DL%25|XX",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "solid",
density: 6942.0,
hidden: true,
@ -248,7 +248,7 @@ elements.amogus10 = {
"XX|DL%25|XX",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "solid",
density: 6942.0,
hidden: true,
@ -261,7 +261,7 @@ elements.amogus11 = {
"XX|DL%25|XX",
"XX|XX|XX",
],
category: "specials",
category: "special",
state: "solid",
density: 6942.0,
hidden: true,

View File

@ -304,4 +304,188 @@ elements.tc = { //temperature checker
category:"machines",
insulate: true,
state: "solid",
},
/**
* color-temperature.js
*
* Neil Bartlett
* neilbartlett.com
* 2015-01-22
*
* Copyright [2015] [Neil Bartlett] *
*
* Color Temperature is the color due to black body radiation at a given
* temperature. The temperature is given in Kelvin. The concept is widely used
* in photography and in tools such as f.lux.
*
* The function here converts a given color temperature into a near equivalent
* in the RGB colorspace. The function is based on a curve fit on standard sparse
* set of Kelvin to RGB mappings.
*
* Two conversions are presented here. The one colorTempertature2RGBUSingTH
* is a JS version of the algorithm developed by Tanner Helland. The second is a
* slightly more accurate conversion based on a refitting of the original data
* using different curve fit functions. The performance cost of the two
* approaches is very similar and in general the second algorithm is preferred.
*
* NOTE The approximations used are suitable for photo-mainpulation and other
* non-critical uses. They are not suitable for medical or other high accuracy
* use cases.
*
* Accuracy is best between 1000K and 40000K.
*
* See http://github.com/neilbartlett/color-temperature for further details.
*
**/
//[Code licensed under the MIT License]
//[Tanner Helland version omitted]
/**
* A more accurate version algorithm based on a different curve fit to the
* original RGB to Kelvin data.
* Input: color temperature in degrees Kelvin
* Output: json object of red, green and blue components of the Kelvin temperature
*/
colorTemperature2rgb = function(kelvin) {
var temperature = kelvin / 100.0;
var red, green, blue;
if (temperature < 66.0) {
red = 255;
} else {
// a + b x + c Log[x] /.
// {a -> 351.97690566805693`,
// b -> 0.114206453784165`,
// c -> -40.25366309332127
//x -> (kelvin/100) - 55}
red = temperature - 55.0;
red = 351.97690566805693+ 0.114206453784165 * red - 40.25366309332127 * Math.log(red);
if (red < 0) red = 0;
if (red > 255) red = 255;
}
/* Calculate green */
if (temperature < 66.0) {
// a + b x + c Log[x] /.
// {a -> -155.25485562709179`,
// b -> -0.44596950469579133`,
// c -> 104.49216199393888`,
// x -> (kelvin/100) - 2}
green = temperature - 2;
green = -155.25485562709179 - 0.44596950469579133 * green + 104.49216199393888 * Math.log(green);
if (green < 0) green = 0;
if (isNaN(green)) green = 0;
if (green > 255) green = 255;
} else {
// a + b x + c Log[x] /.
// {a -> 325.4494125711974`,
// b -> 0.07943456536662342`,
// c -> -28.0852963507957`,
// x -> (kelvin/100) - 50}
green = temperature - 50.0;
green = 325.4494125711974 + 0.07943456536662342 * green - 28.0852963507957 * Math.log(green);
if (green < 0) green = 0;
if (green > 255) green = 255;
}
/* Calculate blue */
if (temperature >= 66.0) {
blue = 255;
} else {
if (temperature <= 20.0) {
blue = 0;
} else {
// a + b x + c Log[x] /.
// {a -> -254.76935184120902`,
// b -> 0.8274096064007395`,
// c -> 115.67994401066147`,
// x -> kelvin/100 - 10}
blue = temperature - 10;
blue = -254.76935184120902 + 0.8274096064007395 * blue + 115.67994401066147 * Math.log(blue);
if (blue < 0) blue = 0;
if (blue > 255) blue = 255;
}
}
//return {red: Math.round(red), blue: Math.round(blue), green: Math.round(green)};
return "rgb("+Math.round(red)+","+Math.round(green)+","+Math.round(blue)+")"
}
//[reverse conversion omitted]
elements.color_temp_test = {
color: "#111111",
tick: function(pixel) {
if(!pixel.oldColor) {
pixel.oldColor = pixel.color
}
if(!pixel.lerpValue) {
pixel.lerpValue = 0
}
if(!pixel.lerpAR) {
pixel.lerpAR = 0
}
if(!pixel.lerpAG) {
pixel.lerpAG = 0
}
if(!pixel.lerpAB) {
pixel.lerpAB = 0
}
if(!pixel.lerpBR) {
pixel.lerpBR = 0
}
if(!pixel.lerpBG) {
pixel.lerpBG = 0
}
if(!pixel.lerpBB) {
pixel.lerpBB = 0
}
if(!pixel.lerpedR) {
pixel.lerpedR = 0
}
if(!pixel.lerpedG) {
pixel.lerpedG = 0
}
if(!pixel.lerpedB) {
pixel.lerpedB = 0
}
if(!pixel.lerpedColor) {
pixel.lerpedColor = ""
}
if(pixel.temp < 525) {
pixel.color = pixel.oldColor
}
if(pixel.temp >= 525 && pixel.temp < 1582) {
pixel.lerpValue = (pixel.temp-524)/(1581-524)
pixel.lerpAR = pixel.oldColor.split(",")[0].slice(4)
pixel.lerpAG = pixel.oldColor.split(",")[1]
pixel.lerpAB = pixel.oldColor.split(",")[2].slice(0,-1)
pixel.lerpBR = colorTemperature2rgb(pixel.temp + 273.15).split(",")[0].slice(4)
pixel.lerpBG = colorTemperature2rgb(pixel.temp + 273.15).split(",")[1]
pixel.lerpBB = colorTemperature2rgb(pixel.temp + 273.15).split(",")[2].slice(0,-1)
pixel.lerpedR = pixel.lerpBR*pixel.lerpValue + pixel.lerpAR*(1-pixel.lerpValue)
pixel.lerpedG = pixel.lerpBG*pixel.lerpValue + pixel.lerpAG*(1-pixel.lerpValue)
pixel.lerpedB = pixel.lerpBB*pixel.lerpValue + pixel.lerpAB*(1-pixel.lerpValue)
pixel.lerpedColor = "rgb(" + pixel.lerpedR + "," + pixel.lerpedG + "," + pixel.lerpedB + ")"
pixel.color = pixel.lerpedColor
}
if(pixel.temp >= 1582) {
pixel.color = colorTemperature2rgb(pixel.temp + 273.15)
}
doHeat(pixel);
},
category: "special",
temp: -273,
}

154
mods/toothpaste.js Normal file
View File

@ -0,0 +1,154 @@
elements.tooth = {
color: "#d9d9d9",
behavior: behaviors.SUPPORT,
reactions: {
"sugar": { "elem1": "decayed_tooth", "elem2": null, "chance": 0.003 },
"plaque": { "elem1": "decayed_tooth", "elem2": null, "chance": 0.002 },
"acid": { "elem1": "decayed_tooth", "elem2": null },
},
category:"life",
tempHigh: 1000, //https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5887641/
stateHigh: ["steam","salt","meat","hydroxyapatite"],
state: "solid",
density: 2000, //(bs) inspired by https://ncbi.nlm.nih.gov/pmc/articles/PMC5176275/
hardness: 0.5,
breakInto: ["meat","hydroxyapatite"],
},
elements.plaque = {
color: "#faf6dc",
behavior: [
"XX|ST AND CR:plague%0.01 AND CR:acid%0.01 AND CR:infection%0.003 AND CH:tooth>decayed_tooth%0.01|XX",
"ST AND CR:plague%0.01 AND CR:acid%0.01 AND CR:infection%0.003 AND CH:tooth>decayed_tooth%0.01|CH:tartar%0.001|ST AND CR:plague%0.01 AND CR:acid%0.01 AND CR:infection%0.003 AND CH:tooth>decayed_tooth%0.01",
"M2|M1 AND ST AND CR:plague%0.01 AND CR:acid%0.01 AND CR:infection%0.003 AND CH:tooth>decayed_tooth%0.01|M2",
],
reactions: {
"acid": { "elem1": null, "elem2": null, "chance": 0.01 },
},
category:"life",
tempHigh: 100,
stateHigh: ["steam","plague"],
state: "solid",
density: 5.4, //https://physics.aps.org/articles/v5/s140#:~:text=They%20then%20use%20tabulated%20values,%2D12%20gram)%20per%20cell.
//https://en.wikipedia.org/wiki/Calculus_(dental)#:~:text=Cell%20density%20within%20dental%20plaque,estimated%20200%2C000%2C000%20cells%20per%20milligram.
hidden: true,
},
elements.tartar = {
color: ["#e8d595", "#cfb27e", "#f0e989"],
behavior: [
"XX|ST AND CR:plague%0.02 AND CR:acid%0.01 AND CR:infection%0.003 AND CH:tooth>decayed_tooth%0.01|XX",
"ST AND CR:plague%0.02 AND CR:acid%0.01 AND CR:infection%0.003 AND CH:tooth>decayed_tooth%0.01|CH:tartar%0.01|ST AND CR:plague%0.02 AND CR:acid%0.01 AND CR:infection%0.003 AND CH:tooth>decayed_tooth%0.01",
"XX|M1 AND ST AND CR:plague%0.02 AND CR:acid%0.01 AND CR:infection%0.003 AND CH:tooth>decayed_tooth%0.01|XX",
],
reactions: {
"acid": { "elem1": null, "elem2": null, "chance": 0.01 },
},
category:"other",
tempHigh: elements.calcium.tempHigh,
stateHigh: ["steam","plague","calcium"],
state: "solid",
density: 1900,
hardness: elements.tooth.hardness - 0.05,
breakInto: ["calcium","calcium","calcium","calcium","rotten_meat","rotten_meat","plague"],
hidden: true,
},
elements.decayed_tooth = {
color: ["#aba89d","#85837b","#7a7972","#b8b5a5","#6b6a63"],
behavior: [
"XX|XX|XX",
"SP%99.5|DL%0.04|SP%99.5",
"XX|M1|XX",
],
reactions: {
"acid": { "elem1": null, "elem2": null, "chance": 0.7 },
},
tempHigh: 1000,
stateHigh: ["steam","salt","meat","hydroxyapatite"],
state: "solid",
category: "other",
density: 1900,
hardness: 0.3,
breakInto: ["rotten_meat","hydroxyapatite"],
hidden: true,
},
elements.hydroxyapatite = {
color: ["#edecda", "#f5f5f5", "#e8e8e8"],
behavior: behaviors.POWDER,
state: "solid",
category: "solids",
density: 3180,
tempHigh: 1670,
/* it decomposes but not into anything worth adding
https://www.sciencedirect.com/science/article/abs/pii/S0142961299000769 */
category: "powders",
},
elements.toothpaste = {
color: ["#f8f8f8", "#6699ff", "#f8f8f8", "#ff5555"],
behavior: [
"XX|SW:plaque%5|XX",
"SW:plaque%5|XX|SW:plaque%5",
"M2|SW:plaque%5|M2",
],
reactions: {
"plaque": {"elem1":["foam","toothpaste","toothpaste"], "elem2":"foam", "chance":0.7},
"decayed_tooth": {"elem1":"tooth", "elem2":"foam", "chance":0.5},
},
state: "solid",
category: "other",
density: 1330,
tempHigh: 250, //bs
stateHigh: ["toothpaste","toothpaste","toothpaste","toothpaste","toothpaste","toothpaste","toothpaste","toothpaste","toothpaste","toothpaste","foam","foam","fire","smoke","ash"],
burn: 5,
burnInto: ["fire","smoke","smoke","ash","ash","toothpaste"],
viscosity: 20000,
/* it decomposes but not into anything worth adding
https://www.sciencedirect.com/science/article/abs/pii/S0142961299000769 */
category: "powders",
}
runAfterLoad(function() {
foodArray = Object.keys(elements).filter(function(e) {
return elements[e].category == "food";
});
if(!elements.tooth.reactions) {
elements.tooth.reactions = {}
};
for(i = 0; i < foodArray.length; i++) {
elements.tooth.reactions[foodArray[i]] = { "elem1": ["tooth","tooth","tooth","tooth","tooth","tooth","tooth","tooth","decayed_tooth"], "elem2": "plaque", "chance": 0.001 }
};
elements.acid.ignore.push("tooth");
elements.acid.ignore.push("decayed_tooth");
elements.acid.ignore.push("plaque");
elements.acid.ignore.push("tartar");
if(enabledMods.includes("mods/fey_and_more.js")) {
//tooth decay to impurities {
eLists.IMPURITY.push("plaque");
eLists.IMPURITY.push("tartar");
eLists.IMPURITY.push("decayed_tooth");
//}
//regenerate behaviors of elements that use eLists.IMPURITY {
elements.pure_water.behavior = [
"DL:"+eLists.IMPURITY+"|DL:"+eLists.IMPURITY+"|DL:"+eLists.IMPURITY+"",
"DL:"+eLists.IMPURITY+" AND M2|XX|DL:"+eLists.IMPURITY+" AND M2",
"DL:"+eLists.IMPURITY+" AND M1|DL:"+eLists.IMPURITY+" AND M1|DL:"+eLists.IMPURITY+" AND M1",
];
elements.pure_steam.behavior = [
"M2 AND DL:"+eLists.IMPURITY+"|M1 AND DL:"+eLists.IMPURITY+"|M2 AND DL:"+eLists.IMPURITY+"",
"M1 AND DL:"+eLists.IMPURITY+"|XX|M1 AND DL:"+eLists.IMPURITY+"",
"M2 AND DL:"+eLists.IMPURITY+"|M1 AND DL:"+eLists.IMPURITY+"|M2 AND DL:"+eLists.IMPURITY+"",
];
//}
//concoction support (it's all mistakes) {
elements.concoction.reactions.tooth = { "elem1": "mistake", "elem2": null };
elements.concoction.reactions.decayed_tooth = { "elem1": "mistake", "elem2": null };
elements.concoction.reactions.toothpaste = { "elem1": "mistake", "elem2": null };
elements.concoction.reactions.plaque = { "elem1": "mistake", "elem2": null };
elements.concoction.reactions.tartar = { "elem1": "mistake", "elem2": null };
//}
};
});