diff --git a/lang/fr.json b/lang/fr.json
index 535e7179..da9fc257 100644
--- a/lang/fr.json
+++ b/lang/fr.json
@@ -10,10 +10,10 @@
"weapons":"Armes",
"gases":"Des gaz",
"food":"Nourriture",
-"machines":"Usiner",
+"machines":"Machines",
"special":"Spécial",
"other":"Autre",
-"heat":"Chaleur",
+"heat":"Réchauffer",
"cool":"Refroidir",
"erase":"Effacer",
"drag":"Traîner",
@@ -21,7 +21,7 @@
"mix":"Mélanger",
"lookup":"Chercher",
"shock":"Choc",
-"paint":"Peinture",
+"paint":"Peindre",
"sand":"Sable",
"water":"Eau",
"salt_water":"Eau salée",
@@ -32,14 +32,14 @@
"dirt":"Saleté",
"mud":"Boue",
"wet_sand":"Sable mouillé",
-"rock":"Rocher",
+"rock":"Roche",
"rock_wall":"Mur en pierre",
"mudstone":"Argile",
"packed_sand":"Sable compacté",
-"plant":"Usine",
+"plant":"Plante",
"dead_plant":"Plante morte",
"frozen_plant":"Plante gelée",
-"grass":"Gazon",
+"grass":"Herbe",
"algae":"Algues",
"concrete":"Béton",
"wall":"Mur",
@@ -68,13 +68,13 @@
"molten_salt":"Sel dissous",
"sugar":"Sucre",
"flour":"Farine",
-"wire":"Fil",
+"wire":"Cable",
"battery":"Batterie",
"cloner":"Cloneur",
"sensor":"Capteur",
"heater":"Chauffage",
-"cooler":"glacière",
-"random":"aléatoire",
+"cooler":"Glacière",
+"random":"Aléatoire",
"image":"Image",
"unpaint":"Dépeindre",
"uncharge":"Décharger",
@@ -83,7 +83,7 @@
"filler":"Remplisseur",
"lattice":"Treillis",
"gravel":"Gravier",
-"slime":"Vase",
+"slime":"Slime",
"cement":"Ciment",
"dust":"Poussière",
"void":"Vide",
@@ -102,12 +102,12 @@
"hive":"Ruche",
"bee":"Abeille",
"stink_bug":"Punaise",
-"dead_bug":"Bug mort",
+"dead_bug":"Insecte mort",
"human":"Humain",
"body":"Corps",
"head":"Tête",
"bird":"Oiseau",
-"rat":"Manger",
+"rat":"Rat",
"frog":"Grenouille",
"frozen_frog":"Grenouille congelée",
"tadpole":"Têtard",
@@ -119,7 +119,7 @@
"superheater":"Surchauffeur",
"freezer":"Congélateur",
"pipe":"Tuyau",
-"pipe_wall":"Mur_tuyau",
+"pipe_wall":"Mur tuyau",
"ewall":"Mur électronique",
"torch":"Torche",
"spout":"Pec",
@@ -129,7 +129,7 @@
"balloon":"Ballon",
"antipowder":"Antipoudre",
"antimolten":"Antifondu",
-"antifire":"Anti-incendie",
+"antifire":"Anti-feu",
"antifluid":"Antifluide",
"antigas":"Antigaz",
"vertical":"Verticale",
diff --git a/mod-list.html b/mod-list.html
index e4121d69..f5b2b470 100644
--- a/mod-list.html
+++ b/mod-list.html
@@ -249,6 +249,7 @@
| all_around_fillers.js | Adds directional Filler variants | idk73248 |
| allliquids.js | Made all elements liquids | Adora |
| amogus.js | Adds a small amogus structure | Alice |
+| citybuilding.js | Adds seeds that create miniature buildings and other city-related items | SquareScreamYT |
| collab_mod.js | Created by multiple people, adds random things | mrapple, ilikepizza, stefanblox |
| elem3.js | Adds all elements and combinations from Elemental 3 [Very Large] | Sophie |
| funny elements 2022-11-15.js | Adds a few curated randomly-generated elements | Alice |
diff --git a/mods/citybuilding.js b/mods/citybuilding.js
new file mode 100644
index 00000000..e99a655a
--- /dev/null
+++ b/mods/citybuilding.js
@@ -0,0 +1,216 @@
+function building_1_segment() {
+ if (pixel.foundation = true && pixel.height < pixel.limit) {
+ if (isEmpty(pixel.x+1,pixel.y-pixel.height) &&
+ isEmpty(pixel.x-1,pixel.y-pixel.height) &&
+ isEmpty(pixel.x+2,pixel.y-pixel.height) &&
+ isEmpty(pixel.x-2,pixel.y-pixel.height) &&
+ isEmpty(pixel.x+2,pixel.y-1-pixel.height) &&
+ isEmpty(pixel.x-2,pixel.y-1-pixel.height) &&
+ isEmpty(pixel.x+1,pixel.y-1-pixel.height) &&
+ isEmpty(pixel.x-1,pixel.y-1-pixel.height) &&
+ isEmpty(pixel.x,pixel.y-1-pixel.height) &&
+ isEmpty(pixel.x,pixel.y-pixel.height)) {
+ createPixel("glass",pixel.x+1,pixel.y-pixel.height);
+ createPixel("glass",pixel.x-1,pixel.y-pixel.height);
+ createPixel("concrete",pixel.x+2,pixel.y-pixel.height);
+ createPixel("concrete",pixel.x-2,pixel.y-pixel.height);
+ createPixel("concrete",pixel.x+1,pixel.y-1-pixel.height);
+ createPixel("concrete",pixel.x-1,pixel.y-1-pixel.height);
+ createPixel("concrete",pixel.x+2,pixel.y-1-pixel.height);
+ createPixel("concrete",pixel.x-2,pixel.y-1-pixel.height);
+ createPixel("concrete",pixel.x,pixel.y-1-pixel.height);
+ createPixel("concrete",pixel.x,pixel.y-pixel.height);
+ pixel.height = pixel.height+2
+ }
+ }
+}
+function filldirt2x5() {
+ var dirtPixelElem = pixelMap[pixel.x][pixel.y+1];
+ if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) {
+ dirtPixelElem = pixelMap[pixel.x][pixel.y+1].element
+ }
+ if (isEmpty(pixel.x+1,pixel.y+1)) {
+ createPixel(dirtPixelElem,pixel.x+1,pixel.y+1);
+ }
+ if (isEmpty(pixel.x-1,pixel.y+1)) {
+ createPixel(dirtPixelElem,pixel.x-1,pixel.y+1);
+ }
+ if (isEmpty(pixel.x+2,pixel.y+1)) {
+ createPixel(dirtPixelElem,pixel.x+2,pixel.y+1);
+ }
+ if (isEmpty(pixel.x-2,pixel.y+1)) {
+ createPixel(dirtPixelElem,pixel.x-2,pixel.y+1);
+ }
+ if (isEmpty(pixel.x+2,pixel.y+2)) {
+ createPixel(dirtPixelElem,pixel.x+2,pixel.y+2);
+ }
+ if (isEmpty(pixel.x-2,pixel.y+2)) {
+ createPixel(dirtPixelElem,pixel.x-2,pixel.y+2);
+ }
+}
+elements.building_1 = {
+ color: "#a78d38",
+ tick: function(pixel) {
+ if (!isEmpty(pixel.x,pixel.y+1)) {
+ if (isEmpty(pixel.x+1,pixel.y) &&
+ isEmpty(pixel.x-1,pixel.y) &&
+ isEmpty(pixel.x+2,pixel.y) &&
+ isEmpty(pixel.x-2,pixel.y) &&
+ isEmpty(pixel.x+2,pixel.y-1) &&
+ isEmpty(pixel.x-2,pixel.y-1) &&
+ isEmpty(pixel.x+1,pixel.y-1) &&
+ isEmpty(pixel.x-1,pixel.y-1) &&
+ isEmpty(pixel.x,pixel.y-1) &&
+ isEmpty(pixel.x+2,pixel.y-2) &&
+ isEmpty(pixel.x-2,pixel.y-2) &&
+ isEmpty(pixel.x+1,pixel.y-2) &&
+ isEmpty(pixel.x-1,pixel.y-2) &&
+ isEmpty(pixel.x,pixel.y-2)) {
+ filldirt2x5();
+ movePixel(pixel,pixel.x,pixel.y-1);
+ createPixel("concrete",pixel.x+1,pixel.y+1);
+ createPixel("concrete",pixel.x-1,pixel.y+1);
+ createPixel("concrete",pixel.x+2,pixel.y+1);
+ createPixel("concrete",pixel.x-2,pixel.y+1);
+ createPixel("wood",pixel.x,pixel.y+1);
+ pixel.limit = 10 + Math.floor(Math.random() * 5)*2;
+ createPixel("concrete",pixel.x+1,pixel.y);
+ createPixel("concrete",pixel.x-1,pixel.y);
+ createPixel("concrete",pixel.x+2,pixel.y);
+ createPixel("concrete",pixel.x-2,pixel.y);
+ createPixel("concrete",pixel.x+1,pixel.y-1);
+ createPixel("concrete",pixel.x-1,pixel.y-1);
+ createPixel("concrete",pixel.x+2,pixel.y-1);
+ createPixel("concrete",pixel.x-2,pixel.y-1);
+ createPixel("concrete",pixel.x,pixel.y-1);
+ pixel.foundation = true;
+ pixel.height = pixel.height+2
+ }
+ }
+ if (pixel.foundation == true && pixel.height < pixel.limit) {
+ building_1_segment();
+ }
+ else if (pixel.foundation == true && pixel.height >= pixel.limit) {
+ pixel.built = true;
+ }
+ if (pixel.built == true) {
+ changePixel(pixel,"wood");
+ }
+ doDefaults(pixel);
+ },
+ properties: {
+ height:0,
+ limit:0,
+ foundation:false,
+ built:false
+ },
+ category: "citybuilding",
+ state: "solid",
+ density: 1500,
+ cooldown: defaultCooldown,
+ seed: true,
+ maxSize: 1,
+ excludeRandom: true,
+ behavior: behaviors.STURDYPOWDER,
+};
+elements.building_1_tall = {
+ color: "#d9c243",
+ tick: function(pixel) {
+ if (!isEmpty(pixel.x,pixel.y+1)) {
+ if (isEmpty(pixel.x+1,pixel.y) &&
+ isEmpty(pixel.x-1,pixel.y) &&
+ isEmpty(pixel.x+2,pixel.y) &&
+ isEmpty(pixel.x-2,pixel.y) &&
+ isEmpty(pixel.x+2,pixel.y-1) &&
+ isEmpty(pixel.x-2,pixel.y-1) &&
+ isEmpty(pixel.x+1,pixel.y-1) &&
+ isEmpty(pixel.x-1,pixel.y-1) &&
+ isEmpty(pixel.x,pixel.y-1) &&
+ isEmpty(pixel.x+2,pixel.y-2) &&
+ isEmpty(pixel.x-2,pixel.y-2) &&
+ isEmpty(pixel.x+1,pixel.y-2) &&
+ isEmpty(pixel.x-1,pixel.y-2) &&
+ isEmpty(pixel.x,pixel.y-2)) {
+ filldirt2x5();
+ movePixel(pixel,pixel.x,pixel.y-1);
+ createPixel("concrete",pixel.x+1,pixel.y+1);
+ createPixel("concrete",pixel.x-1,pixel.y+1);
+ createPixel("concrete",pixel.x+2,pixel.y+1);
+ createPixel("concrete",pixel.x-2,pixel.y+1);
+ createPixel("wood",pixel.x,pixel.y+1);
+ pixel.limit = 15 + Math.floor(Math.random() * 10)*2;
+ createPixel("concrete",pixel.x+1,pixel.y);
+ createPixel("concrete",pixel.x-1,pixel.y);
+ createPixel("concrete",pixel.x+2,pixel.y);
+ createPixel("concrete",pixel.x-2,pixel.y);
+ createPixel("concrete",pixel.x+1,pixel.y-1);
+ createPixel("concrete",pixel.x-1,pixel.y-1);
+ createPixel("concrete",pixel.x+2,pixel.y-1);
+ createPixel("concrete",pixel.x-2,pixel.y-1);
+ createPixel("concrete",pixel.x,pixel.y-1);
+ pixel.foundation = true;
+ pixel.height = pixel.height+2
+ }
+ }
+ if (pixel.foundation == true && pixel.height < pixel.limit) {
+ building_1_segment();
+ }
+ else if (pixel.foundation == true && pixel.height >= pixel.limit) {
+ pixel.built = true;
+ }
+ if (pixel.built == true) {
+ changePixel(pixel,"wood");
+ }
+ doDefaults(pixel);
+ },
+ properties: {
+ height:0,
+ limit:0,
+ foundation:false,
+ built:false
+ },
+ category: "citybuilding",
+ state: "solid",
+ density: 1500,
+ cooldown: defaultCooldown,
+ seed: true,
+ maxSize: 1,
+ excludeRandom: true,
+ behavior: behaviors.STURDYPOWDER,
+};
+elements.small_tree_1 = {
+ color: "#4bd943",
+ tick: function(pixel) {
+ if (!isEmpty(pixel.x,pixel.y+1)) {
+ if (isEmpty(pixel.x+1,pixel.y-1) &&
+ isEmpty(pixel.x-1,pixel.y-1) &&
+ isEmpty(pixel.x,pixel.y-1) &&
+ isEmpty(pixel.x+1,pixel.y-2) &&
+ isEmpty(pixel.x-1,pixel.y-2) &&
+ isEmpty(pixel.x,pixel.y-2) &&
+ isEmpty(pixel.x+1,pixel.y-3) &&
+ isEmpty(pixel.x-1,pixel.y-3) &&
+ isEmpty(pixel.x,pixel.y-3)) {
+ createPixel("wood",pixel.x,pixel.y-1);
+ createPixel("wood",pixel.x,pixel.y-2);
+ createPixel("plant",pixel.x,pixel.y-3);
+ createPixel("plant",pixel.x-1,pixel.y-1);
+ createPixel("plant",pixel.x-1,pixel.y-2);
+ createPixel("plant",pixel.x-1,pixel.y-3);
+ createPixel("plant",pixel.x+1,pixel.y-1);
+ createPixel("plant",pixel.x+1,pixel.y-2);
+ createPixel("plant",pixel.x+1,pixel.y-3);
+ changePixel(pixel,"wood");
+ }
+ }
+ doDefaults(pixel);
+ },
+ category: "citybuilding",
+ state: "solid",
+ density: 1500,
+ cooldown: defaultCooldown,
+ seed: true,
+ maxSize: 1,
+ excludeRandom: true,
+ behavior: behaviors.STURDYPOWDER,
+};
diff --git a/mods/moreViews.js b/mods/moreViews.js
index 33ab23d0..dbd8d9ab 100644
--- a/mods/moreViews.js
+++ b/mods/moreViews.js
@@ -207,8 +207,8 @@ runAfterLoadList.push(() => drawPixels = (function() {
const oldDrawPixels = drawPixels;
return function(forceTick = false) {
- if (view >= 5) {
- if (maxDistance = -1) maxDistance = Math.sqrt((width / 2) ** 2 + (height / 2) ** 2) * 2;
+ if (view >= 4) {
+ if (maxDistance == -1) maxDistance = Math.sqrt((width / 2) ** 2 + (height / 2) ** 2) * 2;
const canvas = document.getElementById("game");
const ctx = canvas.getContext("2d");
@@ -276,8 +276,30 @@ runAfterLoadList.push(() => drawPixels = (function() {
if (pixelMap[pixel.x][pixel.y] == undefined) {continue}
if (pixel.con) { pixel = pixel.con };
ctx.fillStyle = getModeColor(pixel.color, view == 18 ? Math.sqrt((width / 2 - pixel.x) ** 2 + (height / 2 - pixel.y) ** 2) : 0);
+ if (view == 4) {
+ let colorList = [];
+ for (var j = 0; j < biCoords.length; j++) {
+ const x = pixel.x + biCoords[j][0];
+ const y = pixel.y + biCoords[j][1];
+ if (isEmpty(x,y,true) || elements[pixelMap[x][y].element].state !== elements[pixel.element].state) {continue}
+ const color = pixelMap[x][y].color;
+ const [r, g, b] = color.replace(/[rgb()]/g, "").split(",").map(a => parseInt(a.trim()));
+ const [r1, g1, b1] = pixel.color.replace(/[rgb()]/g, "").split(",").map(a => parseInt(a.trim()));
+ if (Math.abs(r - r1) + Math.abs(g - g1) + Math.abs(b - b1) > 75 && pixelMap[x][y].element != pixel.element) continue;
+ if (color.indexOf("rgb") !== -1) {
+ colorList.push(color.match(/\d+/g));
+ }
+ }
+ if (colorList.length === 0) {
+ ctx.fillStyle = pixel.color;
+ }
+ else {
+ ctx.fillStyle = averageRGB(colorList);
+ }
+ ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize);
+ }
// 3D VIEW
- if (view == 5) {
+ else if (view == 5) {
const neighborRight = !outOfBounds(pixel.x + 1, pixel.y) && !!pixelMap[pixel.x + 1][pixel.y];
const neighborUp = !outOfBounds(pixel.x, pixel.y - 1) && !!pixelMap[pixel.x][pixel.y - 1];
const neighborUpRight = !outOfBounds(pixel.x + 1, pixel.y - 1) && !!pixelMap[pixel.x + 1][pixel.y - 1];
diff --git a/mods/nirmod.js b/mods/nirmod.js
new file mode 100644
index 00000000..bcad6ec8
--- /dev/null
+++ b/mods/nirmod.js
@@ -0,0 +1,168 @@
+// helper objects for pixel
+const cat = {
+ TOOLS: "tools",
+ LAND: "land",
+ LIQUIDS: "liquids",
+ LIFE: "life",
+ POWDERS: "powders",
+ SOLIDS: "solids",
+ ENERGY: "energy",
+ WEAPONS: "weapons",
+ GASES: "gases",
+ FOOD: "food",
+ MACHINES: "machines",
+ SPECIAL: "special",
+ STATES: "states",
+}
+const state = {
+ SOLID: "solid",
+ LIQUID: "liquid",
+ GAS: "gas",
+}
+const bb = {
+ POWDER_OLD: behaviors.POWDER_OLD,
+ POWDER: behaviors.POWDER,
+ AGPOWDER: behaviors.AGPOWDER,
+ LIQUID_OLD: behaviors.LIQUID_OLD,
+ LIQUID: behaviors.LIQUID,
+ SUPERFLUID_OLD: behaviors.SUPERFLUID_OLD,
+ SUPERFLUID: behaviors.SUPERFLUID,
+ LIGHTWEIGHT: behaviors.LIGHTWEIGHT,
+ SLIDE: behaviors.SLIDE,
+ AGLIQUID: behaviors.AGLIQUID,
+ WALL: behaviors.WALL,
+ UL_UR: behaviors.UL_UR,
+ UL_UR_OPTIMIZED: behaviors.UL_UR_OPTIMIZED,
+ GAS_OLD: behaviors.GAS_OLD,
+ GAS: behaviors.GAS,
+ DGAS: behaviors.DGAS,
+ SUPPORT: behaviors.SUPPORT,
+ SUPPORTPOWDER: behaviors.SUPPORTPOWDER,
+ DELETE: behaviors.DELETE,
+ FILL: behaviors.FILL,
+ CLONER: behaviors.CLONER,
+ STURDYPOWDER: behaviors.STURDYPOWDER,
+ SELFDELETE: behaviors.SELFDELETE,
+ FOAM: behaviors.FOAM,
+ BUBBLE: behaviors.BUBBLE,
+ STICKY: behaviors.STICKY,
+ MOLTEN: behaviors.MOLTEN,
+ RADPOWDER: behaviors.RADPOWDER,
+ RADMOLTEN: behaviors.RADMOLTEN,
+ RADLIQUID: behaviors.RADLIQUID,
+ BOUNCY: behaviors.BOUNCY,
+ FEEDPIXEL: behaviors.FEEDPIXEL,
+ KILLPIXEL1: behaviors.KILLPIXEL1,
+ KILLPIXEL2: behaviors.KILLPIXEL2,
+ FLY: behaviors.FLY,
+ CRAWLER: behaviors.CRAWLER,
+}
+
+class Type {
+ constructor(name) {
+ this.name = name;
+ this.color = "#ffffff";
+ this.behavior = behaviors.WALL;
+ this.category = "land";
+ this.state = "solid";
+ this.hidden = false;
+ this.density = undefined;
+ this.tempHigh = undefined;
+ this.stateHigh = undefined;
+ this.tempLow = undefined;
+ this.stateLow = undefined;
+ this.temp = undefined;
+ this.reactions = undefined;
+ this.viscosity = undefined;
+ }
+
+ setColor(color) {
+ if (typeof color == "string" && !color.startsWith("#")) color = "#" + color;
+ this.color = color;
+ this.colorObject = hexToRGB(color);
+ }
+ Add() {
+ const {...elem} = this;
+ elements[this.name] = elem;
+ }
+}
+
+function createPowders() {
+ const Ni = new Type("nirme");
+ Ni.setColor("22b14c");
+ Ni.behavior = bb.POWDER;
+ Ni.category = cat.POWDERS;
+ Ni.state = state.SOLID;
+ Ni.density = 1752;
+ Ni.reactions = {
+ "water": { elem1: "dull_nirme", elem2: null },
+ "salt_water": { elem1: "dull_nirme", elem2: null },
+ }
+ Ni.Add();
+
+ const DNi = new Type("dull_nirme");
+ DNi.setColor("5c916c");
+ DNi.behavior = bb.STURDYPOWDER;
+ DNi.category = cat.STATES;
+ DNi.state = state.SOLID;
+ DNi.density = 1752;
+ DNi.hidden = true;
+ DNi.Add();
+
+ const Em = new Type("emerald");
+ Em.setColor(["#00f49f", "#2fe094", "#b3ffd6", "#5fd9c5"]);
+ Em.behavior = bb.POWDER;
+ Em.category = cat.POWDERS;
+ Em.state = state.SOLID;
+ Em.density = 2750;
+ Em.Add();
+}
+
+function createMetals() {
+ const Tg = new Type("thingite");
+ Tg.setColor("4f5263");
+ Tg.behavior = bb.WALL;
+ Tg.category = cat.SOLIDS;
+ Tg.state = state.SOLID;
+ Tg.density = 9408;
+ Tg.tempHigh = 700;
+ Tg.stateHigh = "molten_thingite";
+ Tg.Add();
+
+ const MTg = new Type("molten_thingite");
+ MTg.setColor("5f9cba");
+ MTg.behavior = bb.MOLTEN;
+ MTg.category = cat.STATES;
+ MTg.state = state.LIQUID;
+ MTg.density = 9408;
+ MTg.temp = 700;
+ MTg.tempLow = 600;
+ MTg.stateLow = "thingite";
+ MTg.hidden = true;
+ MTg.Add();
+
+ const Or = new Type("orangium");
+ Or.setColor("b89256");
+ Or.behavior = bb.WALL;
+ Or.category = cat.SOLIDS;
+ Or.state = state.SOLID;
+ Or.density = 12403;
+ Or.tempHigh = 1600;
+ Or.stateHigh = "molten_orangium";
+ Or.Add();
+
+ const MOr = new Type("molten_orangium");
+ MOr.setColor("cca833");
+ MOr.behavior = bb.MOLTEN;
+ MOr.category = cat.STATES;
+ MOr.state = state.LIQUID;
+ MOr.density = 12403;
+ MOr.temp = 1600;
+ MOr.tempLow = 1500;
+ MOr.stateLow = "orangium";
+ MOr.hidden = true;
+ MOr.Add();
+}
+
+createPowders();
+createMetals();
\ No newline at end of file
diff --git a/mods/plants.js b/mods/plants.js
index 23a68e1b..9faf5a52 100644
--- a/mods/plants.js
+++ b/mods/plants.js
@@ -1,9 +1,10 @@
-//This mod was made by Adora the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok.
-let fruits = ["plum", "peach", "pear", "orange", "apple", "cherry", "mango"];
+//This mod was made by Adora the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok. Current version: plans.js v1.1.0
+let fruits = ["plum", "peach", "pear", "orange", "apple", "cherry", "mango", "pineapple", "sugarcane"];
let vineExclude = ["tomato", "grape", "fruit_vine", "kiwi"];
-let vines = ['tomato', 'grape', 'kiwi'];
+let vines = ['tomato', 'grape', 'kiwi', 'watermelon', 'strawberry', 'cucumber'];
let bushes = ["blackberry", "blueberry", "raspberry"];
let allFruits = fruits.concat(vines, bushes)
+let rosaceae = ["plum", "peach", "pear", "apple", "cherry", "blackberry", "raspberry", "strawberry"]
function interpolateRgb(rgb1, rgb2, ratio) {
const interpolatedRgb = {
r: Math.round(rgb1.r + (rgb2.r - rgb1.r) * ratio),
@@ -89,7 +90,7 @@ elements.fruit_leaves = {
let y = pixel.y+adjacentCoords[i][1];
if(isEmpty(x, y) || outOfBounds(x, y)) { continue; }
let pixel2 = pixelMap[x][y];
- if(pixel2.element == "fruit_branch" || pixel2.element == "fruit_leaves" || pixel2.element == "wood" || (elements[pixel2.element].properties && elements[pixel2.element].properties.type == "fruit")){
+ if(pixel2.element == "fruit_branch" || pixel2.element == "fruit_leaves" || pixel2.element == "wood" || (elements[pixel2.element].properties && elements[pixel2.element].properties.type == "fruit") && pixel2.fruit != "pineapple"){
if(pixel.fruit && !pixel2.fruit){
pixel2.fruit = pixel.fruit;
} else if (!pixel.fruit && pixel2.fruit){
@@ -110,6 +111,24 @@ elements.fruit_leaves = {
}
}
}
+ if(pixel.fruit == "pineapple" && isEmpty(pixel.x, pixel.y-1) && !outOfBounds(pixel.x, pixel.y-1) && pixel.age < 300){
+ pixel.blooming = false;
+ pixel.color = elements.plant.color;
+ createPixel("unripe_fruit", pixel.x, pixel.y-1);
+ if(isEmpty(pixel.x, pixel.y-2)){
+ createPixel("unripe_fruit", pixel.x, pixel.y-2);
+ }
+ if(isEmpty(pixel.x, pixel.y-3)){
+ createPixel("fruit_leaves", pixel.x, pixel.y-3);
+ }
+ if(isEmpty(pixel.x-1, pixel.y-4)){
+ createPixel("fruit_leaves", pixel.x-1, pixel.y-4);
+ }
+ if(isEmpty(pixel.x+1, pixel.y-4)){
+ createPixel("fruit_leaves", pixel.x+1, pixel.y-4);
+ }
+ }
+ pixel.age++;
}
}
@@ -1066,6 +1085,8 @@ elements.mango_seed = {
elements.seed_maker = {
category: "machines",
behavior: behaviors.WALL,
+ noMix: true,
+ movable: false,
tick: function(pixel){
for(var i = 0; i < adjacentCoords.length; i++){
let x = pixel.x + adjacentCoords[i][0];
@@ -1074,8 +1095,478 @@ elements.seed_maker = {
let pixel2 = pixelMap[x][y];
if(allFruits.includes(pixel2.element)){
changePixel(pixel2, `${pixel2.element}_seed`)
+ } else if (pixel2.element == "cocoa_pod"){
+ changePixel(pixel2, "cocoa_bean");
}
}
}
}
}
+function xyInRange(x, y, range){
+ let i = 0;
+ while (i < range.length) {
+ if (x === range[i][0] && y === range[i][1]) {
+ i++;
+ return true;
+ } else {
+ i++;
+ }
+
+ }
+ return false;
+
+}
+elements.watermelon = {
+ behavior: behaviors.WALL,
+ color: "#007706",
+ category: "food",
+ breakInto: "juice",
+ breakIntoColor: "#C1674C",
+ isFood: true,
+ properties: {
+ type: "fruit",
+ age: 0,
+ },
+ tick: function(pixel){
+ if(pixel.grow && pixel.age > 400){
+ pixel.grow = false;
+ }
+ if(pixel.grow && pixel.range){
+ for(var i = 0; i < adjacentCoords.length; i++){
+ let x = pixel.x + adjacentCoords[i][0];
+ let y = pixel.y + adjacentCoords[i][1];
+ if(isEmpty(x,y) && xyInRange(x,y,pixel.range) && !outOfBounds(x,y)){
+ if(Math.floor(Math.random() * 300) == 1){
+ createPixel("watermelon", x, y);
+ }
+ }
+
+ }
+ for(var i = 0; i < adjacentCoords.length; i++){
+ let x = pixel.x + adjacentCoords[i][0];
+ let y = pixel.y + adjacentCoords[i][1];
+ if(!isEmpty(x,y) && !outOfBounds(x,y)){
+ let pixel2 = pixelMap[x][y];
+ if(["wood","low_fruit_vine","watermelon"].includes(pixel.element)){
+ if(!pixel2.range || !pixel2.grow){
+ if(pixel.range && !pixel2.range){
+ pixel2.range = pixel.range;
+ }
+ if(pixel.grow && !pixel2.grow){
+ pixel2.grow = pixel.grow;
+ }
+ }
+ if(pixel2.range || pixel2.grow){
+ if(!pixel.range && pixel2.range){
+ pixel.range = pixel2.range;
+ }
+ if(!pixel.grow && pixel2.grow){
+ pixel.grow = pixel2.grow;
+ }
+ }
+ }
+ }
+ }
+ }
+ pixel.age++;
+ }
+}
+let sizes = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 9]
+elements.low_fruit_vine = {
+ color: elements.fruit_vine.color,
+ behavior: behaviors.WALL,
+ tick: function(pixel){
+ if(pixel.fruiting && pixel.fruit == "watermelon"){
+ pixel.fruiting = false;
+ let size = pixel.size;
+ let range = mouseRange(pixel.x, pixel.y + Math.floor(size / 2 + 1), size)
+ if(isEmpty(pixel.x, pixel.y + 1) && !outOfBounds(pixel.x, pixel.y + 1)){
+ createPixel("watermelon", pixel.x, pixel.y + 1);
+ let pixel2 = pixelMap[pixel.x][pixel.y + 1];
+ pixel2.range = range;
+ pixel2.grow = true;
+ }
+ } else {
+ if(isEmpty(pixel.x, pixel.y - 1) && !outOfBounds(pixel.x, pixel.y - 1) && Math.floor(Math.random() * 300) == 1 && pixel.fruit && ![undefined, "watermelon"].includes(pixel.fruit)){
+ createPixel(pixel.fruit, pixel.x, pixel.y - 1);
+ }
+ }
+ if(Math.floor(Math.random() * 100) == 1 && !["watermelon", undefined].includes(pixel.fruit)){
+ eval((Math.floor(Math.random() * 2) == 1) ? `
+ if(isEmpty(pixel.x + 1, pixel.y)){
+ createPixel("low_fruit_vine", pixel.x + 1, pixel.y);
+ pixelMap[pixel.x + 1][pixel.y].fruit = pixel.fruit;
+ }`
+ : `
+ if(isEmpty(pixel.x - 1, pixel.y)){
+ createPixel("low_fruit_vine", pixel.x - 1, pixel.y);
+ pixelMap[pixel.x - 1][pixel.y].fruit = pixel.fruit;
+ }`
+ )
+ }
+ }
+}
+let sizeObj = {
+ size3: [
+ [0,1],
+ [0,2],
+ [1,3],
+ [2,3]
+ ],
+ size5:[
+ [0,1],
+ [0,2],
+ [0,3],
+ [0,4],
+ [1,5],
+ [2,5],
+ [3,5],
+ ],
+ size7: [
+ [0,1],
+ [0,2],
+ [0,3],
+ [0,4],
+ [0,5],
+ [0,6],
+ [1,7],
+ [2,7],
+ [3,7],
+ [4,7],
+ ],
+ size9: [
+ [0,1],
+ [0,2],
+ [0,3],
+ [0,4],
+ [0,5],
+ [0,6],
+ [0,7],
+ [0,8],
+ [1,9],
+ [2,9],
+ [3,9],
+ [4,9],
+ [5,9],
+ ]
+}
+elements.watermelon_seed = {
+ color: "#231A00",
+ category: "life",
+ behavior: behaviors.STURDYPOWDER,
+ tick: function(pixel){
+ if(pixel.start == pixelTicks - 10){
+ pixel.size = sizes[Math.floor(Math.random() * sizes.length)];
+ pixel.direction = Math.floor(Math.random() * 2)
+ pixel.grow = true;
+ }
+ if(pixel.grow && !isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1) && pixelMap[pixel.x][pixel.y + 1].element == "dirt" && pixel.age > 100){
+ pixel.fruit = "watermelon";
+ let sizeList = sizeObj[`size${pixel.size}`];
+ for(var i = 0; i < sizeList.length; i++){
+ let x = (pixel.direction == 1) ? pixel.x - sizeList[i][0] : pixel.x + sizeList[i][0];
+ let y = pixel.y - sizeList[i][1];
+ if(isEmpty(x, y) && !outOfBounds(x, y)){
+ createPixel("low_fruit_vine", x, y);
+ if(i == sizeList.length - 1){
+ pixelMap[x][y].fruiting = true;
+ pixelMap[x][y].size = pixel.size;
+ pixelMap[x][y].fruit = "watermelon";
+ changePixel(pixel,"low_fruit_vine");
+ }
+ }
+ }
+ }
+ pixel.age++;
+ },
+ properties: {
+ age: 0,
+ },
+}
+elements.strawberry = {
+ behavior: behaviors.POWDER,
+ color: "#e5080a",
+ category: "food",
+ breakInto: "juice",
+ breakIntoColor: "#f9c0af",
+ isFood: true,
+ properties: {
+ type: "fruit",
+ age: 0,
+ },
+}
+elements.strawberry_seed = {
+ color: "#ffa371",
+ behavior: behaviors.STURDYPOWDER,
+ category: "life",
+ properties: {
+ age: 0,
+ },
+ tick: function(pixel){
+ if(pixel.age > 40){
+ changePixel(pixel, "low_fruit_vine");
+ pixel.fruit = "strawberry";
+ }
+ pixel.age += 1;
+ }
+}
+elements.cucumber = {
+ behavior: behaviors.POWDER,
+ color: "#285a1b",
+ category: "food",
+ breakInto: "juice",
+ breakIntoColor: "#80b450",
+ isFood: true,
+ properties: {
+ type: "fruit",
+ age: 0,
+ },
+}
+let ages = {
+ pineapple: 140,
+}
+elements.cucumber_seed = {
+ color: "#e9f5b5",
+ behavior: behaviors.STURDYPOWDER,
+ category: "life",
+ properties: {
+ age: 0,
+ },
+ tick: function(pixel){
+ if(pixel.age > 40){
+ changePixel(pixel, "low_fruit_vine");
+ pixel.fruit = "cucumber";
+ }
+ pixel.age += 1;
+ }
+}
+elements.unripe_fruit = {
+ color: "#9eba32",
+ behavior: behaviors.WALL,
+ category: "life",
+ properties: {
+ age: 0,
+ fruit: "pineapple",
+ },
+ tick: function(pixel){
+ if(pixel.age >= ages[pixel.fruit] && Math.floor(Math.random() * 100) == 1){
+ changePixel(pixel, pixel.fruit);
+ }
+ pixel.age++;
+ },
+ breakInto: ["poison", "juice", "cyanide"],
+ breakIntoColor: "#9eba32",
+}
+elements.pineapple = {
+ behavior: [["XX", "ST:fruit_leaves", "XX"],["ST:fruit_leaves", "XX", "ST:fruit_leaves"],["M2", "ST:fruit_leaves AND M1", "M2"]],
+ color: ["#ffcc56", "#e69f05", "#ffc061", "#fad32b"],
+ category: "food",
+ breakInto: "juice",
+ breakIntoColor: "#ffd905",
+ isFood: true,
+ properties: {
+ type: "fruit",
+ age: 0,
+ },
+}
+elements.pineapple_seed = {
+ color: "#7b2700",
+ behavior: behaviors.STURDYPOWDER,
+ category: "life",
+ properties: {
+ age: 0,
+ },
+ tick: function(pixel){
+ if(pixel.age > 40){
+ changePixel(pixel, "fruit_leaves");
+ pixel.fruit = "pineapple";
+ }
+ pixel.age += 1;
+ }
+}
+elements.cocoa_pod = {
+ behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]],
+ color: "#9e5648",
+ category: "food",
+ breakInto: ["cocoa_butter", "cocoa_bean"],
+ isFood: true,
+ properties: {
+ fruit: "cocoa_pod",
+ type: "fruit",
+ }
+}
+elements.cocoa_bean = {
+ behavior: behaviors.POWDER,
+ color: "#ebaf7b",
+ category: "food",
+ isFood: true,
+ properties: {
+ fruit: "cocoa_pod",
+ type: "fruit",
+ age: 0,
+ },
+ tempHigh: 122,
+ stateHigh: "roasted_cocoa_bean",
+ tick: function(pixel) {
+ if (isEmpty(pixel.x,pixel.y+1)) {
+ movePixel(pixel,pixel.x,pixel.y+1);
+ }
+ else {
+ if (Math.random() < 0.02 && pixel.age > 650 && pixel.temp < 120) {
+ if (!outOfBounds(pixel.x,pixel.y+1)) {
+ var dirtPixel = pixelMap[pixel.x][pixel.y+1];
+ if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") {
+ changePixel(dirtPixel,"root");
+ }
+ }
+ if (isEmpty(pixel.x,pixel.y-1)) {
+ movePixel(pixel,pixel.x,pixel.y-1);
+ createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1);
+ if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){
+ pixelMap[pixel.x][pixel.y+1].fruit = "cocoa_pod";
+ }
+ }
+ }
+ else if (pixel.age > 1650) {
+ changePixel(pixel,"wood");
+ }
+ pixel.age++;
+ }
+ doDefaults(pixel);
+ },
+}
+
+elements.cocoa_butter = {
+ behavior: behaviors.STURDYPOWDER,
+ color: "#ddc996",
+ category: "food",
+ isFood: true,
+ tempHigh: 30,
+ stateHigh: "melted_cocoa_butter",
+}
+elements.melted_cocoa_butter = {
+ behavior: behaviors.LIQUID,
+ color: "#c78b06",
+ category: "states",
+ isFood: true,
+ viscosity: 2000,
+ tempLow: 30,
+ stateLow: "cocoa_butter",
+ temp: 30,
+ reactions: {
+ sugar: { elem1: "melted_white_chocolate", elem2: "melted_white_chocolate" }
+ }
+}
+elements.roasted_cocoa_bean = {
+ behavior: behaviors.POWDER,
+ color: "#6b3b24",
+ category: "food",
+ isFood: true,
+ breakInto: "cocoa_powder",
+}
+elements.cocoa_powder = {
+ behavior: behaviors.POWDER,
+ color: "#451f16",
+ category: "food",
+ isFood: true,
+ reactions: {
+ melted_cocoa_butter: { elem1: "chocolate", elem2: "chocolate" }
+ }
+}
+elements.extractor = {
+ category: "machines",
+ noMix: true,
+ movable: false,
+ behavior: behaviors.WALL,
+ tick: function(pixel){
+ for(var i = 0; i < adjacentCoords.length; i++){
+ let x = pixel.x + adjacentCoords[i][0];
+ let y = pixel.y + adjacentCoords[i][1]
+ if(!isEmpty(x,y) && !outOfBounds(x,y)){
+ let pixel2 = pixelMap[x][y];
+ if (pixel2.element == "cocoa_pod"){
+ changePixel(pixel2, "cocoa_butter");
+ } else if (pixel2.element == "sugarcane"){
+ changePixel(pixel2, "sugar");
+ }
+ }
+ }
+ }
+}
+elements.white_chocolate = {
+ "color": "#f4e6cb",
+ "behavior": [
+ [
+ "XX",
+ "XX",
+ "XX"
+ ],
+ [
+ "XX",
+ "XX",
+ "XX"
+ ],
+ [
+ "XX",
+ "M1",
+ "XX"
+ ]
+ ],
+ "tempHigh": 31,
+ "stateHigh": "melted_white_chocolate",
+ "category": "food",
+ "state": "solid",
+ "density": 1325,
+ "isFood": true,
+ "movable": true
+ }
+elements.melted_white_chocolate = {
+ behavior: behaviors.LIQUID,
+ "color": "#f2d184",
+ "tempLow": 0,
+ "stateLow": "white_chocolate",
+ "tempHigh": 99,
+ "stateHigh": [
+ "steam",
+ "sugar"
+ ],
+ "category": "states",
+ "viscosity": 40,
+ "state": "liquid",
+ "density": 1325,
+ "hidden": true,
+ "stain": 0.05,
+ "isFood": true,
+ "movable": true
+ }
+elements.sugarcane_seed = {
+ color: "#c4ae7d",
+ behavior: behaviors.STURDYPOWDER,
+ category: "life",
+ properties: {
+ age: 0,
+ },
+ tick: function(pixel){
+ if(isEmpty(pixel.x, pixel.y-1) && !outOfBounds(pixel.x, pixel.y-1) && Math.floor(Math.random() * 100) == 1 && pixel.age > 40){
+ movePixel(pixel,pixel.x,pixel.y-1);
+ createPixel("sugarcane",pixel.x,pixel.y+1);
+ } else if (!isEmpty(pixel.x, pixel.y-1) && !outOfBounds(pixel.x, pixel.y-1) && pixelMap[pixel.x][pixel.y-1].element == "sugarcane_seed"){
+ deletePixel(pixel.x, pixel.y-1);
+ }
+ if(!pixel.age){
+ pixel.age = 1;
+ } else {
+ pixel.age++;
+ }
+ if(pixel.age == 550){
+ changePixel(pixel, "sugarcane")
+ }
+ }
+}
+elements.sugarcane = {
+ color: "#76881c",
+ breakInto: ["sugar_water", "dead_plant", "dead_plant", "dead_plant"],
+ isFood: true,
+ behavior: behaviors.WALL,
+ category: "food",
+}