diff --git a/mod-list.html b/mod-list.html index 38b5a83e..3f0838ce 100644 --- a/mod-list.html +++ b/mod-list.html @@ -117,7 +117,7 @@ Tools & Settings adjustablepixelsize.jsAllows you to set the pixelSize with a URL parameterAlice -betaworldgen.jsadds a more advanced world generation to the gameAlex +betaworldgen.jsadds a more advanced world generation to the gameAdora betterModManager.jsImprovements to the Mod Managerggod betterSettings.jsAdds additional settings and functionalityggod betterStats.jsSeparate “real” and “set” TPS, meaning you can see what the TPS actually is, instead of only seeing what it’s set tomollthecoder @@ -168,7 +168,7 @@ metals.jsAdds several metalsAlice mixture.jsAllows many chemicals to be mixedlllllllllwith10ls more_gold.jsAdds Green Goldpixelegend4 -morechemistry.jsAdds many new chemicals and compounds as well as some new machinesAlex +morechemistry.jsAdds many new chemicals and compounds as well as some new machinesAdora moreliquids.jsAdds various liquidste-agma-at nellfire.jsAdds a weird transforming flame and several rock typesAlice Neutronium Mod.jsVariety of scientific elements
ExplosionsStellarX20 @@ -235,6 +235,7 @@ nocancer2.jsRemoves cancer from the game altogether. May be incompatible with other mods that spawn cancermollthecoder nograssgrow.jsPrevents Grass from growingmollthecoder pizzasstuff.jsNew animals, foods, and plants_ilikepizza_ +plants.jsAdds a wide variety of new plants and fruitsAdora primordial_birthpool.jsA cross between Primordial Soup and Birthpool. Requires F&MAlice spring.jsMany nature elements, like sakura trees, butterflies, beehives, and moreR74n the_ground_og.jsSimplified and more stable version of the_ground.jsAlice @@ -244,7 +245,7 @@ Fun & Games all_around_fillers.jsAdds directional Filler variantsidk73248 -allliquids.jsMade all elements liquidsAlex +allliquids.jsMade all elements liquidsAdora amogus.jsAdds a small amogus structureAlice collab_mod.jsCreated by multiple people, adds random thingsmrapple, ilikepizza, stefanblox elem3.jsAdds all elements and combinations from Elemental 3 [Very Large]Sophie diff --git a/mods/VCR_OSD_MONO.ttf b/mods/VCR_OSD_MONO.ttf new file mode 100644 index 00000000..93228149 Binary files /dev/null and b/mods/VCR_OSD_MONO.ttf differ diff --git a/mods/aChefsDream.js b/mods/aChefsDream.js index 09ac248d..19a628b3 100644 --- a/mods/aChefsDream.js +++ b/mods/aChefsDream.js @@ -1,19 +1,33 @@ /* -Created by SquareScreamYT and RealerRaddler -Thanks to Alice, nousernamefound and Fioushemastor for helping :) +Created by SquareScreamYT <@918475812884344852> and RealerRaddler <@914371295561535508> +Thanks to Alice <@697799964985786450>, nousernamefound <@316383921346707468>, Adora the Transfem <@778753696804765696> and Fioushemastor <@738828785482203189> for helping :) + +v1.6 + +me trying to come up with stuff not in plants.js: Upcoming Features: - onions - spring onions - soy sauce -- rice +- rice and porridge (white rice noodles) - seaweed and agar - pigs, ham and bacon - garlic - msg - stainless steel - -v1.5 +- chili +- pepper plants +- pineapples +- mint +- vanilla +- cocoa beans and hot chocolate +- normal cookies and cookie dough +- cows and beef +- mangoes and passionfruits +- celery +- marshmallows, normal, cooked and burnt +- broccoli Changelog (v1.0) - added chickens @@ -218,6 +232,27 @@ Changelog (v1.5) - added cookies and cookie dough - replaced cooking oil with nut oil - added boba and boba dough + + + +Changelog (v1.6) + - added freeze and warm tool + - added olive seeds + - juice mixing functionality + - wine can now be made by mixing grape juice and alcohol + - added bananas and related stuff + - bananas + - hanging banana peduncle and banana peduncle + - banana stem and banana stem top + - banana leaves + - cut banana + - banana juice + - banana bread + + + + + */ /* @@ -227,6 +262,19 @@ elements.test = { } */ +function interpolateRgb(rgb1, rgb2, ratio) { + const interpolatedRgb = { + r: Math.round(rgb1.r + (rgb2.r - rgb1.r) * ratio), + g: Math.round(rgb1.g + (rgb2.g - rgb1.g) * ratio), + b: Math.round(rgb1.b + (rgb2.b - rgb1.b) * ratio), + }; + return interpolatedRgb; +} +function getRGB(rgb){ + let rgb2 = rgb.replace(")", "").replace("rgb(", "").replace(/,/g, "r").split("r") + return { r: parseInt(rgb2[0]), g: parseInt(rgb2[1]), b: parseInt(rgb2[2]) }; + } + elements.knife = { color: "#adb5bd", // other needed properties @@ -245,6 +293,8 @@ elements.knife = { desc: "Use on pixels to cut them, if possible." } +eLists.JUICEMIXABLE = ["juice"]; + elements.chicken = { color: ["#c29046", "#f5d271", "#d4bd7d"], behavior: [ @@ -717,6 +767,53 @@ elements.olive = { density: 1050, isFood: false } + +elements.olive_seed = { + color: "#854610", + 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 > 50 && pixel.temp < 100) { + 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 ? "olive_wood" : "olive_branch",pixel.x,pixel.y+1); + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"olive_wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0 + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, + behavior: [ + "XX|XX|XX", + "XX|FX%10|XX", + "XX|M1|XX", + ], +}; /* elements.cooking_oil = { color: "#ffc844", @@ -951,12 +1048,21 @@ elements.apple_juice = { density: 825, hidden: true, temp: 30, + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#ffde55") + } + } + }, reactions: { "sugar": { elem1:"apple_jam", elem2:null, chance:0.35 }, "yeast": { elem1:"apple_cider_vinegar", elem2:null, chance:0.35 } }, tempLow: 0 }; +eLists.JUICEMIXABLE.push("apple_juice"); elements.apple_jam = { color: "#ebc034", @@ -1251,6 +1357,14 @@ elements.orange_seed = { elements.orange_juice = { color: "#ffb326", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#ffde55") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -1264,6 +1378,7 @@ elements.orange_juice = { temp: 30, tempLow: 0 }; +eLists.JUICEMIXABLE.push("orange_juice"); elements.orange_peels = { color: "#d69c31", @@ -1708,6 +1823,14 @@ elements.watermelon_flesh = { elements.watermelon_juice = { color: "#eb4034", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#eb4034") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -1721,6 +1844,7 @@ elements.watermelon_juice = { temp: 30, tempLow: 0 }; +eLists.JUICEMIXABLE.push("watermelon_juice"); elements.grape = { color: ["#b84b65","#a10e69","#a10e95","#8a3eab"], @@ -1755,6 +1879,14 @@ elements.grape = { elements.grape_juice = { color: "#6d2282", behavior: behaviors.LIQUID, + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel, "#6d2282") + } + } + }, reactions: { "dirt": { elem1: null, elem2: "mud" }, "sand": { elem1: null, elem2: "wet_sand" }, @@ -1762,6 +1894,7 @@ elements.grape_juice = { "seltzer": { elem1: "soda", elem2: "foam" }, "carbon_dioxide": { elem1: "soda", elem2: "foam" }, "milk": { elem1: "fruit_milk", elem2: "fruit_milk" }, + "alcohol": { elem1: "wine", elem2: "wine" }, "yeast": { elem1: ["wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","wine","cream_of_tartar"], elem2: null, chance:80 }, }, tempHigh: 160, @@ -1774,6 +1907,7 @@ elements.grape_juice = { hidden: true, isFood: true }; +eLists.JUICEMIXABLE.push("grape_juice"); elements.cream_of_tartar = { color: ["#EFEFEF", "#EBEBEB", "#D8D8D6"], @@ -1817,6 +1951,14 @@ elements.wine = { behavior: behaviors.LIQUID, category: "liquids", state: "liquid", + /*onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel, "#6D0112") + } + } + },*/ tempHigh: 100, stateHigh: "steam", isFood: true, @@ -1824,6 +1966,7 @@ elements.wine = { hidden: true, tempLow: 0 } +//eLists.JUICEMIXABLE.push("wine"); elements.shrimp = { color: ["#EE5422", "#E9683C", "#F3583F", "#EDA270"], @@ -2118,6 +2261,14 @@ elements.cut_coconut = { elements.coconut_juice = { color: "#e9ebe4", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#e9ebe4") + } + } + }, behavior: behaviors.LIQUID, reactions: { "dirt": { elem1: null, elem2: "mud" }, @@ -2135,6 +2286,7 @@ elements.coconut_juice = { hidden: true, isFood: true } +eLists.JUICEMIXABLE.push("coconut_juice"); elements.lemon_wood = { color: "#786531", @@ -2224,6 +2376,14 @@ elements.lemon = { elements.lemon_juice = { color: "#e0d358", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#e0d358") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -2241,9 +2401,18 @@ elements.lemon_juice = { "sugar": {elem1:"lemonade", elem2: "null", chance:0.35} } }; +eLists.JUICEMIXABLE.push("lemon_juice"); elements.lemonade = { color: "#fff378", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#fff378") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -2259,6 +2428,8 @@ elements.lemonade = { tempLow: 0 }; +eLists.JUICEMIXABLE.push("lemonade"); + elements.lemon_zest = { color: "#dbc535", behavior: behaviors.POWDER, @@ -2444,6 +2615,14 @@ elements.carrot = { elements.carrot_juice = { color: "#f5a742", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#f5a742") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -2457,9 +2636,18 @@ elements.carrot_juice = { hidden: true, temp: 30, }; +eLists.JUICEMIXABLE.push("carrot_juice"); elements.apple_cider_vinegar = { color: "#fffe75", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#fffe75") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -2473,6 +2661,7 @@ elements.apple_cider_vinegar = { temp: 30, tempLow: 0 }; +eLists.JUICEMIXABLE.push("apple_cider_vinegar"); elements.turnip_seed = { color: "#994828", @@ -2593,6 +2782,14 @@ elements.turnip = { elements.turnip_juice = { color: "#700f5d", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#700f5d") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -2606,6 +2803,7 @@ elements.turnip_juice = { hidden: true, temp: 30, }; +eLists.JUICEMIXABLE.push("turnip_juice"); elements.corn = { color: ["#f8d223","#d6ba2a","#f7f5ba","#dbd281","#cdb12d"], @@ -2644,8 +2842,8 @@ elements.corn_starch = { "seltzer": { elem1: "dough", elem2: null }, "pool_water": { elem1: "dough", elem2: null }, "juice": { elem1: "dough", elem2: null }, - "yolk": { elem1: "batter", elem2: null }, - "yogurt": { elem1: "batter", elem2: null }, + "yolk": { elem1: "cookie_dough", elem2: null, color1:"#dbd19a" }, + "yogurt": { elem1: "cookie_dough", elem2: null, color1:"#dbd19a" }, "broth": { elem1:"dough", elem2:null }, "soda": { elem1:"dough", elem2:null }, "tea": { elem1:"dough", elem2:null }, @@ -2941,6 +3139,14 @@ elements.strawberry = { } elements.strawberry_juice = { color: "#e03a3a", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#e03a3a") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -2957,6 +3163,7 @@ elements.strawberry_juice = { "sugar": { elem1:"strawberry_jam", elem2:null, chance:0.35 }, }, }; +eLists.JUICEMIXABLE.push("strawberry_juice"); elements.cream = { color: "#f7f7f7", @@ -3152,6 +3359,14 @@ elements.ginger_leaves = { } elements.ginger_juice = { color: "#ccc056", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#ccc056") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -3169,6 +3384,7 @@ elements.ginger_juice = { "bread": { elem1:"gingerbread", elem2:null }, }, }; +eLists.JUICEMIXABLE.push("ginger_juice"); elements.blueberry_seed = { @@ -3314,6 +3530,14 @@ elements.blueberry = { } elements.blueberry_juice = { color: "#5030a1", + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#5030a1") + } + } + }, behavior: behaviors.LIQUID, category: "liquids", tempHigh: 100, @@ -3331,6 +3555,8 @@ elements.blueberry_juice = { "milk": { elem1:"fruit_milk", elem2:null, chance:0.35, color1: "#995fb3" }, }, }; + +eLists.JUICEMIXABLE.push("blueberry_juice"); /* elements.fruit_slushie = { color: "#ffcc54", @@ -3399,7 +3625,8 @@ elements.cut_blueberry = { burn:15, burnTime:60, burnInto: "dead_plant", - breakInto: "blueberry_juice", + breakInto: "juice", + breakIntoColor:"#add69a", state: "solid", density: 1050, hidden: true @@ -3437,7 +3664,7 @@ elements.cookie_dough = { category: "food", tempHigh: 94, stateHigh: "cookie", - stateHighColorMultiplier: 0.8, + stateHighColorMultiplier: 1.1, burn:40, burnTime:25, burnInto:"ash", @@ -3465,7 +3692,7 @@ elements.cookie = { elements.nut_oil.name = "cooking_oil" -// elements.fire.temp = 130 +elements.fire.temp = 130 elements.bread.behavior = behaviors.SUPPORT @@ -3504,6 +3731,492 @@ elements.boba = { burnInto: ["smoke","smoke","smoke","ash"], breakIntoColor: "#7d6216", state: "solid", - density: 644, + density: 1500, + isFood: true +} +elements.caramel.density = 1500 +elements.freeze = { + color: ["#42cbf5", "#42cbf5", "#42cbf5", "#75d3f0", "#42cbf5"], + tool: function (pixel) { + if (!shiftDown) { + pixel.temp -= 0.2; + pixelTempCheck(pixel); + } else { + pixel.temp -= 200; + pixelTempCheck(pixel); + } + }, + category: "energy", + canPlace: false, + excludeRandom: true, + desc: "Use on pixels to freeze them." +}; +elements.warm = { + color: ["#c7634a", "#c7634a", "#c7634a", "#e38f7b", "#c7634a"], + tool: function (pixel) { + if (!shiftDown) { + pixel.temp += 0.2; + pixelTempCheck(pixel); + } else { + pixel.temp += 200; + pixelTempCheck(pixel); + } + }, + category: "energy", + canPlace: false, + excludeRandom: true, + desc: "Use on pixels to warm them." +}; +/* +elements.pineapple_seed = { + color: "#695531", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (pixel.temp < 100 && pixel.temp > 20) { + if (Math.random() < 0.02 && pixel.age > 50) { + 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"); + pixel.leaflength = pixel.leaflength+Math.round(Math.random()) + } + } + if (isEmpty(pixel.x,pixel.y-1) && pixel.leafgrown==false) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel("pineapple_leaves",pixel.x,pixel.y+1); + if (isEmpty(pixel.x,pixel.y-1)) { + createPixel("pineapple",pixel.x,pixel.y-1); + } + if (isEmpty(pixel.x+1,pixel.y) && Math.random() < 0.5) { + createPixel("pineapple_leaves",pixel.x+1,pixel.y); + if (isEmpty(pixel.x+2,pixel.y-1) && Math.random() < 0.5) { + createPixel("pineapple_leaves",pixel.x+2,pixel.y-1); + if (pixel.leaflength == 4 && isEmpty(pixel.x+3,pixel.y-2) && Math.random() < 0.5) { + createPixel("pineapple_leaves",pixel.x+3,pixel.y-2); + pixel.leafgrown = true + } + } + } + if (isEmpty(pixel.x-1,pixel.y) && Math.random() < 0.5) { + createPixel("pineapple_leaves",pixel.x-1,pixel.y); + if (isEmpty(pixel.x-2,pixel.y-1) && Math.random() < 0.5) { + createPixel("pineapple_leaves",pixel.x-2,pixel.y-1); + if (pixel.leaflength = 3) { + pixel.leafgrown = true + } + if (pixel.leaflength = 4 && isEmpty(pixel.x-3,pixel.y-2) && isEmpty(pixel.x+3,pixel.y-2) && Math.random() < 0.5) { + createPixel("pineapple_leaves",pixel.x-3,pixel.y-2); + createPixel("pineapple_leaves",pixel.x+3,pixel.y-2); + pixel.leafgrown = true + } + } + } + } + } + else if (pixel.age > 500 && leafgrown == true && Math.random() < 0.1) { + changePixel(pixel,"pineapple_leaves"); + } + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + "leaflength":3, + "leafgrown":false, + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, + temp:25, + behavior: [ + "XX|XX|XX", + "XX|FX%10|XX", + "XX|M1|XX", + ], +}; +*//* +function averageHexColor(color1, color2) { + const rgb1 = hexToRgb(color1); + const rgb2 = hexToRgb(color2); + const avgRed = Math.floor((rgb1[0] + rgb2[0]) / 2); + const avgGreen = Math.floor((rgb1[1] + rgb2[1]) / 2); + const avgBlue = Math.floor((rgb1[2] + rgb2[2]) / 2); + const avgHex = rgbToHex(avgRed, avgGreen, avgBlue); + return avgHex; +} + +function hexToRgb(hex) { + hex = hex.replace(/^#/, ''); + const r = parseInt(hex.substring(0, 2), 16); + const g = parseInt(hex.substring(2, 4), 16); + const b = parseInt(hex.substring(4, 6), 16); + return [r, g, b]; +} + +function rgbToHex(r, g, b) { + const rHex = r.toString(16).padStart(2, '0'); + const gHex = g.toString(16).padStart(2, '0'); + const bHex = b.toString(16).padStart(2, '0'); + return `${rHex}${gHex}${bHex}`; +} +*/ +// test +//var color1 = "#FF0000"; +//var color2 = "#0000FF"; +//var averageColor = averageHexColor(color1, color2); +//console.log(averageColor) +/* +eLists.JUICEMIXABLE.forEach(function(element){ + elements[element].onMix = function(pixel1,pixel2) { + if (shiftDown && eLists.JUICEMIXABLE.indexOf(pixel2.element) !== -1) { + if (Math.random() < 0.2) { + var hex1 = pixel1.color + var hex2 = pixel2.color + let rgb = pixel.color.replace("rgb(", "").replace(")", "").split(","); + let rgbObj = { r: parseInt(rgb[0]), g: parseInt(rgb[1]), b: parseInt(rgb[2]) } //use this as one of the rgb objects + var finalJuiceColor = interpolatedRgb(hex1,hex2,0.5) + changePixel(pixel1,"juice") + //pixel1.color = pixelColorPick(pixel,finalJuiceColor) + pixel1.color = rgb(rgbObj) + } + } +} +})*/ +elements.juice.onMix = function(pixel){ + let num = Math.floor(Math.random() * 4); + let x = pixel.x + adjacentCoords[num][0]; + let y = pixel.y + adjacentCoords[num][1]; + if(!isEmpty(x,y) && !outOfBounds(x,y)){ + let pixel2 = pixelMap[x][y]; + if(pixel.color != pixel2.color && pixel2.element == "juice"){ + let condition; + if(shiftDown == 0){ + condition = (Math.floor(Math.random() * 2) == 1); + } else { + condition = true; + } + if(condition){ + let newrgb = interpolateRgb(getRGB(pixel.color), getRGB(pixel2.color), 0.5); + pixel.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + } + } + } + } + +elements.juice.stain = 0 + +elements.banana_seed = { + color: "#594129", + tick: function(pixel) { + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100) { + 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) && pixel.height < 7) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel("banana_stem",pixel.x,pixel.y+1); + + pixel.height++ + } + } + else if (pixel.age > 150 && pixel.height > 6 && Math.random() < 0.1) { + changePixel(pixel,"banana_tree_top"); + } + pixel.age++; + doDefaults(pixel); + }, + properties: { + "age":0, + "height": 0 + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|M1|XX", + ], +}; +elements.banana_stem = { + color: "#698215", + behavior: behaviors.WALL, + tempHigh: 400, + stateHigh: ["ember","charcoal","fire","fire","fire"], + category: "life", + burn: 5, + burnTime: 300, + burnInto: ["ember","charcoal","fire"], + state: "solid", + hardness: 0.15, + breakInto: "sawdust", + breakIntoColor: ["#dba66e","#cc8a64"], + hidden: true +} +elements.banana_tree_top = { + color: "#718a21", + behavior: behaviors.WALL, + tempHigh: 400, + stateHigh: ["ember","charcoal","fire","fire","fire"], + category: "life", + burn: 5, + burnTime: 300, + burnInto: ["ember","charcoal","fire"], + state: "solid", + hardness: 0.15, + breakInto: "sawdust", + breakIntoColor: ["#dba66e","#cc8a64"], + properties:{ + "leftleaves": 0, + "rightleaves": 0, + }, + hidden: true, + tick: function(pixel) { + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100 && pixel.rightleaves == 0) { + if (isEmpty(pixel.x+1,pixel.y)) { + createPixel("banana_leaves",pixel.x+1,pixel.y); + + pixel.rightleaves++ + } + } + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100 && pixel.rightleaves == 1) { + if (isEmpty(pixel.x+2,pixel.y)) { + createPixel("banana_leaves",pixel.x+2,pixel.y); + + pixel.rightleaves++ + } + } + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100 && pixel.rightleaves == 2) { + if (isEmpty(pixel.x+3,pixel.y)) { + createPixel("banana_leaves",pixel.x+3,pixel.y); + + pixel.rightleaves++ + } + } + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100 && pixel.rightleaves == 3) { + if (isEmpty(pixel.x+4,pixel.y+1)) { + createPixel("banana_leaves",pixel.x+4,pixel.y+1); + + pixel.rightleaves++ + } + } + + + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100 && pixel.leftleaves == 0) { + if (isEmpty(pixel.x-1,pixel.y)) { + createPixel("banana_leaves",pixel.x-1,pixel.y); + + pixel.leftleaves++ + } + } + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100 && pixel.leftleaves == 1) { + if (isEmpty(pixel.x-2,pixel.y)) { + createPixel("banana_leaves",pixel.x-2,pixel.y); + + pixel.leftleaves++ + } + } + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100 && pixel.leftleaves == 2) { + if (isEmpty(pixel.x-3,pixel.y)) { + createPixel("banana_leaves",pixel.x-3,pixel.y); + + pixel.leftleaves++ + } + } + if (Math.random() < 0.1 && pixel.age > 50 && pixel.temp < 100 && pixel.leftleaves == 3) { + if (isEmpty(pixel.x-4,pixel.y+1)) { + createPixel("banana_leaves",pixel.x-4,pixel.y+1); + + pixel.leftleaves++ + } + } + + + if (Math.random() < 0.1 && pixel.age > 70 && pixel.temp < 100 && pixel.leftleaves > 0 && pixel.rightleaves > 0) { + if (isEmpty(pixel.x+1,pixel.y+2)) { + createPixel("banana_peduncle",pixel.x+1,pixel.y+2); + } + } + if (Math.random() < 0.1 && pixel.age > 70 && pixel.temp < 100 && pixel.leftleaves > 0 && pixel.rightleaves > 0) { + if (isEmpty(pixel.x-1,pixel.y+2)) { + createPixel("banana_peduncle",pixel.x-1,pixel.y+2); + } + } + pixel.age++; + doDefaults(pixel); + }, +} +elements.banana_leaves = { + color: ["#3da324","#3cbd1c"], + reactions: { + "vinegar": { elem1:"dead_plant", elem2:null, chance:0.035 }, + "baking_soda": { elem1:"dead_plant", elem2:null, chance:0.01 }, + "bleach": { elem1:"dead_plant", elem2:null, chance:0.05 }, + "alcohol": { elem1:"dead_plant", elem2:null, chance:0.035 } + }, + category:"life", + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -1.66, + stateLow: "frozen_plant", + burn:65, + burnTime:60, + burnInto: "dead_plant", + breakInto: "dead_plant", + state: "solid", + density: 1050, + hidden: true +} +elements.banana_peduncle = { + color: "#8bb81a", + behavior: behaviors.WALL, + tempHigh: 400, + stateHigh: ["ember","charcoal","fire","fire","fire"], + category: "life", + burn: 5, + burnTime: 300, + burnInto: ["ember","charcoal","fire"], + state: "solid", + hardness: 0.15, + breakInto: "sawdust", + hidden: true, + tick: function(pixel) { + if (Math.random() < 0.1 && pixel.temp < 100) { + if (isEmpty(pixel.x+1,pixel.y+1)) { + createPixel("hanging_banana_peduncle",pixel.x+1,pixel.y+1); + } + if (isEmpty(pixel.x-1,pixel.y+1)) { + createPixel("hanging_banana_peduncle",pixel.x-1,pixel.y+1); + } + if (isEmpty(pixel.x+1,pixel.y+2)) { + createPixel("hanging_banana_peduncle",pixel.x+1,pixel.y+2); + } + if (isEmpty(pixel.x-1,pixel.y+2)) { + createPixel("hanging_banana_peduncle",pixel.x-1,pixel.y+2); + } + } + pixel.age++; + doDefaults(pixel); + }, +} +elements.hanging_banana_peduncle = { + color: "#8bb81a", + behavior: [ + "XX|XX|XX", + "CR:banana%0.2|XX|CR:banana%0.2", + "XX|XX|XX", + ], + tempHigh: 400, + stateHigh: ["ember","charcoal","fire","fire","fire"], + category: "life", + burn: 5, + burnTime: 300, + burnInto: ["ember","charcoal","fire"], + state: "solid", + hardness: 0.15, + breakInto: "sawdust", + hidden: true, +} +elements.banana = { + color: "#ebd834", + behavior: [ + "XX|XX|XX", + "ST:hanging_banana_peduncle|XX|ST:hanging_banana_peduncle", + "XX|M1|XX", + ], + category:"food", + tempHigh: 100, + stateHigh: "dead_plant", + burn:15, + burnTime:60, + burnInto: "dead_plant", + breakInto: "banana_juice", + state: "solid", + density: 1050, + cutInto: "cut_banana" +} +elements.cut_banana = { + color: "#f2e56b", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "M2|M1|M2", + ], + category:"food", + tempHigh: 100, + stateHigh: "dead_plant", + burn:15, + burnTime:60, + burnInto: "dead_plant", + breakInto: "banana_juice", + state: "solid", + density: 1050, +} +elements.banana_juice = { + color: "#dbc440", + behavior: behaviors.LIQUID, + category: "liquids", + tempHigh: 100, + stateHigh: ["steam","sugar"], + burn: 70, + burnTime: 300, + burnInto: ["steam", "smoke"], + state: "liquid", + density: 825, + hidden: true, + temp: 30, + onMix: function(pixel) { + if (shiftDown) { + if (Math.random() < 0.2) { + changePixel(pixel,"juice") + pixel.color = pixelColorPick(pixel,"#dbc440") + } + } + }, + reactions: { + "bread": { elem1:"banana_bread", elem2:null, chance:0.35 }, + }, + tempLow: 0 +}; +eLists.JUICEMIXABLE.push("banana_juice"); + +elements.banana_bread = { + color: "#c2782f", + desc: "delicious banana bread", + behavior: behaviors.STURDYPOWDER, + tempHigh: 176, + stateHigh: "toast", + category: "food", + burn: 30, + burnTime: 200, + burnInto: ["smoke","smoke","smoke","ash"], + breakInto: "crumb", + state: "solid", + density: 233.96, isFood: true } diff --git a/mods/a_mod_by_alice.js b/mods/a_mod_by_alice.js index 804e1714..873f89a3 100644 --- a/mods/a_mod_by_alice.js +++ b/mods/a_mod_by_alice.js @@ -2136,9 +2136,9 @@ try { }; }; - function capitalizeFirstLetter(string,locale=null) { - return string[0][locale ? "toLocaleUpperCase" : "toUpperCase"](locale) + string.slice(1) - }; + function capitalizeFirstLetter(string,locale=null) { + return string[0][locale ? "toLocaleUpperCase" : "toUpperCase"](locale) + string.slice(1) + }; //COLOR MANIPULATION TOOLS ## @@ -36321,7 +36321,7 @@ Make sure to save your command in a file if you want to add this preset again.` newPixel.vx ??= 0; newPixel.vy ??= 0; newPixel.vx += (pixel.direction * 5) - newPixel.vy += 3; + newPixel.vy -= 3; }; }; pixel.fromX += pixel.direction @@ -36406,7 +36406,7 @@ Make sure to save your command in a file if you want to add this preset again.` newPixel.vx ??= 0; newPixel.vy ??= 0; newPixel.vx += (pixel.direction * 13) - newPixel.vy += 6; + newPixel.vy -= 6; }; }; pixel.fromX += pixel.direction @@ -36503,7 +36503,7 @@ Make sure to save your command in a file if you want to add this preset again.` newPixel.vx ??= 0; newPixel.vy ??= 0; newPixel.vx += (pixel.direction * 6) - newPixel.vy += 3; + newPixel.vy -= 3; }; }; pixel.fromX += pixel.direction @@ -36598,7 +36598,7 @@ Make sure to save your command in a file if you want to add this preset again.` newPixel.vx ??= 0; newPixel.vy ??= 0; newPixel.vx += (pixel.direction * 8) - newPixel.vy += 5; + newPixel.vy -= 5; }; }; pixel.fromX += pixel.direction diff --git a/mods/allliquids.js b/mods/allliquids.js index ae92e535..80a6bfd1 100644 --- a/mods/allliquids.js +++ b/mods/allliquids.js @@ -1,21 +1,24 @@ +//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 liquid = [["XX", "XX", "XX"], ["M1", "XX", "M1"], ["M1", "M2", "M1"]] -for (var element in elements){ - - let a = elements[element].behavior; - console.log(a, elements[element], liquid) - if(a != undefined && typeof a != 'function'){ - let i = 0; - while (i < a.length){ - if(typeof a[i] == "string"){ - a[i] = a[i].split("|"); - i += 1; - } else { - i += 1; +runAfterLoad(function(){ + for (var element in elements){ + elements[element].noMix = false; + let a = elements[element].behavior; + console.log(a, elements[element], liquid) + if(a != undefined && typeof a != 'function'){ + let i = 0; + while (i < a.length){ + if(typeof a[i] == "string"){ + a[i] = a[i].split("|"); + i += 1; + } else { + i += 1; + } } + elements[element].behavior = [[a[0][0], a[0][1], a[0][2]], [`${a[1][0]} AND M1`, a[1][1], `${a[1][2]} AND M1`], [`${a[2][0]} AND M1`, `${a[2][1]} AND M2`, `${a[2][2]} AND M1`]]; + } else { + elements[element].behavior = liquid; } - elements[element].behavior = [[a[0][0], a[0][1], a[0][2]], [`${a[1][0]} AND M1`, a[1][1], `${a[1][2]} AND M1`], [`${a[2][0]} AND M1`, `${a[2][1]} AND M2`, `${a[2][2]} AND M1`]]; - } else { - elements[element].behavior = liquid; + } - -} +}); diff --git a/mods/jaydstuff.js b/mods/jaydstuff.js new file mode 100644 index 00000000..75c752bb --- /dev/null +++ b/mods/jaydstuff.js @@ -0,0 +1,286 @@ +//jaydstuff +elements.super_raincloud = { + color: "#0000ff", + behavior: [ + "XX|M1%10|XX", + "M1%5|XX|M1%5", + "CR:water%40|CR:water%40|CR:water%40", + ], + category: "gases", + state: "gas", + density: 50, +}, +elements.deuterium = { + color: "#558bcf", + behavior: behaviors.GAS, + reactions: { + "oxygen": { elem1:null, elem2:"heavy_steam", tempMin:500 }, + "tritium": { elem1:"neutron", elem2:"helium", tempMin:100000000, temp1:150000000, temp2:150000000 }, + "fire": { elem1:"explosion", chance:0.005 }, + }, + category: "gases", + burn: 100, + burnTime: 2, + burnInto: ["fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","heavy_steam"], + tempLow: -253, + stateLow: "liquid_deuterium", + state: "gas", + density: 0.180, + conduct: 0.02, + colorOn: "#d6462d" +}, +elements.liquid_deuterium = { + color: "#97afcf", + behavior: behaviors.LIQUID, + reactions: { + "liquid_oxygen": { elem1:"heavy_ice", elem2:null }, + "oxygen": { elem1:"ice", elem2:null } + }, + category: "states", + burn: 100, + burnTime: 2, + temp: -255.879, + tempHigh: -252.879, + stateHigh: "hydrogen", + tempLow: -259.2, + state: "liquid", + density: 163.83, + hidden: true +}, +elements.tritium = { + color: "#558bcf", + behavior: [ + "M2|M1 AND CR:radiation%1|M2", + "M1|XX|M1", + "M2|M1 AND CR:radiation%0.5|M2", + ], + reactions: { + "oxygen": { elem1:null, elem2:"tritiated_steam", tempMin:500 }, + "deuterium": { elem1:"neutron", elem2:"helium", tempMin:100000000, temp1:150000000, temp2:150000000 }, + "fire": { elem1:"explosion", chance:0.005 }, + }, + category: "gases", + burn: 100, + burnTime: 2, + burnInto: ["fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","steam"], + tempLow: -253, + stateLow: "liquid_tritium", + state: "gas", + density: 0.269, + conduct: 0.02, + colorOn: "#d6462d" +}, +elements.liquid_tritium = { + color: "#97afcf", + behavior: [ + "XX|CR:radiation%1|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + reactions: { + "liquid_oxygen": { elem1:"tritiated_ice", elem2:null }, + "oxygen": { elem1:"ice", elem2:null } + }, + category: "states", + burn: 100, + burnTime: 2, + temp: -255.879, + tempHigh: -252.879, + stateHigh: "tritium", + tempLow: -259.2, + state: "liquid", + density: 213, + hidden: true +}, +elements.heavy_water = { + color: "#2167ff", + behavior: behaviors.LIQUID, + tempHigh: 101.4, + stateHigh: "heavy_steam", + tempLow: 0, + stateLow: "heavy_ice", + category: "liquids", + heatCapacity: 4.184, + reactions: { + // electrolysis: + "aluminum": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0025 }, + "zinc": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.015 }, + "steel": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0125 }, + "iron": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0125 }, + "tin": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.01 }, + "brass": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.001 }, + "bronze": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.001 }, + "copper": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + "silver": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + "gold": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + }, + state: "liquid", + density: 1107, + conduct: 0.02, + stain: -0.5, + extinguish: true +}, +elements.heavy_steam = { + color: "#abd6ff", + behavior: behaviors.GAS, + reactions: { + "copper": { elem1:"oxygen", elem2:"oxidized_copper", chance:0.01 }, + "bronze": { elem1:"oxygen", elem2:"oxidized_copper", chance:0.005 }, + "iron": { elem1:"oxygen", elem2:"rust", chance:0.005 }, + "steel": { elem1:"oxygen", elem2:"rust", chance:0.004 }, + }, + temp: 150, + tempLow: 95, + extraTempLow: { + 0: "heavy_rime" + }, + stateLow: "heavy_water", + category: "gases", + state: "gas", + density: 1, + conduct: 0.002, + stain: -0.05, + alias: "heavy water vapor", + extinguish: true +}, +elements.heavy_ice = { + color: "#b2daeb", + behavior: behaviors.WALL, + temp: -5, + tempHigh: 5, + stateHigh: "heavy_water", + category: "solids", + state: "solid", + density: 1014.202, + breakInto: "heavy_snow" +}, +elements.tritiated_water = { + color: "#2167ff", + behavior: [ + "XX|CR:radiation%1|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + tempHigh: 101.4, + stateHigh: "tritiated_steam", + tempLow: 0, + stateLow: "tritiated_ice", + category: "liquids", + heatCapacity: 4.184, + reactions: { + // electrolysis: + "aluminum": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0025 }, + "zinc": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.015 }, + "steel": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0125 }, + "iron": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0125 }, + "tin": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.01 }, + "brass": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.001 }, + "bronze": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.001 }, + "copper": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + "silver": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + "gold": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + }, + state: "liquid", + density: 1107, + conduct: 0.02, + stain: -0.5, + extinguish: true +}, +elements.tritiated_steam = { + color: "#abd6ff", + behavior: [ + "M2|M1 AND CR:radiation%1|M2", + "M1|XX|M1", + "M2|M1 AND CR:radiation%0.5|M2", + ], + reactions: { + "copper": { elem1:"oxygen", elem2:"oxidized_copper", chance:0.01 }, + "bronze": { elem1:"oxygen", elem2:"oxidized_copper", chance:0.005 }, + "iron": { elem1:"oxygen", elem2:"rust", chance:0.005 }, + "steel": { elem1:"oxygen", elem2:"rust", chance:0.004 }, + }, + temp: 150, + tempLow: 95, + extraTempLow: { + 0: "heavy_rime" + }, + stateLow: "tritiated_water", + category: "gases", + state: "gas", + density: 0.6, + conduct: 0.002, + stain: -0.05, + alias: "tritiated water vapor", + extinguish: true +}, +elements.tritiated_ice = { + color: "#b2daeb", + behavior: [ + "XX|CR:radiation%0.25|XX", + "CR:radiation%0.25|XX|CR:radiation%0.25", + "XX|CR:radiation%0.25|XX", + ], + temp: -5, + tempHigh: 5, + stateHigh: "tritiated_water", + category: "solids", + state: "solid", + density: 1014.202, + breakInto: "tritiated_snow" +}, +elements.fusion = { + color: "#ffffff", + tool: function(pixel) { + pixel.temp = 100000000; + pixelTempCheck(pixel) + }, + category: "tools", +}, +elements.meese = { + color: "#996515", + behavior: [ + "XX|XX|XX", + "XX|FX%0.25|M2%0.5 AND BO", + "XX|M1|XX", + ], + category: "life" +}, +elements.fluoroantimonic_acid = { + color: ["#b5cf91","#a1ff5e","#288f2a"], + behavior: [ + "XX|DB%5|XX", + "DB%5 AND M2|XX|DB%5 AND M2", + "DB%5 AND M2|DB%10 AND M1|DB%5 AND M2", + ], + ignore: ["glass","rad_glass","glass_shard","rad_shard","stained_glass","baked_clay","acid_gas","neutral_acid","copper","gold","porcelain"], + category: "liquids", + state: "liquid", + density: 2885, + hidden: true, + stain: -0.1, +}, +elements.tritium_ice = { + color: "#b5d2ff", + behavior: [ + "XX|CR:radiation%0.25|XX", + "CR:radiation%0.25|XX|CR:radiation%0.25", + "XX|CR:radiation%0.25|XX", + ], + temp: -259, + tempHigh: -256, + stateHigh: "liquid_tritium", + category: "states", + state: "solid", + density: 258, +}, +elements.unstain = { + category: "tools", + stain: -1, + tool: (pixel) => { + doStaining({ + element: "unstain", + x: pixel.x, + y: pixel.y + }) + } +}; \ No newline at end of file diff --git a/mods/moreViews.js b/mods/moreViews.js new file mode 100644 index 00000000..33ab23d0 --- /dev/null +++ b/mods/moreViews.js @@ -0,0 +1,481 @@ +if (!enabledMods.includes("mods/betterSettings.js")) { enabledMods.unshift("mods/betterSettings.js"); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); alert("'betterSettings.js' is a dependency for 'moreViews.js' and has been added. Please reload for it to take effect.") } +else { +const views = [ + // default sandboxels + "Default View", + "", + "Thermal View", + "Basic View", + "Smooth View", + // custom + "3D View", + "Inverted", + "Darker", + "Brighter", + "Gray scale", + "Sepia", + "Hue rotation 180°", + "Saturated", + "Time", + "Anaglyph", + "VHS (VCR)", + "Outline", + "Upside down", + "Vignette" +]; + +setView = (n) => { + if (n <= views.length - 1 && n > 1) { + view = n; + } else { + view = null; + } + setSetting('view', parseInt(view)); + document.querySelector('span[setting="view"]').children[0].value = view ?? 0; +} + +for (const i in views) { + if (i < 5) continue; + const option = document.createElement("option"); + option.setAttribute("value", i); + option.innerText = views[i]; + document.querySelector('.setting-span[setting="view"]').querySelector("select").appendChild(option); + viewKey[i] = views[i]; +} + +const vcrFont = new FontFace("VCR", "url(mods/VCR_OSD_MONO.ttf)"); +vcrFont.load().then(font => { + console.log(font); + document.fonts.add(font); +}) + +function blending(color, color2, t = 0.5) { + const [r, g, b] = parseColor(color).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + const [r2, g2, b2] = parseColor(color2).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + if ([r, g, b].includes(undefined) || [r, g, b, t].includes(NaN)) console.log([r, g, b, t], parseColor(color), color); + return `#${[ + (1 - t) * r + t * r2, + (1 - t) * g + t * g2, + (1 - t) * b + t * b2 + ].map(a => Math.floor(a).toString(16).padStart(2, "0")).join("")}`; +} + +const cache = new Map(); + +function mixColors(color, color2) { + if (cache.has(`${color}_${color2}`) || cache.has(`${color2}_${color}`)) return cache.get(`${color}_${color2}`) ?? cache.get(`${color2}_${color}`); + const [r, g, b] = parseColor(color).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + const [r2, g2, b2] = parseColor(color2).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + const res = [ + Math.max(r, r2), + Math.max(g, g2), + Math.max(b, b2) + ]; + cache.set(`${color}_${color2}`, `#${res.map(a => (Math.floor(a) % 256).toString(16).padStart(2, "0")).join("")}`); + return `#${res.map(a => (Math.floor(a) % 256).toString(16).padStart(2, "0")).join("")}`; +} + +const parseColor = (colorString) => { + if (colorString instanceof Array) return parseColor(colorString[0]); + if (typeof colorString != "string") return "#ffffff"; + if (colorString.startsWith("rgb(")) { + const color = colorString.replace("rgb(", "").replace(")", ""); + return `#${color.split(",").map(a => parseInt(a).toString(16).length == 1 ? `0${parseInt(a).toString(16)}` : parseInt(a).toString(16)).join("")}`; + } else if (colorString.startsWith("rgba(")) { + const color = colorString.replace("rgba(", "").replace(")", ""); + return `#${color.split(",").filter((_, i) => i <= 2).map(a => parseInt(a).toString(16).length == 1 ? `0${parseInt(a).toString(16)}` : parseInt(a).toString(16)).join("")}`; + } else { + if (colorString.startsWith("#")) { + const color = colorString.slice(1); + if (color.length == 3) return `#${color.split(a => a.repeat(2)).join()}`; + else if (color.length >= 6) return `#${color.slice(0, 6)}`; + else return `#${color}`; + } + } +} + +const rgbToHsl = (r, g, b) => { + const r1 = r / 255; + const g1 = g / 255; + const b1 = b / 255; + + const cmax = Math.max(r1, g1, b1); + const cmin = Math.min(r1, g1, b1); + + const delta = cmax - cmin; + const l = (cmax + cmin) / 2; + const s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)); + let h = 0; + if (delta != 0) { + switch (cmax) { + case r1: + h = 60 * (((g1 - b1) / delta) % 6); + break; + case g1: + h = 60 * ((b1 - r1) / delta + 2); + break; + default: + h = 60 * ((r1 - g1) / delta + 4); + } + } + + return {h, s, l}; +} + +const thetaSetting = new Setting("3D View Angle (0-90)", "theta", settingType.NUMBER, false, parseFloat((Math.atan(2) * 180 / Math.PI).toPrecision(3))); + +const tab = new SettingsTab("moreViews.js"); +tab.registerSetting(thetaSetting); + +let maxDistance = -1; +const colorCache = new Map(); + +function getModeColor(color, distance = 0) { + if (!colorCache.has(view)) colorCache.set(view, new Map()); + if (view == 18) { + if (colorCache.get(view).has(color) && colorCache.get(view).get(color).has(distance)) return colorCache.get(view).get(color).get(distance); + } else if (colorCache.get(view).has(color)) return colorCache.get(view).get(color); + switch (view) { + case 6: { + const newColor = "#" + (parseInt(`0x1${parseColor(color).slice(1)}`) ^ 0xffffff).toString(16).slice(1); + colorCache.get(view).set(color, newColor); + return newColor; + } + case 7: { + const newColor = blending(pixel.color, "#000000"); + colorCache.get(view).set(color, newColor); + return newColor; + } + case 8: { + const newColor = blending(pixel.color, "#ffffff"); + colorCache.get(view).set(color, newColor); + return newColor; + } + case 9: { + const [r, g, b] = parseColor(color).slice(1).match(/.{1,2}/g).map(a => parseInt(a, 16)).slice(0, 3); + const {h, l} = rgbToHsl(r, g, b); + const newColor = `hsl(${Math.round(h)}, 0%, ${Math.round(l * 100)}%)`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 10: { + const [r, g, b] = parseColor(color).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + const [r2, g2, b2] = [ + Math.min(255, (r * 0.393) + (g * 0.769) + (b * 0.189)), + Math.min(255, (r * 0.349) + (g * 0.686) + (b * 0.168)), + Math.min(255, (r * 0.272) + (g * 0.534) + (b * 0.131)) + ]; + const newColor = `#${Math.floor(r2).toString(16).padStart(2, "0")}${Math.floor(g2).toString(16).padStart(2, "0")}${Math.floor(b2).toString(16).padStart(2, "0")}`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 11: { + const [r, g, b] = parseColor(color).slice(1).match(/.{1,2}/g).map(a => parseInt(a, 16)).slice(0, 3); + const {h, s, l} = rgbToHsl(r, g, b); + const newColor = `hsl(${(Math.round(h) + 180 % 360)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%)`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 12: { + const [r, g, b] = parseColor(color).slice(1).match(/.{1,2}/g).map(a => parseInt(a, 16)).slice(0, 3); + const {h, s, l} = rgbToHsl(r, g, b); + const newColor = `hsl(${Math.round(h)}, ${Math.round(s * 100) * 4}%, ${Math.round(l * 100)}%)`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 15: { + const [r, g, b] = parseColor(color).replace("#", "").match(/../g); + const [r2, g2, b2] = [parseInt(r, 16) * 0.75, parseInt(g, 16) * 0.75, parseInt(b, 16) * 0.75]; + const newColor = `rgb(${r2}, ${g2}, ${b2})`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 18: { + const newColor = blending(pixel.color, "#000000", (1 / maxDistance) * distance); + colorCache.get(view).has(color) + ? colorCache.get(view).get(color).set(distance, newColor) + : colorCache.get(view).set(color, new Map([[distance, newColor]])); + return newColor; + } + } + return color; +} + +settingsManager.registerTab(tab); + +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; + + const canvas = document.getElementById("game"); + const ctx = canvas.getContext("2d"); + var newCurrentPixels = currentPixels.slice(); + var pixelsFirst = []; + var pixelsLast = []; + if (!paused || forceTick) { + shuffleArray(newCurrentPixels); + } + + for (var i = 0; i < newCurrentPixels.length; i++) { + pixel = newCurrentPixels[i]; + if (pixel.del) {continue} + if (!paused || forceTick) { + if (elements[pixel.element].tick) { + elements[pixel.element].tick(pixel); + } + if (pixel.del) {continue} + if (elements[pixel.element].behavior) { + pixelTick(pixel); + } + }; + if (pixel.con) { pixel = pixel.con } + if (elements[pixel.element].isGas || elements[pixel.element].glow) { + pixelsLast.push(pixel); + } + else { + pixelsFirst.push(pixel); + } + } + + if (hiding) { + if (ctx.globalAlpha < 1) { + ctx.globalAlpha = 1; + } + + if (elements[currentElement].maxSize < mouseSize) { + var mouseOffset = Math.trunc(elements[currentElement].maxSize/2); + } + else { + var mouseOffset = Math.trunc(mouseSize/2); + } + var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset]; + var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset]; + + ctx.strokeStyle = "white"; + ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize); + + if (settings.precision) { + ctx.fillStyle = "rgba(255,255,255,0.5)"; + ctx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize); + } + if ((!paused) || forceTick) {pixelTicks++}; + return; + } + + if (!settings["bg"]) {ctx.clearRect(0, 0, canvas.width, canvas.height)} + else { + ctx.fillStyle = settings["bg"]; + ctx.fillRect(0, 0, canvas.width, canvas.height); + } + var pixelDrawList = pixelsFirst.concat(pixelsLast); + for (var i = 0; i < pixelDrawList.length; i++) { + pixel = pixelDrawList[i]; + 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); + // 3D VIEW + 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]; + let size = 0; + let currentY = pixel.y; + while (!outOfBounds(pixel.x, currentY) && pixelMap[pixel.x][currentY] && pixelMap[pixel.x][currentY].element == pixel.element) { + currentY++; + size++; + } + ctx.globalAlpha = 1; + ctx.fillStyle = pixel.color; + ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + const px = pixel.x * pixelSize; + const py = pixel.y * pixelSize; + const theta = Math.max(Math.min(thetaSetting.get(), 90), 0) * Math.PI / 180; + const a = Math.cos(theta); + const b = Math.sin(theta); + const w = pixelSize; + const px2 = px + a * w; + const py2 = py - b * w; + const parts = [[[px, py], [[px2, py2], [px + w, py2], [px + w, py]], !neighborUp], [[px + w, py + w], [[px2 + w, py2 + w], [px2 + w, py], [px + w, py]], !neighborRight], [[px + w, py], [[px + w, py2], [px2 + w, py2], [px + w, py]], !neighborUp && !neighborUpRight], [[px + w, py], [[px2 + w, py2], [px2 + w, py], [px + w, py]], !neighborRight && !neighborUpRight]] + for (const part of parts.filter(p => p[2])) { + ctx.fillStyle = blending(pixel.color, "#000000"); + ctx.beginPath(); + ctx.moveTo(...part[0]); + for (const v of part[1]) { + ctx.lineTo(...v); + } + ctx.closePath(); + ctx.fill(); + } + } else if (view == 13) { + const hue = 225 - (Math.log(pixel.start) / Math.log(pixelTicks)) * 225; + ctx.globalAlpha = 1; + ctx.fillStyle = `hsl(${Math.min(Math.round(hue), 250)}, 100%, 50%)`; + ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + } else if (view == 14) { + ctx.globalAlpha = 1; + ctx.fillStyle = pixel.color; + ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + + if (outOfBounds(pixel.x - 1, pixel.y) || !pixelMap[pixel.x - 1][pixel.y]) { + ctx.fillStyle = "#ff0000"; + ctx.globalAlpha = 0.5; + ctx.fillRect(pixel.x * pixelSize - 0.5 * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + } + if (outOfBounds(pixel.x + 1, pixel.y) || !pixelMap[pixel.x + 1][pixel.y]) { + ctx.fillStyle = "#00ffff"; + ctx.globalAlpha = 0.5; + ctx.fillRect(pixel.x * pixelSize + 0.5 * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + } + } else if (view == 15) { + const [r, g, b] = parseColor(pixel.color).replace("#", "").match(/../g); + const [r2, g2, b2] = [parseInt(r, 16) * 0.75, parseInt(g, 16) * 0.75, parseInt(b, 16) * 0.75] + // scrolling effect + const offset = (pixelTicks + 6) % height >= pixel.y && (pixelTicks - 3) % height <= pixel.y + || (pixelTicks + 66) % height >= pixel.y && (pixelTicks - 57) % height <= pixel.y; + if (!pixelMap[pixel.x - 1] || !pixelMap[pixel.x - 1][pixel.y]) { + ctx.globalAlpha = 0.5; + ctx.fillStyle = `#${r.padStart(2, "0")}0000`; + ctx.fillRect(pixel.x * pixelSize - 0.75 * pixelSize - (offset ? 0.5 * pixelSize : 0) , pixel.y * pixelSize, pixelSize, pixelSize); + } + if (!pixelMap[pixel.x + 1] || !pixelMap[pixel.x + 1][pixel.y]) { + ctx.globalAlpha = 0.5; + ctx.fillStyle = `#0000${b.padStart(2, "0")}`; + ctx.fillRect(pixel.x * pixelSize + 0.75 * pixelSize - (offset ? 0.5 * pixelSize : 0), pixel.y * pixelSize, pixelSize, pixelSize); + } + ctx.globalAlpha = 1; + ctx.fillStyle = `rgb(${r2}, ${g2}, ${b2})` + ctx.fillRect(pixel.x * pixelSize - (offset ? 0.5 * pixelSize : 0), pixel.y * pixelSize, pixelSize, pixelSize); + ctx.globalAlpha = 1; + // i fucking hate it but at least it works + // and i dont feel like finding something that is fast and pretty + } else if (view == 16) { + ctx.globalAlpha = 1; + ctx.strokeStyle = pixel.color; + ctx.lineWidth = 2; + const cond1 = outOfBounds(pixel.x - 1, pixel.y) + || !pixelMap[pixel.x - 1][pixel.y] + || pixelMap[pixel.x - 1][pixel.y].element != pixel.element; + const cond2 = outOfBounds(pixel.x + 1, pixel.y) + || !pixelMap[pixel.x + 1][pixel.y] + || pixelMap[pixel.x + 1][pixel.y].element != pixel.element; + const cond3 = outOfBounds(pixel.x, pixel.y - 1) + || !pixelMap[pixel.x][pixel.y - 1] + || pixelMap[pixel.x][pixel.y - 1].element != pixel.element; + const cond4 = outOfBounds(pixel.x, pixel.y + 1) + || !pixelMap[pixel.x][pixel.y + 1] + || pixelMap[pixel.x][pixel.y + 1].element != pixel.element; + const cond5 = outOfBounds(pixel.x - 1, pixel.y - 1) + || !pixelMap[pixel.x - 1][pixel.y - 1] + || pixelMap[pixel.x - 1][pixel.y - 1].element != pixel.element; + const cond6 = outOfBounds(pixel.x + 1, pixel.y - 1) + || !pixelMap[pixel.x + 1][pixel.y - 1] + || pixelMap[pixel.x + 1][pixel.y - 1].element != pixel.element; + const cond7 = outOfBounds(pixel.x - 1, pixel.y + 1) + || !pixelMap[pixel.x - 1][pixel.y + 1] + || pixelMap[pixel.x - 1][pixel.y + 1].element != pixel.element; + const cond8 = outOfBounds(pixel.x + 1, pixel.y + 1) + || !pixelMap[pixel.x + 1][pixel.y + 1] + || pixelMap[pixel.x + 1][pixel.y + 1].element != pixel.element; + + if (cond1) { + ctx.beginPath(); + ctx.moveTo(pixel.x * pixelSize + ctx.lineWidth / 2, pixel.y * pixelSize); + ctx.lineTo(pixel.x * pixelSize + ctx.lineWidth / 2, (pixel.y + 1) * pixelSize); + ctx.stroke(); + } + if (cond2) { + ctx.beginPath(); + ctx.moveTo((pixel.x + 1) * pixelSize - ctx.lineWidth / 2, pixel.y * pixelSize); + ctx.lineTo((pixel.x + 1) * pixelSize - ctx.lineWidth / 2, (pixel.y + 1) * pixelSize); + ctx.stroke(); + } + if (cond3) { + ctx.beginPath(); + ctx.moveTo(pixel.x * pixelSize, pixel.y * pixelSize + ctx.lineWidth / 2); + ctx.lineTo((pixel.x + 1) * pixelSize, pixel.y * pixelSize + ctx.lineWidth / 2); + ctx.stroke(); + } + if (cond4) { + ctx.beginPath(); + ctx.moveTo(pixel.x * pixelSize, (pixel.y + 1) * pixelSize - ctx.lineWidth / 2); + ctx.lineTo((pixel.x + 1) * pixelSize, (pixel.y + 1) * pixelSize - ctx.lineWidth / 2); + ctx.stroke(); + } + if (!cond2 && !cond4 && cond8) ctx.fillRect((pixel.x + 1) * pixelSize - ctx.lineWidth, (pixel.y + 1) * pixelSize - ctx.lineWidth, ctx.lineWidth, ctx.lineWidth); + if (!cond2 && !cond3 && cond6) ctx.fillRect((pixel.x + 1) * pixelSize - ctx.lineWidth, pixel.y * pixelSize, ctx.lineWidth, ctx.lineWidth); + if (!cond1 && !cond3 && cond5) ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, ctx.lineWidth, ctx.lineWidth); + if (!cond1 && !cond4 && cond7) ctx.fillRect(pixel.x * pixelSize, (pixel.y + 1) * pixelSize - ctx.lineWidth, ctx.lineWidth, ctx.lineWidth); + } else if (view == 17) { + ctx.fillRect(pixel.x * pixelSize, (height - pixel.y) * pixelSize, pixelSize, pixelSize); + } else { + ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize); + } + if (pixel.charge && view !== 2) { // Yellow glow on charge + if (!elements[pixel.element].colorOn) { + ctx.fillStyle = "rgba(255,255,0,0.5)"; + ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize); + } + } + } + if (view == 15) { + // TRACK READ NOISE + for (let n = 0; n < 3; n++) { + const number = Math.floor(Math.random() * height); + ctx.globalAlpha = Math.random(); + ctx.fillStyle = "#fff"; + ctx.fillRect(0, (number + 0.5) * pixelSize, width * pixelSize, 0.2); + ctx.globalAlpha = 1; + } + const {font, textAlign} = ctx; + ctx.font = "30px VCR"; + ctx.textAlign = "start"; + ctx.fillText(paused ? "PAUSE" : "PLAY", (0.025 * width) * pixelSize, (0.025 * width) * pixelSize + 15); + if (paused) { + ctx.fillRect((0.05 * width) * pixelSize + ctx.measureText("PAUSE").width, (0.025 * width) * pixelSize - 7.5, 5, 22.5); + ctx.fillRect((0.05 * width) * pixelSize + ctx.measureText("PAUSE").width + 8, (0.025 * width) * pixelSize - 7.5, 5, 22.5); + } else { + ctx.fillStyle = "#fff"; + ctx.beginPath(); + ctx.moveTo((0.05 * width) * pixelSize + ctx.measureText("PLAY").width, (0.025 * width) * pixelSize - 7.5); + ctx.lineTo((0.05 * width) * pixelSize + ctx.measureText("PLAY").width, (0.025 * width) * pixelSize + 15); + ctx.lineTo((0.05 * width) * pixelSize + ctx.measureText("PLAY").width + 17.5, (0.025 * width) * pixelSize + 3.75); + ctx.lineTo((0.05 * width) * pixelSize + ctx.measureText("PLAY").width, (0.025 * width) * pixelSize - 7.5); + ctx.fill(); + } + const base = Math.floor(pixelTicks / tps); + const seconds = base % 60 + ""; + const minutes = Math.floor(base / 60) % 60 + ""; + const hours = Math.floor(base / 60 / 60) + ""; + ctx.textAlign = "end"; + ctx.fillText(`${hours.padStart(2, "0")}:${minutes.padStart(2, "0")}:${seconds.padStart(2, "0")}`, (0.975 * width) * pixelSize, (0.025 * width) * pixelSize + 15); + ctx.font = font; + ctx.textAlign = textAlign; + } + if (ctx.globalAlpha < 1) { + ctx.globalAlpha = 1; + } + + if (elements[currentElement].maxSize < mouseSize) { + var mouseOffset = Math.trunc(elements[currentElement].maxSize/2); + } + else { + var mouseOffset = Math.trunc(mouseSize/2); + } + var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset]; + var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset]; + // Draw a square around the mouse + ctx.strokeStyle = "white"; + ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize); + // draw one transparent pixel in the center + if (settings.precision) { + ctx.fillStyle = "rgba(255,255,255,0.5)"; + ctx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize); + } + if ((!paused) || forceTick) {pixelTicks++}; + } else oldDrawPixels.apply(this, arguments); + } +}())); +} \ No newline at end of file diff --git a/mods/morechemistry.js b/mods/morechemistry.js index c220dfdf..3549e61b 100644 --- a/mods/morechemistry.js +++ b/mods/morechemistry.js @@ -1,4 +1,4 @@ -//This mod was made by Alex the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok. +//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. function pixelInRange(pixel, range){ let i = 0; while (i < range.length) { @@ -635,11 +635,6 @@ elements.potassiumhydroxidecrystals = { density: 2040, name: "PotassiumHydroxideCrystals", } -elements.supercooler = { - name: "SuperCooler", - category: "machines" -} -elements.supercooler.behavior = [["XX","CO:10","XX"],["CO:10","XX","CO:10"],["XX","CO:10","XX"]] elements.iron_chloride = { color: ["#010014", "#a2ff94"], reactions: { @@ -695,7 +690,7 @@ elements.kilonova = { temp: 100000000, } elements.supernova.behavior = [ ["XX", "XX", "XX"], [ "XX", "EX:80>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,oxygen,molten_sodium,sulfur_gas,neon,chlorine,molten_calcium,molten_nickel,molten_copper,molten_zinc,gallium_gas,hydrogen,hydrogen,hydrogen,hydrogen,helium,helium,helium AND CH:NeutronStar", "XX" ], ["XX", "XX", "XX"] ] -elements.kilonova.behavior = [ ["XX", "XX", "XX"], [ "XX", "EX:200>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead,oxygen,molten_sodium,molten_gold,molten_tungsten,sulfur_gas,neon,chlorine,molten_calcium,molten_nickel,molten_copper,molten_zinc,gallium_gas,hydrogen,hydrogen,hydrogen,hydrogen,hydrogen,helium,helium,helium,helium AND CH:void", "XX" ], ["XX", "XX", "XX"] ] +elements.kilonova.behavior = [ ["XX", "XX", "XX"], [ "XX", "EX:200>plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead,oxygen,molten_sodium,molten_gold,molten_tungsten,sulfur_gas,neon,chlorine,molten_calcium,molten_nickel,molten_copper,molten_zinc,gallium_gas,hydrogen,hydrogen,hydrogen,hydrogen,hydrogen,helium,helium,helium,helium AND CH:void", "XX" ], ["XX", "XX", "XX"] ] elements.NeutronStar = { behavior: [["XX", "XX", "XX"], ["CR:light", "XX", "CR:light"], ["XX", "XX", "XX"]], name: "NeutronStar", @@ -1057,52 +1052,12 @@ elements.specialmixer = { mix(range, exclude); } } + let num4 = 0; let exclude2 = []; let property1 = ""; let value2 = ""; -elements.propmachine = { - name: "PropMachine", - behavior: behaviors.WALL, - category: "machines", - noMix: true, - onSelect: function(pixel) { - let item = prompt("enter range for prop changing."); - if(/^\d+$/.test(item)){ - num4 = parseInt(item); - } else { - alert("that is not an integer."); - } - exclude2 = prompt("Enter elements to exclude, seperate them with commas.").replace(/\s/g, "").split(","); - exclude2.push("propmachine"); - var answer1 = prompt("Warning - This tool may break the simulator if used incorrectly.\n\nEnter a pixel attribute to modify:",(currentProp||undefined)); - if (!answer1) { return } - var answer2 = prompt("Now, enter a value for "+answer1+":",(currentPropValue||undefined)); - if (!answer2) { return } - var valueL = answer2.toLowerCase(); - if (valueL === "true") { answer2 = true } - else if (valueL === "false") { answer2 = false } - else if (valueL === "null") { answer2 = null } - else if (valueL === "undefined") { answer2 = undefined } - else if (answer1 === "color" && valueL[0] === "#") { - var rgb = hexToRGB(valueL); - answer2 = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")"; - } - currentProp = answer1; - var num = parseFloat(answer2); - if (!isNaN(num)) { answer2 = num } - currentPropValue = answer2; - logMessage("Prop: "+currentProp); - logMessage("Value: "+currentPropValue); - }, - tick: function(pixel) { - if(pixel.start == pixelTicks) { - pixel.range = num4; - } - let range = mouseRange(pixel.x, pixel.y, pixel.range); - prop({ property: property1, value: value2 },range, exclude2); - } - } + let item = ""; elements.improvedsensor = { behavior: behaviors.WALL, @@ -1196,30 +1151,111 @@ elements.incinerator = { color: 'rgb(255, 50, 0)', noMix: true, } -function prop(obj, range, exclude = []){ +function conditionTrue(condition, pixel){ + let p = pixel; + let string = ""; + condition = condition.split("!OR").join("||").split("&AND").join("&&").split("\"").join("") + + condition = eval(condition); + return condition; +} +let ifCondition = ""; +let currentProp = ""; +let currentPropValue = ""; +elements.propmachine = { + name: "PropMachine", + behavior: behaviors.WALL, + category: "machines", + noMix: true, +onSelect: function(pixel) { + + let item = prompt("enter range for prop changing."); + if(/^\d+$/.test(item)){ + num4 = parseInt(item); + } else { + alert("that is not an integer."); + } + exclude2 = prompt("Enter elements to exclude, seperate them with commas. You can also enter !IF if you wish to enter conditions for it to change the property and add the exclude elements.").replace(/\s/g, ""); + if(exclude2.includes("!IF")){ + exclude2.split("!IF").join(""); + ifCondition = prompt("Enter the condition for the property to change. A list of variables can be seen at the bottom of the page. you cannot use \"\" but you can use `` and ''."); + } else { ifCondition = '1 == 1'; } + exclude2.split(","); + if(exclude2.constructor == [].constructor){ + exclude2.push("propmachine"); + } else { + exclude2 += "propmachine"; + } + var answer1 = prompt("Warning - This tool may break the simulator if used incorrectly.\n\nEnter a pixel attribute to modify:",(currentProp||undefined)); + console.log(answer1) + if (!answer1) { return } + var answer2 = prompt("Now, enter a value for "+answer1+":",(currentPropValue||undefined)); + if (!answer2) { return } + var valueL = answer2.toLowerCase(); + if (valueL === "true") { answer2 = true } + else if (valueL === "false") { answer2 = false } + else if (valueL === "null") { answer2 = null } + else if (valueL === "undefined") { answer2 = undefined } + else if (answer1 === "color" && valueL[0] === "#") { + var rgb = hexToRGB(valueL); + answer2 = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")"; + } + currentProp = answer1; + currentPropValue = answer2; + console.log(answer1); + var num = parseFloat(answer2); + if (!isNaN(num)) { answer2 = num } + currentPropValue = answer2; + logMessage("Prop: "+currentProp); + logMessage("Value: "+currentPropValue); +}, + tick: function(pixel) { + if(pixel.start == pixelTicks) { + pixel.range = num4; + pixel.condition = ifCondition; + pixel.prop = currentProp; + pixel.val = currentPropValue; + } + let range = mouseRange(pixel.x, pixel.y, pixel.range); + prop({ property: pixel.prop, value: pixel.val },range, exclude2, pixel.condition); + } +} +function prop(obj, range, exclude = [], condition = ""){ + let list = []; for (var i = 0; i < range.length; i++) { - if (!isEmpty(range[i][0], range[i][1], true)) { - var pixel = pixelMap[range[i][0]][range[i][1]]; - if (!exclude.includes(pixel.element)){ + var x = range[i][0]; + var y = range[i][1]; + if (!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + list.push(pixel); + } + } + for (var i = 0; i < list.length; i++) { + if (!isEmpty(list[i].x, list[i].y, true)) { + var pixel = list[i]; + if (!exclude.includes(pixel.element) && conditionTrue(condition, pixel)){ if(/^\d+$/.test(obj.value)){ obj.value = parseInt(obj.value); } - if (!currentProp) { return } - if (pixel[currentProp] !== undefined && typeof pixel[currentProp] !== typeof currentPropValue) { - logMessage("Error: "+currentProp+" type is "+typeof pixel[currentProp]+", not "+typeof currentPropValue+"."); - currentProp = null; - currentPropValue = null; + if (!obj.property) { return } + if (pixel[obj.property] !== undefined && typeof pixel[obj.property] !== typeof obj.value) { + logMessage("Error: "+obj.property+" type is "+typeof pixel[obj.property]+", not "+typeof obj.value+"."); + obj.property = null; + obj.value = null; return; } - if (currentProp === "element") { - changePixel(pixel, currentPropValue); + if (obj.property === "element") { + changePixel(pixel, obj.value); + list.splice(list.indexOf(pixel),1); return; } - if (currentProp === "burning" && currentPropValue === "true") { + if (obj.property === "burning" && obj.value === "true") { pixel.burnStart = pixelTicks; + list.splice(list.indexOf(pixel),1); return; } - pixel[currentProp] = currentPropValue; + pixel[obj.property] = obj.value; + list.splice(list.indexOf(pixel),1); } } } @@ -1307,3 +1343,122 @@ function pull(range, pixel1, include = []){ } } } + +let prevNum; +elements.etemper = { + name: "E-Temper", + category: "machines", + conduct: 1, + insulate: true, + behavior: behaviors.WALL, + onSelect: function(pixel){ + prevNum = parseInt(prompt("Enter the temperature you want it set to.", (prevNum || undefined))); + }, + tick: function(pixel){ + if(pixel.start === pixelTicks){ + pixel.clone = `Temp: ${prevNum}`; + pixel.Temp = prevNum; + } + for (var i = 0; i < adjacentCoords.length; i++){ + let x = pixel.x + adjacentCoords[i][0]; + let y = pixel.y + adjacentCoords[i][1]; + if(outOfBounds(x,y)){ continue; } + if(isEmpty(x,y)){ continue; } + let pixel2 = pixelMap[x][y]; + + if (pixel2.temp < pixel.Temp && pixel.charge > 0 ){ + pixel2.temp += pixel.Temp / 6; + } + + } + }, +} +let prevString; +elements.sign = { + name: "Sign", + category: "machines", + onSelect: function(){ + prevString = prompt("Enter the text you want it to say.", (prevString || undefined)); + }, + tick: function(pixel){ + if(pixel.start == pixelTicks){ + pixel.clone = prevString; + } + } +} +runAfterLoad(function(){ + document.body.innerHTML += ` + these are all properties of the pixel. another way to find pixel properties is using debug on a pixel, it will tell you the property and the value, like x and y, or, in plants.js, fruit. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Variable + + Definition +
+ p.color + + The color of the pixel. it is defined as an RGB value. +
+ p.x and p.y + + The x and y positions of the pixel. +
+ p.element + + The element of the pixel. +
+ p.clone + + Specific to cloners, specifies what the cloner clones. +
+ wc and lc + + Specific to saplings, specifies what colour the wood is (wc) and what colour the leaves are (lc). +
+ p.start + + The start tick of the pixel. +
+ p.tick + + the amount of ticks that have happened so far in the game. +
+ ` + document.getElementById("extraInfo").innerHTML = ` + Changelog(NEW)FeedbackWikiRedditDiscord • Install OfflineVariables

v1.9.3 • 559 elements, with 0 hidden.

©2021-2024. All Rights Reserved.

+ ` +}); diff --git a/mods/plants.js b/mods/plants.js new file mode 100644 index 00000000..23a68e1b --- /dev/null +++ b/mods/plants.js @@ -0,0 +1,1081 @@ +//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"]; +let vineExclude = ["tomato", "grape", "fruit_vine", "kiwi"]; +let vines = ['tomato', 'grape', 'kiwi']; +let bushes = ["blackberry", "blueberry", "raspberry"]; +let allFruits = fruits.concat(vines, bushes) +function interpolateRgb(rgb1, rgb2, ratio) { + const interpolatedRgb = { + r: Math.round(rgb1.r + (rgb2.r - rgb1.r) * ratio), + g: Math.round(rgb1.g + (rgb2.g - rgb1.g) * ratio), + b: Math.round(rgb1.b + (rgb2.b - rgb1.b) * ratio), + }; + return interpolatedRgb; +} + +elements.fruit_branch = { + color: elements.tree_branch.color, + behavior: [ + "CR:fruit_leaves,fruit_branch%2|CR:fruit_leaves,fruit_leaves,fruit_leaves,fruit_branch%2|CR:fruit_leaves,fruit_branch%2", + "XX|XX|XX", + "XX|XX|XX", + ], + tempHigh: 100, + stateHigh: "wood", + tempLow: -30, + stateLow: "wood", + category: "life", + burn: 40, + burnTime: 50, + burnInto: ["sap","ember","charcoal"], + hidden: true, + state: "solid", + density: 1500, + hardness: 0.15, + breakInto: ["sap","sawdust"], + seed: "apple_seed", + 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)) { continue; } + let pixel2 = pixelMap[x][y]; + if(pixel2.element == "fruit_branch" || pixel2.element == "fruit_leaves" || pixel2.element == "wood"){ + if(pixel.fruit && !pixel2.fruit){ + pixel2.fruit = pixel.fruit; + } else if (!pixel.fruit && pixel2.fruit){ + pixel.fruit = pixel2.fruit; + } + } + } + } +} +elements.fruit_leaves = { + color: elements.plant.color, + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|XX|XX", + ], + reactions: { + "vinegar": { elem1:"dead_plant", elem2:null, chance:0.035 }, + "baking_soda": { elem1:"dead_plant", elem2:null, chance:0.01 }, + "bleach": { elem1:"dead_plant", elem2:null, chance:0.05 }, + "alcohol": { elem1:"dead_plant", elem2:null, chance:0.035 } + }, + category:"life", + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -1.66, + stateLow: "frozen_plant", + burn:65, + burnTime:60, + burnInto: "dead_plant", + breakInto: "dead_plant", + state: "solid", + density: 1050, + hidden: true, + tick: function(pixel){ + if(pixelTicks == pixel.start + 1 && pixel.blooming == undefined){ + if(Math.floor(Math.random() * 3) == 2){ + pixel.blooming = true; + pixel.color = "#FFE2E2"; + } else { + pixel.blooming = false; + } + } + 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)) { 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(pixel.fruit && !pixel2.fruit){ + pixel2.fruit = pixel.fruit; + } else if (!pixel.fruit && pixel2.fruit){ + pixel.fruit = pixel2.fruit; + } + } + } + if(pixel.blooming){ + if(pixelTicks > pixel.start + 150){ + if(Math.floor(Math.random() * 400) == 3){ + if(pixel.fruit){ + if(pixel.fruit == "random"){ + changePixel(pixel, fruits[Math.floor(Math.random() * fruits.length)]); + } else { + changePixel(pixel, pixel.fruit); + } + } + } + } + } + } +} + +elements.apple_seed = { + color: "#1A0E00", + 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 > 50 && pixel.temp < 100) { + 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].element == "wood"){ + pixelMap[pixel.x][pixel.y+1].fruit = "apple"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"apple" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.apple = { + 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: "#ff0004", + category: "food", + breakInto: "juice", + breakIntoColor: "#FF4747", + isFood: true, + properties: { + fruit: "apple", + type: "fruit", + } +} +elements.pear_seed = { + color: "#1A0E00", + 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 > 50 && pixel.temp < 100) { + 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 = "pear"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"pear" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.pear = { + 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: "#97FF43", + category: "food", + breakInto: "juice", + breakIntoColor: "#ABFF8D", + isFood: true, + properties: { + fruit: "pear", + type: "fruit", + } +} +elements.cherry_seed = { + color: "#b56233", + 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 > 50 && pixel.temp < 100) { + 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 = "cherry"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"cherry" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.cherry = { + 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: "#750000", + category: "food", + breakInto: "juice", + breakIntoColor: "#8a0000", + isFood: true, + properties: { + fruit: "cherry", + type: "fruit", + } +} +elements.milk = { + color: "#fafafa", + behavior: behaviors.LIQUID, + onMix: function(milk1, milk2) { + if (shiftDown && Math.random() < 0.01) { + changePixel(milk1,"butter") + } + }, + reactions: { + "melted_chocolate": { elem1:"chocolate_milk", elem2:null }, + "chocolate": { elem1:"chocolate_milk", elem2:"melted_chocolate", chance:0.05 }, + "coffee_ground": { elem1:"chocolate_milk", chance:0.05 }, + "juice": { elem1:"fruit_milk", elem2:null, chance:0.05, func: function(pixel1, pixel2){ + let newrgb = interpolateRgb(getRGB('rgb(250,250,250)'), getRGB(pixel2.color), 0.25); + pixel1.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + }}, + "soda": { elem1:"pilk", elem2:null, chance:0.1 }, + "yolk": { elem1:"eggnog", elem2:null, chance:0.1 }, + "dirt": { elem1: null, elem2: "mud" }, + "sand": { elem1: null, elem2: "wet_sand" }, + "clay_soil": { elem1: null, elem2: "clay" }, + "caramel": { color1:"#C8B39A", elem2:null, chance:0.05 }, + "sugar": { elem2:null, chance:0.005}, + }, + tempLow: 0, + stateLow: "ice_cream", + stateLowColorMultiplier: [0.97,0.93,0.87], + tempHigh: 93, + stateHigh: "yogurt", + viscosity: 1.5, + category: "liquids", + state: "liquid", + density: 1036.86, + isFood: true +} +elements.cream = { + color: "#f7f7f7", + behavior: behaviors.LIQUID, + onMix: function(milk1, milk2) { + if ((shiftDown && Math.random() < 0.01) || (elements[milk2.element].id === elements.milk.id && Math.random() < 0.00025)) { + changePixel(milk1,"butter") + } + }, + reactions: { + "dirt": { elem1: null, elem2: "mud" }, + "sand": { elem1: null, elem2: "wet_sand" }, + "clay_soil": { elem1: null, elem2: "clay" }, + "melted_chocolate": { color1:"#664934", elem2:null }, + "chocolate": { color1:"#664934", elem2:"melted_chocolate", chance:0.05 }, + "juice": { elem1:"fruit_milk", elem2:null, chance:0.05, func: function(pixel1, pixel2){ + let newrgb = interpolateRgb(getRGB('rgb(250,250,250)'), getRGB(pixel2.color), 0.25); + pixel1.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + }}, + "soda": { elem1:"pilk", elem2:null, chance:0.1 }, + "yolk": { elem1:"#eggnog", elem2:null, chance:0.1 }, + "caramel": { color1:"#C8B39A", chance:0.05 }, + "sugar": { elem2:null, chance:0.005}, + }, + viscosity: 1.5, + tempHigh: 1000, + stateHigh: ["smoke","smoke","smoke","steam","steam","calcium"], + tempLow: 0, + stateLow: "ice_cream", + stateLowColorMultiplier: 0.97, + category: "liquids", + hidden: true, + isFood: true, + state: "liquid", + density: 959.97, +} +function getRGB(rgb){ + let rgb2 = rgb.replace(")", "").replace("rgb(", "").replace(/,/g, "r").split("r") + return { r: parseInt(rgb2[0]), g: parseInt(rgb2[1]), b: parseInt(rgb2[2]) }; +} +elements.peach = { + 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: ["#ffb485", "#ffa770", "#ff7b61", "#ff512e", "#ff350d"], + category: "food", + breakInto: "juice", + breakIntoColor: "#ffa74f", + isFood: true, + properties: { + fruit: "peach", + type: "fruit", + } +} +elements.peach_seed = { + color: "#240c00", + 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 > 50 && pixel.temp < 100) { + 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 = "peach"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"peach" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.plum = { + 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: "#1c0030", + category: "food", + breakInto: "juice", + breakIntoColor: "#d2880a", + isFood: true, + properties: { + fruit: "plum", + type: "fruit", + } +} +elements.plum_seed = { + color: "#240c00", + 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 > 50 && pixel.temp < 100) { + 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 = "plum"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"plum" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.juice.reactions.juice = { + func: function(pixel1, pixel2){ + if(pixel1.color != pixel2.color){ + if(Math.floor(Math.random() * 1000) == 1){ + let newrgb = interpolateRgb(getRGB(pixel1.color), getRGB(pixel2.color), 0.5); + pixel1.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + } + } + } +} +elements.juice.onMix = function(pixel){ + let num = Math.floor(Math.random() * 4); + let x = pixel.x + adjacentCoords[num][0]; + let y = pixel.y + adjacentCoords[num][1]; + if(!isEmpty(x,y) && !outOfBounds(x,y)){ + let pixel2 = pixelMap[x][y]; + if(pixel.color != pixel2.color && pixel2.element == "juice"){ + let condition; + if(shiftDown == 0){ + condition = (Math.floor(Math.random() * 2) == 1); + } else { + condition = true; + } + if(condition){ + let newrgb = interpolateRgb(getRGB(pixel.color), getRGB(pixel2.color), 0.5); + pixel.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + } + } + } + } +elements.vine.behavior = [["XX", "ST:vine", "XX"],["ST:vine", "XX", "ST:vine"],["XX", "ST:vine AND M1", "XX"]] +elements.apricot = { + 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: ["#ffa100", "#FF5D00", "#FF7A00", "#FF9700"], + category: "food", + breakInto: "juice", + breakIntoColor: "#ffa836", + isFood: true, + properties: { + fruit: "apricot", + type: "fruit", + } +} +elements.apricot_seed = { + color: "#291300", + 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 > 50 && pixel.temp < 100) { + 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 = "apricot"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"apricot" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.orange = { + 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: "#FFB400", + category: "food", + breakInto: "juice", + breakIntoColor: "#FFDB00", + isFood: true, + properties: { + fruit: "orange", + type: "fruit", + } +} +elements.orange_seed = { + color: "#291300", + 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 > 50 && pixel.temp < 100) { + 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 = "orange"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"orange" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.random_seed = { + color: "#291300", + tick: function(pixel) { + if(pixel.start == pixelTicks){ + pixel.fruit = fruits[Math.floor(Math.random() * fruits.length)]; + } + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + 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 = pixel.fruit; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.multi_seed = { + color: "#291300", + tick: function(pixel) { + pixel.fruit = fruits[Math.floor(Math.random() * fruits.length)] + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + 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 = "random"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.fruit_vine = { + category: "life", + color: elements.plant.color, + behavior: [["XX", "ST:fruit_vine AND ST:wood", "XX"], ["ST:fruit_vine AND ST:wood", "XX", "ST:fruit_vine AND ST:wood"], ["XX", "ST:fruit_vine AND M1 AND ST:wood", "XX"]], + properties: { + age: 0, + }, + tick: function(pixel){ + if(Math.floor(Math.random() * 100) == 1 && pixel.age > 25 && pixel.age < 500){ + for(var i = 0; i < squareCoords.length; i++){ + let x1 = pixel.x + squareCoords[i][0]; + let y1 = pixel.y + squareCoords[i][1]; + if(!isEmpty(x1,y1) && !outOfBounds(x1,y1) && !vineExclude.includes(pixelMap[x1][y1].element)){ + let randomNum = Math.floor(Math.random() * 4); + let x2 = x1 + squareCoords[randomNum][0]; + let y2 = y1 + squareCoords[randomNum][1]; + if(isEmpty(x2,y2) && !outOfBounds(x2,y2)){ + createPixel("fruit_vine", x2, y2); + pixelMap[x2][y2].fruit = pixel.fruit; + } + } + } + } + pixel.age += 1; + if(pixel.fruit){ + 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) && Math.floor(Math.random() * 1000) == 5){ + createPixel(pixel.fruit, x, y); + } + } + } + if(!pixel.fruit){ + for(var i = 0; i < squareCoords.length; i++){ + let x = pixel.x + squareCoords[i][0]; + let y = pixel.y + squareCoords[i][1]; + if(isEmpty(x,y) || outOfBounds(x,y)){ continue; } + let pixel2 = pixelMap[x][y]; + if(pixel2.fruit){ + pixel.fruit = pixel2.fruit; + } else { continue; } + } + } + } +} +elements.grape.behavior = [["XX", "ST:fruit_vine", "XX"], ["ST:fruit_vine", "XX", "ST:fruit_vine"], ["M2", "ST:fruit_vine AND M1", "M2"]]; +elements.tomato.behavior = elements.grape.behavior; +elements.tomato_seed = { + color: "#FFFAAD", + category: "life", + behavior: behaviors.POWDER, + tick: function(pixel){ + if(pixel.age > 40){ + changePixel(pixel, "fruit_vine"); + pixel.fruit = "tomato"; + } + pixel.age += 1; + }, + properties: { + age: 0, + }, +} +elements.grape_seed = { + color: "#231A00", + category: "life", + behavior: behaviors.POWDER, + tick: function(pixel){ + if(pixel.age > 40){ + changePixel(pixel, "fruit_vine"); + pixel.fruit = "grape"; + } + pixel.age += 1; + }, + properties: { + age: 0, + }, +} +elements.kiwi = { + behavior: elements.grape.behavior, + color: "#403000", + category: "food", + breakInto: "juice", + breakIntoColor: "#21A800", + isFood: true, + properties: { + type: "fruit", + } +} +elements.kiwi_seed = { + color: "#231A00", + category: "life", + behavior: behaviors.POWDER, + tick: function(pixel){ + if(pixel.age > 40){ + changePixel(pixel, "fruit_vine"); + pixel.fruit = "kiwi"; + } + pixel.age += 1; + }, + properties: { + age: 0, + }, +} +elements.bush_base = { + color: elements.wood.color, + behavior: [ + ["CR:bush_cane%25", "XX", "CR:bush_cane%25"], + ["XX", "XX", "XX"], + ["XX", "XX", "XX"] + ], + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -40, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + tick: function(pixel){ + let caneCoords = [[-1,-1],[1,-1]]; + for(var i = 0; i < caneCoords.length; i++){ + let x = pixel.x + caneCoords[i][0]; + let y = pixel.y + caneCoords[i][1]; + if(!isEmpty(x,y) && !outOfBounds(x,y)){ + let pixel2 = pixelMap[x][y]; + if(pixel2.element == "bush_cane" && !pixel2.fruit){ + pixel2.fruit = pixel.fruit; + } + } + } + } +}; +elements.bush_cane = { + color: elements.wood.color, + tick: function(pixel){ + if(pixel.age < 200 && Math.floor(Math.random() * 40) == 1){ + if(!outOfBounds(pixel.x,pixel.y-1)){ + if(isEmpty(pixel.x,pixel.y-1)){ + createPixel("bush_cane",pixel.x,pixel.y-1); + if(pixel.fruit){ + let pixel2 = pixelMap[pixel.x][pixel.y-1]; + pixel2.fruit = pixel.fruit; + pixel2.age = pixel.age; + } + } + } + } + if(pixel.fruit && Math.floor(Math.random() * 400) == 1 && pixel.age > 200){ + 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)){ + createPixel("fruit_leaves", x, y); + pixelMap[x][y].fruit = pixel.fruit; + pixel.blooming = trueFalse(1, 1)[Math.floor(Math.random() * 2)]; + } + } + } + pixel.age += 1; + }, + properties: { + age: 0, + }, + category: "life", + tempLow: -2, + stateLow: "frozen_plant", +} +function trueFalse(numTrue, numFalse){ + let list = []; + for(var i = 0; i < numTrue; i++){ + list.push(true); + } + for(var i = 0; i < numFalse; i++){ + list.push(false); + } + return list; +} +elements.raspberry_seed = { + color: "#ffe099", + behavior: behaviors.STURDYPOWDER, + category: "life", + properties: { + age: 0, + }, + tick: function(pixel){ + if(pixel.age > 40){ + let x1 = pixel.x - 1; + let y = pixel.y; + let x2 = pixel.x + 1; + if(isEmpty(x1,y) && !outOfBounds(x1,y)){ + createPixel("bush_base", x1, y); + pixelMap[x1][y].fruit = "raspberry"; + } + if(isEmpty(x2,y) && !outOfBounds(x2,y)){ + createPixel("bush_base", x2, y); + pixelMap[x2][y].fruit = "raspberry"; + } + if(!isEmpty(x1, y) && !isEmpty(x2, y)){ + deletePixel(pixel.x, pixel.y); + } + } + pixel.age += 1; + } +} +elements.raspberry = { + behavior: [["XX", "ST:bush_cane", "XX"],["ST:bush_cane", "XX", "ST:bush_cane"],["M2", "ST:bush_cane AND M1", "M2"]], + color: ["#b00009", "#bf000a", "#d10812", "#db1822"], + category: "food", + breakInto: "juice", + breakIntoColor: "#ff2b36", + isFood: true, + properties: { + fruit: "raspberry", + type: "fruit", + } +} +elements.blueberry_seed = { + color: "#ffe099", + behavior: behaviors.STURDYPOWDER, + category: "life", + properties: { + age: 0, + }, + tick: function(pixel){ + if(pixel.age > 40){ + let x1 = pixel.x - 1; + let y = pixel.y; + let x2 = pixel.x + 1; + if(isEmpty(x1,y) && !outOfBounds(x1,y)){ + createPixel("bush_base", x1, y); + pixelMap[x1][y].fruit = "blueberry"; + } + if(isEmpty(x2,y) && !outOfBounds(x2,y)){ + createPixel("bush_base", x2, y); + pixelMap[x2][y].fruit = "blueberry"; + } + if(!isEmpty(x1, y) && !isEmpty(x2, y)){ + deletePixel(pixel.x, pixel.y); + } + } + pixel.age += 1; + } +} +elements.blueberry = { + behavior: [["XX", "ST:bush_cane", "XX"],["ST:bush_cane", "XX", "ST:bush_cane"],["M2", "ST:bush_cane AND M1", "M2"]], + color: ["#01082b", "#060e3d", "#111b52", "#1e2866"], + category: "food", + breakInto: "juice", + breakIntoColor: "#726778", + isFood: true, + properties: { + fruit: "blueberry", + type: "fruit", + } +} +elements.blackberry_seed = { + color: "#ffe099", + behavior: behaviors.STURDYPOWDER, + category: "life", + properties: { + age: 0, + }, + tick: function(pixel){ + if(pixel.age > 40){ + let x1 = pixel.x - 1; + let y = pixel.y; + let x2 = pixel.x + 1; + if(isEmpty(x1,y) && !outOfBounds(x1,y)){ + createPixel("bush_base", x1, y); + pixelMap[x1][y].fruit = "blackberry"; + } + if(isEmpty(x2,y) && !outOfBounds(x2,y)){ + createPixel("bush_base", x2, y); + pixelMap[x2][y].fruit = "blackberry"; + } + if(!isEmpty(x1, y) && !isEmpty(x2, y)){ + deletePixel(pixel.x, pixel.y); + } + } + pixel.age += 1; + } +} +elements.blackberry = { + behavior: [["XX", "ST:bush_cane", "XX"],["ST:bush_cane", "XX", "ST:bush_cane"],["M2", "ST:bush_cane AND M1", "M2"]], + color: ["#0c0021", "#070014", "#080017", "#09001a"], + category: "food", + breakInto: "juice", + breakIntoColor: "#2e0000", + isFood: true, + properties: { + fruit: "blackberry", + type: "fruit", + } +} +elements.mango = { + 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: ["#d63a45", "#e97341", "#9d9f3e", "#e4791b"], + category: "food", + breakInto: "juice", + breakIntoColor: "#ffa300", + isFood: true, + properties: { + fruit: "mango", + type: "fruit", + } +} +elements.mango_seed = { + color: "#240c00", + 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 > 50 && pixel.temp < 100) { + 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 = "mango"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"mango" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.seed_maker = { + category: "machines", + 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(allFruits.includes(pixel2.element)){ + changePixel(pixel2, `${pixel2.element}_seed`) + } + } + } + } +} diff --git a/mods/save_loading.js b/mods/save_loading.js index 8fcab069..5f5dad74 100644 --- a/mods/save_loading.js +++ b/mods/save_loading.js @@ -69,6 +69,7 @@ try { width: width, height: height, pixelSize: pixelSize, + pixelTicks: pixelTicks, settings: settings, version: 1, enabledMods: localStorage.enabledMods, @@ -322,6 +323,7 @@ try { width = json.width; height = json.height; pixelSize = json.pixelSize; + pixelTicks = (json.pixelTicks ?? 0); //currentPixels = json.currentPixels; for(i = 0; i < json.pixelMap.length; i++) { json.pixelMap[i] = json.pixelMap[i].map(x => zeroToNull(x)); diff --git a/mods/sbstuff.js b/mods/sbstuff.js index 596e6999..41ee6af0 100644 --- a/mods/sbstuff.js +++ b/mods/sbstuff.js @@ -3,7 +3,7 @@ elements.cooked_rice = { tempMin: 20, stateMin: "rice", tempHigh: 500, - stateHigh: ["ash", "charcoal"], + stateHigh: "charcoal", density: 699, color: "#c2b6b6", behavior: behaviors.LIQUID, @@ -16,37 +16,39 @@ elements.cooked_rice = { elements.rice = { breakInto: "flour", - viscosity: 10000, isFood: true, density: 696, tempHigh: 232, stateHigh: "cooked_rice", color: "#c8c8c8", - behavior: behaviors.LIQUID, + behavior: behaviors.POWDER, category: "food", state: "liquid", }; elements.moth = { tempHigh: 500, - stateHigh: "ash", + stateHigh: "dead_bug", + breakInto: "dead_bug", color: "#57381a", behavior: behaviors.FLY, category: "life", - state: "solid", + state: "liquid", }; elements.cotton_candy = { isFood: true, - tempHigh: 500, - stateHigh: "ash", + tempHigh: 200, + stateHigh: "sugar", density: 1000, - color: "#b6c7e3", + color: ["#b6c7e3", "#c54b4b", "#e7769c"], + singleColor: true, behavior: behaviors.POWDER, category: "food", state: "liquid", reactions: { - "water": { elem1: "sugar", elem2: null }, + "water": { elem1: "sugar", elem2: "water" }, + "sugar_water": { elem1: "sugar", elem2:"sugar_water", chance: 10 } } }; @@ -192,6 +194,8 @@ elements.green_berries = { elements.meth = { hardness: 1, tempHigh: 500, + tempLow: -50, + stateLowColorMultiplier: 0.9, stateHigh: "melted_meth", color: "#0affef", behavior: behaviors.POWDER, @@ -199,6 +203,18 @@ elements.meth = { state: "liquid" }; +elements.melted_meth = { + viscosity: 1000, + tempHigh: 100000, + tempLow: -20, + stateHigh: "beans", + stateLow: "meth", + color: "#00a2ff", + behavior: behaviors.LIQUID, + category: "joke", + state: "solid", +}; + elements.garlic = { isFood: true, tempHigh: 500, @@ -217,7 +233,7 @@ elements.garlic_bread = { breakInto: "crumb", tempHigh: 500, stateHigh: "ash", - color: ["#db9b56", "#288a0c", "#db9b56", "#db9b56", "#db9b56", "#db9b56"], + color: ["#e9be90", "#288a0c", "#e0c6aa", "#b49e85", "#b6926b", "#ccac8b"], behavior: behaviors.STURDYPOWDER, category: "food", state: "solid", @@ -249,6 +265,8 @@ elements.lemon = { elements.lemonade = { isFood: true, tempHigh: 500, + tempLow: -15, + tempLowColor: "#f8eb35", stateHigh: "steam", color: "#fff41c", behavior: behaviors.LIQUID, @@ -269,6 +287,18 @@ elements.poop = { } }; +elements.diarrhea = { + hardness: 1, + viscosity: 10000, + tempHigh: 500, + stateHigh: ["ash", "ash", "ash", "ash", "ash", "ash", "ash", "steam",], + color: "#523718", + behavior: behaviors.LIQUID, + category: "joke", + state: "solid", + desc: "riddle me this, libshart, if theres liquid poop then wheres the solid piss?" +}; + elements.marshmallow = { isFood: true, tempHigh: 50, @@ -330,6 +360,7 @@ elements.cereal = { behavior: behaviors.STURDYPOWDER, category: "food", state: "liquid", + stain: 0.005 }; elements.sushi = { @@ -355,6 +386,7 @@ elements.diamond_ore = { elements.coca_cola = { isFood: true, tempHigh: 500, + tempLow: -10, stateHigh: "steam", color: "#381e13", behavior: behaviors.LIQUID, @@ -365,6 +397,7 @@ elements.coca_cola = { elements.pepsi = { tempHigh: 500, stateHigh: "steam", + tempLow: -10, color: "#2b1717", behavior: behaviors.LIQUID, category: "liquids", @@ -374,6 +407,7 @@ elements.pepsi = { elements.piss = { tempHigh: 500, stateHigh: "steam", + tempLow: -10, color: "#ffff00", behavior: behaviors.LIQUID, category: "joke", @@ -405,17 +439,10 @@ elements.pastry = { state: "solid", }; -elements.melted_meth = { - tempHigh: 100000, - stateHigh: "beans", - color: "#00a2ff", - behavior: behaviors.LIQUID, - category: "joke", - state: "solid", -}; -elements.expired_milk = { +elements.spoiled_milk = { tempHigh: 500, + tempLow: -20, stateHigh: "ash", color: "#b8c2b4", behavior: behaviors.LIQUID, @@ -523,6 +550,8 @@ elements.mashed_pea = { elements.burnt_beans = { tempHigh: 500, stateHigh: "ash", + tempLow: -0, + stateLow: "beans", isFood: true, viscosity: 10000, density: 721, @@ -801,6 +830,7 @@ elements.barbecue_sauce = { viscosity: 3000, density: 1800, tempHigh: 500, + tempLow: 0, stateHigh: "steam", color: "#420400", behavior: behaviors.LIQUID, @@ -907,6 +937,7 @@ elements.porridge = { viscosity: 3000, density: 500, tempHigh: 500, + tempLow: -10, stateHigh: "steam", color: "#b8a254", behavior: behaviors.LIQUID, @@ -938,7 +969,7 @@ elements.chocolate_grape = { viscosity: 10000, tempHigh: 300, stateHigh: "steam", - color: ["#9e3475", "#6e4d36"], + color: ["#7e600d", "#6e4d36"], behavior: behaviors.LIQUID, category: "food", state: "liquid", @@ -949,7 +980,7 @@ elements.sprinkles = { stateHigh: "ash", cooldown: 0.2, color: ["#ff5e5e", "#ffea5e", "#73ff5e", "#5efcff", "#995eff", "#ff5ed1"], - behavior: behaviors.STURDYPOWDER, + behavior: behaviors.POWDER, category: "powders", state: "liquid", maxSize: 1, @@ -965,6 +996,7 @@ elements.incinerator = { category: "machines", state: "solid", insulate: true, + excludeRandom: true, reactions: { "fart": { elem1: null, elem2: "ohio" }, } @@ -1113,6 +1145,7 @@ elements.strawberry = { elements.beer = { tempHigh: 300, stateHigh: "steam", + tempLow: -10, color: "#b39329", behavior: behaviors.LIQUID, category: "liquids", @@ -1140,8 +1173,10 @@ elements.carrot = { }; elements.wine = { + hidden: true, tempHigh: 400, stateHigh: "steam", + tempLow: -10, color: "#2e0206", behavior: behaviors.LIQUID, category: "liquids", @@ -1173,6 +1208,7 @@ elements.dark_energy = { ], category: "special", state: "gas", + excludeRandom: true }; elements.ohio = { @@ -1189,6 +1225,7 @@ elements.ohio = { category: "joke", state: "gas", desc: "use at own risk", + excludeRandom: true }; elements.papaya = { @@ -1279,6 +1316,9 @@ elements.heavy_water = { behavior: behaviors.LIQUID_OLD, category: "liquids", state: "liquid", + reactions: { + "sand": { elem1: null, elem2: "quicksand" }, + } }; elements.blood_orange = { @@ -1308,6 +1348,7 @@ elements.cranberry = { hidden: true, tempHigh: 300, stateHigh: "steam", + tempLow: -15, color: "#ad2a1d", behavior: behaviors.LIQUID, category: "food", @@ -1441,6 +1482,7 @@ elements.uraniumaniumaniumaniumanium_popcornicecream_plutoniumeptunium_238239 = elements.coffee_milk = { tempHigh: 300, stateHigh: "steam", + tempLow: -30, color: "#5c4c42", behavior: behaviors.LIQUID, category: "liquids", @@ -1565,6 +1607,7 @@ elements.electron = { }; elements.sned = { + desc: "slowly expanding...", color: "#dfe0d9", behavior: [ "XX|XX AND CR:sned%1|XX", @@ -1580,7 +1623,7 @@ elements.uranium_tea = { temp: 60, tempHigh: 400, stateHigh: "molten_uranium", - color: ["#0f8b15", "#316624", "#59864b", "#502e0f"], + color: ["#526306", "#40530c", "#80320e", "#502e0f"], behavior: behaviors.RADLIQUID, category: "liquids", state: "liquid" @@ -1598,19 +1641,19 @@ elements.powerlaser = { if (Math.random() > 0.05) { continue } createPixel("flash", x, y); pixelMap[x][y].color = "#b80ced"; - pixelMap[x][y].temp = 1001000; + pixelMap[x][y].temp = 11000; } else { if (elements[pixelMap[x][y].element].isGas) { continue } if (elements[pixelMap[x][y].element].id === elements.heat_ray.id) { break } - pixelMap[x][y].temp += 901000; + pixelMap[x][y].temp += 9000; pixelTempCheck(pixelMap[x][y]); break; } } deletePixel(pixel.x, pixel.y); }, - temp: 1000000, + temp: 10000, category: "energy", state: "gas", excludeRandom: true, @@ -1629,6 +1672,70 @@ elements.magma_bomb = { state: "liquid" }; +elements.quicksand = { + viscosity: 10000, + tempHigh: 1000, + stateHigh: ["molten_glass", "molten_glass", "molten_glass", "molten_glass", "steam"], + color: ["#b1873a", "#cea250"], + behavior: behaviors.LIQUID, + category: "land", + state: "liquid", + density: 1400, + stain: 0.02 +}; + +elements.liquid_filler = { + color: "#ae00ff", + behavior: [ + "XX|XX AND CR:liquid_filler%50|XX", + "M2 AND CR:liquid_filler%50|XX|M2 AND CR:liquid_filler%50", + "M1|M1 AND CH:liquid_filler%50|M1", + ], + category: "special", + state: "liquid" +}; + +elements.antimony = { + color: ["#4b90b8", "#a3bfd8", "#89a0b6", "#8798a7", "#738092"], + behavior: behaviors.WALL, + category: "solids", + state: "solid", + density: 6697, + tempHigh: 630, + stateHigh: "melted_antimony", + alias: "...sb?!" +}; + +elements.melted_antimony = { + color: ["#8fb2c7", "#7494b1", "#72a1cc", "#a3aaaf", "#a4aab3"], + behavior: behaviors.LIQUID, + category: "liquids", + state: "liquid", + density: 6697, + stain: 0.1, + tempLow: -270, + stateLowName: "antimony_ice" +}; + +elements.unstain = { + color: "#729fff", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + stain: -1, + tool: (pixel) => { + doStaining({ + element: "unstain", + x: pixel.x, + y: pixel.y + }) + }, + category: "tools", + state: "solid", +}; + elements.incinerate.category = "tools", elements.cook.category = "tools", elements.room_temp.category = "tools", @@ -1663,6 +1770,9 @@ elements.potato.reactions.steam = {elem1: "fries", tempMin: 100, chance:50} if (!elements.water.reactions) elements.water.reactions = {}; elements.water.reactions.cocaine = { elem1: "solid_water", elem2: null } +if (!elements.alcohol.reactions) elements.alcohol.reactions = {}; +elements.alcohol.reactions.juice = {elem1:"wine", elem2:null, chance:5} + if (!elements.paper.reactions) elements.paper.reactions = {}; elements.paper.reactions.bless = { elem1: "robux", elem2: null, chance: 0.0000001 } diff --git a/mods/singleColor.js b/mods/singleColor.js index 7d6e23a4..0fc8d32b 100644 --- a/mods/singleColor.js +++ b/mods/singleColor.js @@ -1,3 +1 @@ -for (var element in elements) { - elements[element].singleColor = true; -} \ No newline at end of file +window.addEventListener('load', function() {for (var element in elements) {elements[element].singleColor = true;}});