diff --git a/index.html b/index.html index 3138d1b4..c1f843c9 100644 --- a/index.html +++ b/index.html @@ -14445,7 +14445,7 @@ for (var k = 0; k < b0.split(" AND ").length; k++) { function loadFromFile() { var input = document.createElement("input"); input.type = "file"; - input.accept = ".sbxls,.json,.txt,text/*,application/json"; + // input.accept = ".sbxls,.json,.txt,text/*,application/json"; input.addEventListener("change", function(e) { var file = e.target.files[0]; var reader = new FileReader(); diff --git a/mod-list.html b/mod-list.html index 45665bb6..3f0838ce 100644 --- a/mod-list.html +++ b/mod-list.html @@ -112,11 +112,12 @@ fools.jsAdds back FOOLS ModeR74n smooth_water.jsChanges water mechanics so that it flows in one direction until it bounces off of somethingR74n spring.jsMany nature elements, like sakura trees, butterflies, beehives, and moreR74n +survival.jsWith limited resources, you must craft, sell, and buy to progressR74n velocity.jsBeta for explosion velocity, and later wind, which may come to the base game in the futureR74n 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 @@ -167,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 @@ -234,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 @@ -243,13 +245,11 @@ 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 funny elements 2022-11-15.jsAdds a few curated randomly-generated elementsAlice -funny_liquid_2.jsAdds urineAlice -funny_liquid_3.jsAdds vomitAlice funny_solid.jsAdds fecesAlice haseulite.jsAdds Loona-related materials with various propertiesAlice iean.jsAdds lean and its ingredientsAlice diff --git a/mods/Mucho_frio_y_Calor.js b/mods/Mucho_frio_y_Calor.js new file mode 100644 index 00000000..02872888 --- /dev/null +++ b/mods/Mucho_frio_y_Calor.js @@ -0,0 +1,16 @@ +elements.Calor = { + color: "#ff2f2f", + tool: function(pixel) { + pixel.temp += 500000000000000000000500000000000000000000; + pixelTempCheck(pixel) + }, + category: "tools", +}; +elements.Frio = { + color: "#2f2fff", + tool: function(pixel) { + pixel.temp += -500000000000000000000500000000000000000000; + pixelTempCheck(pixel) + }, + category: "tools", +}; \ No newline at end of file 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 800c9e8a..19a628b3 100644 --- a/mods/aChefsDream.js +++ b/mods/aChefsDream.js @@ -1,8 +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.4 +v1.6 + +me trying to come up with stuff not in plants.js: + +Upcoming Features: +- onions +- spring onions +- soy sauce +- rice and porridge (white rice noodles) +- seaweed and agar +- pigs, ham and bacon +- garlic +- msg +- stainless steel +- 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 @@ -192,6 +217,42 @@ Changelog (v1.4) - added ginger - added ginger juice - added ginger rhizomes, pseudostems and leaves + + + +Changelog (v1.5) + - added blueberries + - added blueberries + - added blueberry seeds, stem, and leaves + - added blueberry juice + - added strawberry and blueberry jam + - added cut blueberries + - added advanced dough + - added carbonic acid + - 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 + + + + + */ /* @@ -201,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 @@ -219,6 +293,8 @@ elements.knife = { desc: "Use on pixels to cut them, if possible." } +eLists.JUICEMIXABLE = ["juice"]; + elements.chicken = { color: ["#c29046", "#f5d271", "#d4bd7d"], behavior: [ @@ -536,7 +612,7 @@ elements.raw_chicken = { "smoke": {elem1: "smoked_chicken"}, "steam": {elem1: "steamed_chicken"}, "water": {elem1: "boiled_chicken", tempMin: 70}, - "cooking_oil": {elem1: "fried_chicken", tempMin: 70} + "nut_oil": {elem1: "fried_chicken", tempMin: 70} } }; @@ -575,7 +651,7 @@ elements.raw_chicken_nugget = { stateHigh: ["ash", "smoke"], hidden: true, reactions: { - "cooking_oil": {elem1: "chicken_nugget", tempMin: 70} + "nut_oil": {elem1: "chicken_nugget", tempMin: 70} } }; @@ -678,22 +754,67 @@ elements.olive = { "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 }, - "rock": { elem1:"cooking_oil", elem2:"rock", chance:0.035 }, + "rock": { elem1:"nut_oil", elem2:"rock", chance:0.035, color1: "#ffc844" }, }, category:"food", tempHigh: 100, stateHigh: "dead_plant", - tempLow: -1.66, - stateLow: "frozen_plant", burn:65, burnTime:60, burnInto: "dead_plant", - breakInto: "cooking_oil", - state: "solid", + breakInto: "nut_oil", + breakIntoColor: "#ffc844", 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", behavior: behaviors.LIQUID, @@ -711,7 +832,7 @@ elements.cooking_oil = { "peeled_potato": {elem2: "fried_potato", tempMin: 70} } }, - +*/ elements.pepper = { color: ["#1f190a", "#2b200d", "#362712", "#3b2211"], behavior: behaviors.POWDER, @@ -752,7 +873,7 @@ elements.peeled_potato = { stateHigh: "baked_potato", density: 1100, reactions: { - "cooking_oil": { elem1: "fried_potato", tempMin: 70 } + "nut_oil": { elem1: "fried_potato", tempMin: 70 } } } @@ -843,8 +964,6 @@ elements.apple = { category:"food", tempHigh: 100, stateHigh: "dead_plant", - tempLow: -1.66, - stateLow: "frozen_plant", burn:65, burnTime:60, burnInto: "dead_plant", @@ -929,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", @@ -1153,8 +1281,6 @@ elements.orange = { category:"food", tempHigh: 100, stateHigh: "dead_plant", - tempLow: -1.66, - stateLow: "frozen_plant", burn:65, burnTime:60, burnInto: "dead_plant", @@ -1231,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, @@ -1244,6 +1378,7 @@ elements.orange_juice = { temp: 30, tempLow: 0 }; +eLists.JUICEMIXABLE.push("orange_juice"); elements.orange_peels = { color: "#d69c31", @@ -1436,7 +1571,7 @@ elements.raw_salmon = { "smoke": {elem1: "smoked_salmon"}, "steam": {elem1: "steamed_salmon"}, "water": {elem1: "boiled_salmon", tempMin: 70}, - "cooking_oil": {elem1: "fried_salmon", tempMin: 70} + "nut_oil": {elem1: "fried_salmon", tempMin: 70} } } @@ -1509,7 +1644,7 @@ elements.raw_tuna = { "smoke": {elem1: "smoked_tuna"}, "steam": {elem1: "steamed_tuna"}, "water": {elem1: "boiled_tuna", tempMin: 70}, - "cooking_oil": {elem1: "fried_tuna", tempMin: 70} + "nut_oil": {elem1: "fried_tuna", tempMin: 70} } } @@ -1662,8 +1797,6 @@ elements.watermelon = { category:"food", tempHigh: 100, stateHigh: "dead_plant", - tempLow: -1.66, - stateLow: "frozen_plant", burn:65, burnTime:60, burnInto: "dead_plant", @@ -1690,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, @@ -1703,6 +1844,7 @@ elements.watermelon_juice = { temp: 30, tempLow: 0 }; +eLists.JUICEMIXABLE.push("watermelon_juice"); elements.grape = { color: ["#b84b65","#a10e69","#a10e95","#8a3eab"], @@ -1737,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" }, @@ -1744,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, @@ -1756,35 +1907,22 @@ elements.grape_juice = { hidden: true, isFood: true }; +eLists.JUICEMIXABLE.push("grape_juice"); elements.cream_of_tartar = { color: ["#EFEFEF", "#EBEBEB", "#D8D8D6"], behavior: behaviors.POWDER, category: "food", state: "solid", - tempHigh: 200, - stateHigh: "caramel", density: 1500, isFood: true, hidden: true, - reaction: { - "sugar_water": {elem2: "corn_syrup", elem1: null, tempMin: 110} + reactions: { + "sugar_water": {elem2: "corn_syrup", elem1: null, tempMin: 80}, + "carbonic_acid": {elem1: null, elem2: "carbon_dioxide"} } } -elements.wine = { - color: ["#6F0013", "#6D0112"], - behavior: behaviors.LIQUID, - category: "liquids", - state: "liquid", - tempHigh: 100, - stateHigh: "steam", - isFood: true, - density: 1000, - hidden: true, - tempLow: 0 -} - elements.corn_syrup = { color: ["#FFCD0C", "#E47F00", "#FEB003"], behavior: behaviors.LIQUID, @@ -1797,6 +1935,39 @@ elements.corn_syrup = { viscosity: 10000 } +if (!elements.baking_soda.reactions) elements.baking_soda.reactions = {}; +elements.baking_soda.reactions.water = { elem1: "carbonic_acid", elem2: "carbonic_acid" } + +elements.carbonic_acid = { + color: ["#E0DEA5", "#DFDB9C", "#EBE8BC"], + behavior: behaviors.LIQUID, + category: "liquids", + state: "liquid", + hidden: true, +} + +elements.wine = { + color: ["#6F0013", "#6D0112"], + 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, + density: 1000, + hidden: true, + tempLow: 0 +} +//eLists.JUICEMIXABLE.push("wine"); + elements.shrimp = { color: ["#EE5422", "#E9683C", "#F3583F", "#EDA270"], behavior: [ @@ -2024,8 +2195,6 @@ elements.coconut = { category:"food", tempHigh: 100, stateHigh: "dead_plant", - tempLow: -1.66, - stateLow: "frozen_plant", burn:65, burnTime:60, burnInto: "dead_plant", @@ -2058,7 +2227,7 @@ elements.coconut_milk = { viscosity: 1.5, category: "liquids", state: "liquid", - density: 1036.86, + density: 825, isFood: true } @@ -2081,8 +2250,6 @@ elements.cut_coconut = { category:"food", tempHigh: 100, stateHigh: "dead_plant", - tempLow: -1.66, - stateLow: "frozen_plant", burn:65, burnTime:60, burnInto: "dead_plant", @@ -2094,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" }, @@ -2111,6 +2286,7 @@ elements.coconut_juice = { hidden: true, isFood: true } +eLists.JUICEMIXABLE.push("coconut_juice"); elements.lemon_wood = { color: "#786531", @@ -2188,8 +2364,6 @@ elements.lemon = { category:"food", tempHigh: 100, stateHigh: "dead_plant", - tempLow: -1.66, - stateLow: "frozen_plant", burn:65, burnTime:60, burnInto: "dead_plant", @@ -2202,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, @@ -2219,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, @@ -2237,6 +2428,8 @@ elements.lemonade = { tempLow: 0 }; +eLists.JUICEMIXABLE.push("lemonade"); + elements.lemon_zest = { color: "#dbc535", behavior: behaviors.POWDER, @@ -2422,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, @@ -2435,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, @@ -2451,6 +2661,7 @@ elements.apple_cider_vinegar = { temp: 30, tempLow: 0 }; +eLists.JUICEMIXABLE.push("apple_cider_vinegar"); elements.turnip_seed = { color: "#994828", @@ -2571,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, @@ -2584,6 +2803,7 @@ elements.turnip_juice = { hidden: true, temp: 30, }; +eLists.JUICEMIXABLE.push("turnip_juice"); elements.corn = { color: ["#f8d223","#d6ba2a","#f7f5ba","#dbd281","#cdb12d"], @@ -2622,12 +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 }, - "honey": { elem1:"gingerbread", elem2:null }, - "molasses": { elem1:"gingerbread", elem2:null }, - "sap": { elem1:"gingerbread", elem2:null }, - "caramel": { elem1:"gingerbread", 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 }, @@ -2923,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, @@ -2934,8 +3158,12 @@ elements.strawberry_juice = { density: 825, hidden: true, temp: 30, - tempLow: 0 + tempLow: 0, + reactions: { + "sugar": { elem1:"strawberry_jam", elem2:null, chance:0.35 }, + }, }; +eLists.JUICEMIXABLE.push("strawberry_juice"); elements.cream = { color: "#f7f7f7", @@ -3131,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, @@ -3148,3 +3384,839 @@ elements.ginger_juice = { "bread": { elem1:"gingerbread", elem2:null }, }, }; +eLists.JUICEMIXABLE.push("ginger_juice"); + + +elements.blueberry_seed = { + color: "#7a7133", + behavior: behaviors.STURDYPOWDER, + 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 }, + "mercury": { elem1:"dead_plant", elem2:null, chance:0.01 }, + "stench": { elem2:null, chance:0.25 }, + }, + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && 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(pixel,"blueberry_stem"); + } + } + } + pixel.age++; + } + doDefaults(pixel); + }, + category:"life", + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -1.66, + stateLow: "frozen_plant", + burn:15, + burnTime:60, + burnInto: "dead_plant", + breakInto: "dead_plant", + state: "solid", + density: 1050, + cooldown: defaultCooldown +} +elements.blueberry_stem = { + color: "#419c2f", + behavior: [ + "CR:blueberry_stem,blueberry_leaves,blueberry_leaves,blueberry_leaves,blueberry_leaves%3|CR:blueberry_stem,blueberry_leaves,blueberry_leaves,blueberry_leaves,blueberry_leaves%3|CR:blueberry_stem,blueberry_leaves,blueberry_leaves,blueberry_leaves,blueberry_leaves%3", + "CR:blueberry_stem,blueberry_leaves,blueberry_leaves,blueberry_leaves,blueberry_leaves%3|XX|CR:blueberry_stem,blueberry_leaves,blueberry_leaves,blueberry_leaves,blueberry_leaves%3", + "XX|M1|XX", + ], + 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"); + } + } + } + pixel.age++; + } + doDefaults(pixel); + }, + 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 }, + "mercury": { elem1:"dead_plant", elem2:null, chance:0.01 }, + "stench": { elem2:null, chance:0.25 }, + }, + properties: { + "age":0 + }, + category:"life", + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -1.66, + stateLow: "frozen_plant", + burn:15, + burnTime:60, + burnInto: "dead_plant", + breakInto: "dead_plant", + state: "solid", + density: 1050, +} +elements.blueberry_leaves = { + color: "#4bad37", + behavior: [ + "XX|CR:blueberry%2|XX", + "CR:blueberry%2|XX|CR:blueberry%2", + "M2|M1|M2", + ], + 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 }, + "mercury": { elem1:"dead_plant", elem2:null, chance:0.01 }, + "stench": { elem2:null, chance:0.25 }, + }, + category:"life", + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -1.66, + stateLow: "frozen_plant", + burn:15, + burnTime:60, + burnInto: "dead_plant", + breakInto: "dead_plant", + state: "solid", + density: 1050 +} +elements.blueberry = { + color: "#5d4bc4", + behavior: [ + "XX|ST:blueberry_stem,blueberry_leaves|XX", + "ST:blueberry_stem,blueberry_leaves|XX|ST:blueberry_stem,blueberry_leaves", + "M2|M1|M2", + ], + 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 }, + "mercury": { elem1:"dead_plant", elem2:null, chance:0.01 }, + "stench": { elem2:null, chance:0.25 }, + }, + category:"food", + tempHigh: 100, + stateHigh: "dead_plant", + burn:15, + burnTime:60, + burnInto: "dead_plant", + breakInto: "blueberry_juice", + state: "solid", + density: 1050, + cutInto: "cut_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, + stateHigh: ["steam","sugar"], + burn: 70, + burnTime: 300, + burnInto: ["steam", "smoke"], + state: "liquid", + density: 825, + hidden: true, + temp: 30, + tempLow: 0, + reactions: { + "sugar": { elem1:"blueberry_jam", elem2:null, chance:0.35 }, + "milk": { elem1:"fruit_milk", elem2:null, chance:0.35, color1: "#995fb3" }, + }, +}; + +eLists.JUICEMIXABLE.push("blueberry_juice"); +/* +elements.fruit_slushie = { + color: "#ffcc54", + behavior: behaviors.LIQUID, + reactions: { + "dirt": { elem1: null, elem2: "mud" }, + "sand": { elem1: null, elem2: "wet_sand" } + }, + temp: -5, + tempHigh: 18, + tempLow: -20, + stateLow: "ice", + stateHigh: "water", + category: "food", + state: "liquid", + density: 95, + viscosity: 100, + hidden: true +} +*/ + +elements.strawberry_jam = { + color: "#c73c3e", + behavior: behaviors.LIQUID, + category: "food", + tempHigh: 400, + stateHigh: ["sugar","smoke"], + burn: 70, + burnTime: 300, + viscosity: 750, + state: "liquid", + density: 825, + hidden: true +}; +elements.blueberry_jam = { + color: "#281C4B", + behavior: behaviors.LIQUID, + category: "food", + tempHigh: 400, + stateHigh: ["sugar","smoke"], + burn: 70, + burnTime: 300, + viscosity: 750, + state: "liquid", + density: 825, + hidden: true +}; +elements.cut_blueberry = { + color: "#d4ed8a", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "M2|M1|M2", + ], + 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 }, + "mercury": { elem1:"dead_plant", elem2:null, chance:0.01 }, + "stench": { elem2:null, chance:0.25 }, + }, + category:"food", + tempHigh: 100, + stateHigh: "dead_plant", + burn:15, + burnTime:60, + burnInto: "dead_plant", + breakInto: "juice", + breakIntoColor:"#add69a", + state: "solid", + density: 1050, + hidden: true +} + +if (!elements.yeast.reactions) elements.yeast.reactions = {}; +elements.yeast.reactions.flour = { elem1: "advanced_dough", elem2: null } + +elements.advanced_dough = { + color: "#c49f58", + behavior: behaviors.STURDYPOWDER, + reactions: { + "milk": { elem2:"broth", color2:"#ECC891", tempMin:70 }, + "cream": { elem2:"broth", color2:"#ECC891", tempMin:70 }, + }, + category: "food", + tempHigh: 94, + stateHigh: "bread", + stateHighColorMultiplier: 0.9, + burn:40, + burnTime:25, + burnInto:"ash", + state: "solid", + density: 526.9, + isFood: true, + hidden: true +} + +if (!elements.melted_chocolate.reactions) elements.melted_chocolate.reactions = {}; +elements.melted_chocolate.reactions.flour = { elem1: "cookie_dough", elem2: null } + +elements.cookie_dough = { + color: ["#946826","#9e783f","#8a6d41","#614925"], + behavior: behaviors.STURDYPOWDER, + category: "food", + tempHigh: 94, + stateHigh: "cookie", + stateHighColorMultiplier: 1.1, + burn:40, + burnTime:25, + burnInto:"ash", + state: "solid", + density: 526.9, + isFood: true, + hidden: true +} + +elements.cookie = { + color: "#7d5f2e", + behavior: behaviors.STURDYPOWDER, + tempHigh: 605, + stateHigh: "ash", + category: "food", + burn: 30, + burnTime: 200, + burnInto: ["smoke","smoke","smoke","ash"], + breakInto: "crumb", + breakIntoColor: "#7d6216", + state: "solid", + density: 233.96, + isFood: true +} + +elements.nut_oil.name = "cooking_oil" + +elements.fire.temp = 130 + +elements.bread.behavior = behaviors.SUPPORT + +elements.toast.behavior = behaviors.SUPPORT + +if (!elements.caramel.reactions) elements.caramel.reactions = {}; +elements.caramel.reactions.corn_starch = { elem1: "boba_dough", elem2: null, chance: 0.35, tempMin: 70} + +elements.boba_dough = { + color: ["#4a2007","#2b1304"], + behavior: behaviors.STURDYPOWDER, + category: "food", + tempHigh: 400, + stateHigh: "ash", + stateHighColorMultiplier: 0.8, + burn:40, + burnTime:25, + burnInto:"ash", + state: "solid", + density: 526.9, + reactions: { + "water": { elem1:"boba", tempMin:60}, + }, + isFood: true, + hidden: true +} + +elements.boba = { + color: "#59290c", + behavior: behaviors.POWDER, + tempHigh: 300, + stateHigh: "fire", + category: "food", + burn: 30, + burnTime: 200, + burnInto: ["smoke","smoke","smoke","ash"], + breakIntoColor: "#7d6216", + state: "solid", + 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 35568c78..873f89a3 100644 --- a/mods/a_mod_by_alice.js +++ b/mods/a_mod_by_alice.js @@ -1163,10 +1163,11 @@ try { }; function convertHslObjects(color,outputType="rgb") { + if(color == null) { console.error("convertHslObjects: Color is null"); color = {h: 300, s: 100, l: 50} }; switch(outputType.toLowerCase()) { //RGB cases case "rgb": - color = hexToRGB(hslToHex(...Object.values(color))); //hsl to hex, hex to rgb_json, and rgb_json to rgb() + color = convertColorFormats(hslToHex(...Object.values(color)),"json"); //hsl to hex, hex to rgb_json, and rgb_json to rgb() return `rgb(${color.r},${color.g},${color.b})`; break; case "hex": @@ -1202,8 +1203,8 @@ try { break; default: throw new Error("outputType must be \"rgb\", \"hex\", \"rgb_json\", \"rgb_array\", \"hsl\", \"hsl_json\", or \"hsl_array\""); - }; - } + } + }; function changeSaturation(color,saturationChange,operationType="add",outputType="rgb",arrayType=null,doRounding=true) { color = normalizeColorToHslObject(color,arrayType); @@ -2094,13 +2095,15 @@ try { //fix -1-caused ghost pixels function deletePixel(x,y) { + if(isEmpty(x,y,true)) { return false }; // remove pixelMap[x][y] from currentPixels var pixelIndex = currentPixels.indexOf(pixelMap[x][y]); if(pixelIndex !== -1) { currentPixels.splice(pixelIndex,1) + if (pixelMap[x][y]) { delete pixelMap[x][y] }; }; - if (pixelMap[x][y]) {pixelMap[x][y].del = true} - if (pixelMap[x][y]) { delete pixelMap[x][y] }; + //if (pixelMap[x][y]) {pixelMap[x][y].del = true} + //if (pixelMap[x][y]) { delete pixelMap[x][y] }; /*for (var i = 0; i < currentPixels.length; i++) { if (currentPixels[i].x == x && currentPixels[i].y == y) { currentPixels.splice(i, 1); @@ -2133,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 ## @@ -3217,6 +3220,32 @@ color1 and color2 spread through striped paint like dye does with itself. col } }; + //redefine mouseRange to support even sizes + function mouseRange(mouseX,mouseY,size) { + var coords = []; + size = size || mouseSize; + if (elements[currentElement].maxSize < mouseSize) { + var mouseOffset = Math.trunc(elements[currentElement].maxSize/2); + } + else { + var mouseOffset = Math.trunc(size/2); + } + var topLeft = [mouseX-mouseOffset,mouseY-mouseOffset]; + var bottomRight = [mouseX+mouseOffset,mouseY+mouseOffset]; + if(size % 2 == 0) { + bottomRight[0]--; + bottomRight[1]--; + }; + // Starting at the top left, go through each pixel + for (var x = topLeft[0]; x <= bottomRight[0]; x++) { + for (var y = topLeft[1]; y <= bottomRight[1]; y++) { + // If the pixel is empty, add it to coords + coords.push([x,y]); + } + } + return coords; + }; + //this part defines basically all of the keybinds function addKeyboardListeners() { document.addEventListener("keydown", function(e) { @@ -3259,16 +3288,26 @@ color1 and color2 spread through striped paint like dye does with itself. col } return; } + // If the user presses [ or -, decrease the mouse size by 2 if (e.keyCode == 219 || e.keyCode == 189) { - if (shiftDown) {mouseSize = 1} + //If a shift key is pressed, set to 1 + if (shiftDown && shiftDown % 2 == 1) {mouseSize = 1} + //If an alt key is pressed, decrease by 1 + else if (shiftDown && shiftDown % 2 == 0) { + mouseSize--; + if (mouseSize < 1) { mouseSize = 1 } + } else { mouseSize -= 2; - if (mouseSize < 1) { mouseSize = 1; } + if (mouseSize < 1) { mouseSize = 1 } } } // If the user presses ] or =, increase the mouse size by 2 if (e.keyCode == 221 || e.keyCode == 187) { - if (shiftDown) {mouseSize = (mouseSize+15)-((mouseSize+15) % 15)} + //If a shift key is pressed, increase by 15 + if (shiftDown && shiftDown % 2 == 1) {mouseSize = (mouseSize+15)-((mouseSize+15) % 15)} + //If an alt key is pressed, increase by 1 + else if (shiftDown && shiftDown % 2 == 0) {mouseSize++} else {mouseSize += 2;} // if height>width and mouseSize>height, set mouseSize to height, if width>height and mouseSize>width, set mouseSize to width if (mouseSize > (height > width ? height : width)) { mouseSize = (height > width ? height : width); } @@ -3607,6 +3646,11 @@ color1 and color2 spread through striped paint like dye does with itself. col velocityBlacklist = []; function explodeAtPlus(x,y,radius,firee="fire",smokee="smoke",beforeFunction=null,afterFunction=null,changeTemp=true) { + var message = "Explosion "; + var pixel = pixelMap[x]?.[y]; + if(pixel) { message += `of ${pixel.element} ` }; + message += `with radius ${radius} at (${x},${y})`; + // if fire contains , split it into an array if(firee !== null) { if (firee.indexOf(",") !== -1) { @@ -3730,6 +3774,15 @@ color1 and color2 spread through striped paint like dye does with itself. col }; oldExplodeAt = explodeAt; + /*explodeAt = function(x,y,radius,fire="fire") { + var message = "Explosion "; + var pixel = pixelMap[x]?.[y]; + if(pixel) { message += `of ${pixel.element} ` }; + message += `with radius ${radius} with "${fire}" at (${x},${y})`; + console.log(message); + + oldExplodeAt(x,y,radius,fire="fire") + };*/ explodeAt = explodeAtPlus; //MORE CONFIGURABLE REACTION TEMPERATURE CHANGES ## @@ -5029,11 +5082,10 @@ color1 and color2 spread through striped paint like dye does with itself. col if (pixel.charge && elementInfo.colorOn) { customColor = elementInfo.colorOn; } - if (customColor != null) { + if (customColor !== null) { if (Array.isArray(customColor)) { customColor = customColor[Math.floor(Math.random() * customColor.length)]; - } - if (customColor.startsWith("#")) { + } else if (customColor.startsWith?.("#")) { customColor = hexToRGB(customColor); } var rgb = customColor; @@ -5224,7 +5276,7 @@ color1 and color2 spread through striped paint like dye does with itself. col if (!settings["bg"]) {ctx.clearRect(0, 0, canvas.width, canvas.height)} else { if(settings["bg"] instanceof Array) { - settings.bgAngle ??= 0; + settings.bgAngle ??= 90; var angle = (settings.bgAngle) * Math.PI / 180; ctx.fillStyle = ctx.createLinearGradient( 0, @@ -5560,6 +5612,10 @@ color1 and color2 spread through striped paint like dye does with itself. col } var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset]; var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset]; + if(mouseSize % 2 == 0) { + bottomRight[0]--; + bottomRight[1]--; + }; // Draw a square around the mouse ctx.strokeStyle = "white"; ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize); @@ -7930,7 +7986,7 @@ color1 and color2 spread through striped paint like dye does with itself. col } //1010 and 0101 if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.changeTo) { + if(!pixel.changeTo) { //7989 yay soshi! if(ggg < 1/2) { pixel.changeTo = pixel.dc1 } else { @@ -8069,7 +8125,7 @@ color1 and color2 spread through striped paint like dye does with itself. col if(isEmpty(pixel.x+1,pixel.y-1) && isEmpty(pixel.x+1,pixel.y-2) && !outOfBounds(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-2)) { tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x+1,pixel.y-2) - } //7989 yay soshi! + } } } else { if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { @@ -10839,7 +10895,7 @@ color1 and color2 spread through striped paint like dye does with itself. col var lifeEaterCategories = ["life","auto creepers","shit","cum","food","fantastic creatures","fey","auto_fey"]; var lifeEaterBlacklist = ["life_eater_virus","life_eater_slurry","life_eater_infected_dirt"]; - var lifeEaterWhitelist = ["blood","poop","blood_ice","wood","wood_plank","sawdust","straw","paper","birthpool","dried_poop","gloomfly","meat_monster","rotten_ravager","bone_beast","withery","withery_plant","banana","apple","rotten_apple","apioform_player","apioform_bee","apioform","apiodiagoform","sugar_cactus","sugar_cactus_seed","flowering_sugar_cactus","tree_branch","sap","silk","red_velvet","silk_velvet","ketchup", "enchanted_ketchup", "frozen_ketchup", "poisoned_ketchup", "frozen_poisoned_ketchup", "ketchup_spout", "ketchup_cloud", "poisoned_ketchup_cloud", "ketchup_snow", "ketchup_snow_cloud", "poisoned_ketchup_snow", "poisoned_ketchup_snow_cloud", "ketchup_gas", "poisoned_ketchup_gas", "ketchup_powder", "poisoned_ketchup_powder", "eketchup_spout", "ketchup_metal", "antiketchup", "dirty_ketchup", "ketchup_gold", "molten_ketchup_metal", "ketchup_fairy", "ketchup_metal_scrap", "ketchup_gold_scrap", "molten_ketchup_gold", "mycelium","vaccine","antibody","infection","sap","caramel","molasses","melted_chocolate","soda","mustard","fry_sauce","tomato_sauce","sugary_tomato_sauce","bio_ooze","zombie_blood","feather","tooth","decayed_tooth","plaque","tartar","bacteria","replacer_bacteria","pop_rocks"]; + var lifeEaterWhitelist = ["blood","skin","hair","poop","blood_ice","wood","wood_plank","sawdust","straw","paper","birthpool","dried_poop","gloomfly","meat_monster","rotten_ravager","bone_beast","withery","withery_plant","banana","apple","rotten_apple","apioform_player","apioform_bee","apioform","apiodiagoform","sugar_cactus","sugar_cactus_seed","flowering_sugar_cactus","tree_branch","sap","silk","red_velvet","silk_velvet","ketchup", "enchanted_ketchup", "frozen_ketchup", "poisoned_ketchup", "frozen_poisoned_ketchup", "ketchup_spout", "ketchup_cloud", "poisoned_ketchup_cloud", "ketchup_snow", "ketchup_snow_cloud", "poisoned_ketchup_snow", "poisoned_ketchup_snow_cloud", "ketchup_gas", "poisoned_ketchup_gas", "ketchup_powder", "poisoned_ketchup_powder", "eketchup_spout", "ketchup_metal", "antiketchup", "dirty_ketchup", "ketchup_gold", "molten_ketchup_metal", "ketchup_fairy", "ketchup_metal_scrap", "ketchup_gold_scrap", "molten_ketchup_gold", "mycelium","vaccine","antibody","infection","sap","caramel","molasses","melted_chocolate","soda","mustard","fry_sauce","tomato_sauce","sugary_tomato_sauce","bio_ooze","zombie_blood","feather","tooth","decayed_tooth","plaque","tartar","bacteria","replacer_bacteria","pop_rocks"]; var lifeEaterSubstitutions = { "dirt": "life_eater_infected_dirt", "crimsoil": "life_eater_infected_dirt", @@ -17191,9 +17247,9 @@ Pixel size (rendering only): (Use if the save looks cut o elements.electric_gas = { color: ["#3693b3", "#246e64"], behavior: [ - "M2%33.3 AND CR:electric%1|M1%33.3 AND CR:electric%1|M2%33.3 AND CR:electric%1", - "M1%33.3 AND CR:electric%1|XX%0000000000000000000000|M1%33.3 AND CR:electric%1", - "M2%33.3 AND CR:electric%1|M1%33.3 AND CR:electric%1|M2%33.3 AND CR:electric%1", + "M2%33.3 AND CR:electric%1 AND CR:lightning%0.005|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|M2%33.3 AND CR:electric%1 AND CR:lightning%0.005", + "M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|XX%000000000000000000000000000000000000000000000|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005", + "M2%33.3 AND CR:electric%1 AND CR:lightning%0.005|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|M2%33.3 AND CR:electric%1 AND CR:lightning%0.005", ], hardness: 0.8, reactions: { @@ -17202,7 +17258,7 @@ Pixel size (rendering only): (Use if the save looks cut o }, category: "gases", density: 1.225, - state: "gas", + state: "gas" }; corrosiveGasMaxHardness = 0.6 @@ -19256,9 +19312,10 @@ Pixel size (rendering only): (Use if the save looks cut o */ function heejinitoidTick(pixel) { + pixel.color ??= pixelColorPick(pixel); if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; if(pixel.oldColor === undefined) { pixel.oldColor = pixelColorPick(pixel) }; - var color = rgbStringToHSL(convertColorFormats(pixel.oldColor,"rgb"),"json"); + var color = rgbStringToHSL((convertColorFormats(pixel.oldColor,"rgb") ?? pixelColorPick(pixel)),"json"); var heejiniteHueSpread = 30 + (pixel.temp/9.25) var hueOffset = (Math.sin(pixelTicks / 11) * heejiniteHueSpread) + 15; color.h += hueOffset; var color = convertHslObjects(color,"rgb"); @@ -26448,6 +26505,8 @@ Pixel size (rendering only): (Use if the save looks cut o elements.molten_copper ??= {}; elements.molten_copper.tempHigh = 4700; elements.molten_alumina ??= {}; elements.molten_alumina.tempHigh = 5400; + elements.molten_alumina.state = "liquid"; + elements.molten_alumina.autoType = "gas"; elements.molten_alumina.reactions ??= {}; elements.molten_alumina.reactions.iron_scrap = {elem1: "molten_sapphire", elem2: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron",null] }; elements.molten_alumina.reactions.molten_iron = {elem1: "molten_sapphire", elem2: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron",null] }; @@ -35842,7 +35901,7 @@ Make sure to save your command in a file if you want to add this preset again.` }; elements.sponge.onTryMoveInto = function(pixel,otherPixel) { - var absorbedElements = Object.keys(pixel.absorbed); + var absorbedElements = Object.keys(pixel.absorbed ?? {}); if(absorbedElements.length == 0) { return false; }; @@ -36262,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 @@ -36347,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 @@ -36444,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 @@ -36539,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 @@ -44364,7 +44423,7 @@ Make sure to save your command in a file if you want to add this preset again.` var injectorPoisonCategories = ["life","auto creepers","shit","cum","food","fantastic creatures","fey","auto_fey"]; var injectorPoisonBlacklist = ["injector_poison","dead_matter","poisoned_dirt"]; - var injectorPoisonWhitelist = ["blood","poop","blood_ice","wood","wood_plank","sawdust","straw","paper","birthpool","dried_poop","gloomfly","meat_monster","rotten_ravager","bone_beast","withery","withery_plant","banana","apple","rotten_apple","apioform_player","apioform_bee","apioform","apiodiagoform","sugar_cactus","sugar_cactus_seed","flowering_sugar_cactus","tree_branch","sap","silk","red_velvet","silk_velvet","ketchup", "enchanted_ketchup", "frozen_ketchup", "poisoned_ketchup", "frozen_poisoned_ketchup", "ketchup_spout", "ketchup_cloud", "poisoned_ketchup_cloud", "ketchup_snow", "ketchup_snow_cloud", "poisoned_ketchup_snow", "poisoned_ketchup_snow_cloud", "ketchup_gas", "poisoned_ketchup_gas", "ketchup_powder", "poisoned_ketchup_powder", "eketchup_spout", "ketchup_metal", "antiketchup", "dirty_ketchup", "ketchup_gold", "molten_ketchup_metal", "ketchup_fairy", "ketchup_metal_scrap", "ketchup_gold_scrap", "molten_ketchup_gold", "mycelium","vaccine","antibody","infection","sap","caramel","molasses","melted_chocolate","soda","mustard","fry_sauce","tomato_sauce","sugary_tomato_sauce","bio_ooze","zombie_blood","feather","tooth","decayed_tooth","plaque","tartar","bacteria","replacer_bacteria","pop_rocks"]; + var injectorPoisonWhitelist = ["blood","skin","hair","poop","blood_ice","wood","wood_plank","sawdust","straw","paper","birthpool","dried_poop","gloomfly","meat_monster","rotten_ravager","bone_beast","withery","withery_plant","banana","apple","rotten_apple","apioform_player","apioform_bee","apioform","apiodiagoform","sugar_cactus","sugar_cactus_seed","flowering_sugar_cactus","tree_branch","sap","silk","red_velvet","silk_velvet","ketchup", "enchanted_ketchup", "frozen_ketchup", "poisoned_ketchup", "frozen_poisoned_ketchup", "ketchup_spout", "ketchup_cloud", "poisoned_ketchup_cloud", "ketchup_snow", "ketchup_snow_cloud", "poisoned_ketchup_snow", "poisoned_ketchup_snow_cloud", "ketchup_gas", "poisoned_ketchup_gas", "ketchup_powder", "poisoned_ketchup_powder", "eketchup_spout", "ketchup_metal", "antiketchup", "dirty_ketchup", "ketchup_gold", "molten_ketchup_metal", "ketchup_fairy", "ketchup_metal_scrap", "ketchup_gold_scrap", "molten_ketchup_gold", "mycelium","vaccine","antibody","infection","sap","caramel","molasses","melted_chocolate","soda","mustard","fry_sauce","tomato_sauce","sugary_tomato_sauce","bio_ooze","zombie_blood","feather","tooth","decayed_tooth","plaque","tartar","bacteria","replacer_bacteria","pop_rocks"]; var injectorPoisonSubstitutions = { "dirt": "poisoned_dirt", "dry_dirt": "poisoned_dirt", @@ -45937,6 +45996,67 @@ maxPixels (default 1000): Maximum amount of pixels/changes (if xSpacing and ySpa maxColorOffset: 0 }; + + runAfterLoad(function() { + //Emergency bug fix + elemfillerVar = null; + elements.element_filler = { + category: "special", + color: elements.filler.color, + state: "solid", + movable: "false", + onSelect: function() { + var answer6 = prompt("Please input the desired element of this filler. It will not work if you do multiple filter types while paused.",(elemfillerVar||undefined)); + if (!answer6) { return } + elemfillerVar = answer6; + }, + excludeRandom: true, + tick: function(pixel){ + if(!(elementExists(elemfillerVar))) { + deletePixel(pixel.x,pixel.y); + return + }; + var neighbors = 0; + if(!pixel.changeElem){ + pixel.changeElem = elemfillerVar; + } + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x,y, true)) { + neighbors = neighbors + 1; + } else if (isEmpty(x, y)){ + createPixel("element_filler", x, y) + pixelMap[x][y].changeElem = pixel.changeElem; + } else ( + changePixel(pixel, pixel.changeElem) + ) + } + if (neighbors >= 8){ + changePixel(pixel, pixel.changeElem) + } + } + } + + if(elementExists("ohio")) { + elements.ohio.excludeRandom = true + }; + if(elementExists("rainbow_bomb")) { + elements.rainbow_bomb.excludeRandom = true + }; + if(elementExists("fart")) { + elements.fart.excludeRandom = true + }; + if(elementExists("dark_energy")) { + elements.dark_energy.excludeRandom = true + }; + if(elementExists("rainbow_flash")) { + elements.rainbow_flash.excludeRandom = true; + delete elements.rainbow_flash.reactions.fire + }; + }) + //END ## } catch (error) { alert(`Load failed (try reloading).\nThis is likely a sporadic failure caused by inconsistencies in how mods are loaded, and will likely fix itself in a refresh or two. If it persists, then it's an issue.\nError: ${error.stack}`); 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/elem3.js b/mods/elem3.js index 08a385b9..95e6059d 100644 --- a/mods/elem3.js +++ b/mods/elem3.js @@ -170462,7 +170462,7 @@ elements.e15514 = { }; elements.e15515 = { - name: "Niggah", + name: "No", behavior: behaviors.LIQUID, category: "elem3", state: "liquid", @@ -218466,7 +218466,7 @@ elements.e19879 = { }; elements.e19880 = { - name: "Nigga", + name: "No", behavior: behaviors.LIQUID, category: "elem3", state: "liquid", diff --git a/mods/funny_liquid.js b/mods/funny_liquid.js index 2afaed89..821ea0bd 100644 --- a/mods/funny_liquid.js +++ b/mods/funny_liquid.js @@ -1,3 +1,8 @@ +/* +This mod has been moved. +*/ + +/* elements.cum = { name: "cum", color: "#e6e1d5", @@ -610,3 +615,4 @@ runAfterLoad(function() { ] }; }); +*/ \ No newline at end of file diff --git a/mods/injector.js b/mods/injector.js index b1697c3d..4c385004 100644 --- a/mods/injector.js +++ b/mods/injector.js @@ -4,7 +4,7 @@ var structureMod = "mods/structure_test.js"; var rbtMod = "mods/randomness_but_tick.js"; if(enabledMods.includes(libraryMod) && enabledMods.includes(structureMod) && enabledMods.includes(rbtMod)) { - var injectorPoisonCategories = ["life","auto creepers","shit","cum","food","fantastic creatures","fey","auto_fey"]; + var injectorPoisonCategories = ["life","auto creepers","food","fantastic creatures","fey","auto_fey"]; var injectorPoisonBlacklist = ["injector_poison","dead_matter","poisoned_dirt"]; var injectorPoisonWhitelist = ["blood","poop","blood_ice","wood","wood_plank","sawdust","straw","paper","birthpool","dried_poop","gloomfly","meat_monster","rotten_ravager","bone_beast","withery","withery_plant","banana","apple","rotten_apple","apioform_player","apioform_bee","apioform","apiodiagoform","sugar_cactus","sugar_cactus_seed","flowering_sugar_cactus","tree_branch","sap","silk","red_velvet","silk_velvet","ketchup", "enchanted_ketchup", "frozen_ketchup", "poisoned_ketchup", "frozen_poisoned_ketchup", "ketchup_spout", "ketchup_cloud", "poisoned_ketchup_cloud", "ketchup_snow", "ketchup_snow_cloud", "poisoned_ketchup_snow", "poisoned_ketchup_snow_cloud", "ketchup_gas", "poisoned_ketchup_gas", "ketchup_powder", "poisoned_ketchup_powder", "eketchup_spout", "ketchup_metal", "antiketchup", "dirty_ketchup", "ketchup_gold", "molten_ketchup_metal", "ketchup_fairy", "ketchup_metal_scrap", "ketchup_gold_scrap", "molten_ketchup_gold", "mycelium","vaccine","antibody","infection","sap","caramel","molasses","melted_chocolate","soda","mustard","fry_sauce","tomato_sauce","sugary_tomato_sauce","bio_ooze","zombie_blood","feather","tooth","decayed_tooth","plaque","tartar","bacteria","replacer_bacteria","pop_rocks"]; var injectorPoisonSubstitutions = { 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/life_eater.js b/mods/life_eater.js index a7b7b07c..0ca0d1b1 100644 --- a/mods/life_eater.js +++ b/mods/life_eater.js @@ -7,7 +7,7 @@ if(!enabledMods.includes(fireMod)) { alert(`The ${fireMod} mod is required and has been automatically inserted (reload for this to take effect).`); } else { - var lifeEaterCategories = ["life","auto creepers","shit","cum","food","fantastic creatures","fey","auto_fey"]; + var lifeEaterCategories = ["life","auto creepers","food","fantastic creatures","fey","auto_fey"]; var lifeEaterBlacklist = ["life_eater_virus","life_eater_slurry","life_eater_infected_dirt"]; var lifeEaterWhitelist = ["blood","poop","blood_ice","wood","wood_plank","sawdust","straw","paper","birthpool","dried_poop","gloomfly","meat_monster","rotten_ravager","bone_beast","withery","withery_plant","banana","apple","rotten_apple","apioform_player","apioform_bee","apioform","apiodiagoform","sugar_cactus","sugar_cactus_seed","flowering_sugar_cactus","tree_branch","sap","silk","red_velvet","silk_velvet","ketchup", "enchanted_ketchup", "frozen_ketchup", "poisoned_ketchup", "frozen_poisoned_ketchup", "ketchup_spout", "ketchup_cloud", "poisoned_ketchup_cloud", "ketchup_snow", "ketchup_snow_cloud", "poisoned_ketchup_snow", "poisoned_ketchup_snow_cloud", "ketchup_gas", "poisoned_ketchup_gas", "ketchup_powder", "poisoned_ketchup_powder", "eketchup_spout", "ketchup_metal", "antiketchup", "dirty_ketchup", "ketchup_gold", "molten_ketchup_metal", "ketchup_fairy", "ketchup_metal_scrap", "ketchup_gold_scrap", "molten_ketchup_gold", "mycelium","vaccine","antibody","infection","sap","caramel","molasses","melted_chocolate","soda","mustard","fry_sauce","tomato_sauce","sugary_tomato_sauce","bio_ooze","zombie_blood","feather","tooth","decayed_tooth","plaque","tartar","bacteria","replacer_bacteria","pop_rocks"]; var lifeEaterSubstitutions = { 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/nousersthings.js b/mods/nousersthings.js index 5dc8b764..003d7061 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -2006,6 +2006,7 @@ elemfillerVar = 0; elements.element_filler = { category: "special", color: elements.filler.color, + excludeRandom: true, state: "solid", movable: "false", onSelect: function() { @@ -2040,6 +2041,7 @@ var outlinerVar = 0 elements.outliner = { color: elements.filler.color, category: elements.filler.category, + excludeRandom: true, onSelect: function() { var answerot = prompt("Please input the desired element of this outliner. It will not work if you do multiple filter types while paused.",(outlinerVar||undefined)); if (!answerot) { return } @@ -2070,4 +2072,23 @@ elements.outliner = { changePixel(pixel, pixel.changeElem) } } +} +textures.transparency = [ + "wwwggg", + "wwwggg", + "wwwggg", + "gggwww", + "gggwww", + "gggwww" +] +elements.transparency = { + color: ["#d4d4d4", "#ffffff"], + colorPattern: textures.transparency, + colorKey: { + "g": "#D4D4D4", + "w": "#ffffff" + }, + behavior: behaviors.WALL, + category: "special", + state: "solid" } \ No newline at end of file diff --git a/mods/onecolor.js b/mods/onecolor.js new file mode 100644 index 00000000..2820328c --- /dev/null +++ b/mods/onecolor.js @@ -0,0 +1,47 @@ +window.addEventListener('load', function() { + console.log("attempted override") + pixelColorPick = function(pixel,customColor=null) { + var element = pixel.element; + var elementInfo = elements[element]; + //if (elementInfo.behavior instanceof Array) { + + if (pixel.charge && elementInfo.colorOn) { + customColor = elementInfo.colorOn; + } + if (customColor != null) { + if (Array.isArray(customColor)) { + customColor = customColor[0]; + } + if (customColor.startsWith("#")) { + customColor = hexToRGB(customColor); + } + var rgb = customColor; + } + else { + var rgb = elements[element].colorObject; // {r, g, b} + // If rgb is an array, choose a random item + if (Array.isArray(rgb)) { + rgb = rgb[0]; + } + } + // Randomly darken or lighten the RGB color + var coloroffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 15); + var r = rgb.r + 0; + var g = rgb.g + 0; + var b = rgb.b + 0; + // Make sure the color is within the RGB range + r = Math.max(0, Math.min(255, r)); + g = Math.max(0, Math.min(255, g)); + b = Math.max(0, Math.min(255, b)); + var color = "rgb("+r+","+g+","+b+")"; + + /*} + else { + var color = elementInfo.color; + if (Array.isArray(color)) { + color = color[Math.floor(Math.random() * color.length)]; + } + }*/ + return color; + } +}); diff --git a/mods/pizzasstuff.js b/mods/pizzasstuff.js index 463e692b..7e4fb53b 100644 --- a/mods/pizzasstuff.js +++ b/mods/pizzasstuff.js @@ -1,3 +1,34 @@ +elements.freeze_ray = { + color: ["#9ae4f5","#84d6e8"], + tick: function(pixel) { + var x = pixel.x; + for (var y = pixel.y; y < height; y++) { + if (outOfBounds(x, y)) { + break; + } + if (isEmpty(x, y)) { + if (Math.random() > 0.05) { continue } + createPixel("flash", x, y); + pixelMap[x][y].color = "#aedbe6"; + pixelMap[x][y].temp = -257; + } + else { + if (elements[pixelMap[x][y].element].isGas) { continue } + if (elements[pixelMap[x][y].element].id === elements.heat_ray.id) { break } + pixelMap[x][y].temp -= 100; + pixelTempCheck(pixelMap[x][y]); + break; + } + } + deletePixel(pixel.x, pixel.y); + }, + temp: -257, + category: "energy", + state: "gas", + excludeRandom: true, + noMix: true +}; + elements.beer = { color: ["#ffc43d","#ffc43d"], behavior: behaviors.LIQUID, @@ -16,6 +47,9 @@ elements.root_beer = { elements.fruit_slushy = { color: ["#d43968","#ec5885","#f57ca1","#fba9c2","#ffe3eb"], + stateLowColorMultiplier: 1.3, + stateLow: "slushy_ice", + tempLow: "-50", behavior: behaviors.LIQUID, category: "food", state: "solid", @@ -32,6 +66,9 @@ elements.mold = { elements.chocolate_slushy = { color: ["#c3ae9a","#ae967f","#977b5f","#876b4f","#816346"], + stateLowColorMultiplier: 1.3, + tempLow: "-50", + stateLow: "slushy_ice", behavior: behaviors.LIQUID, category: "food", state: "solid", @@ -136,7 +173,7 @@ elements.fruit_yogurt = { elements.frozen_fruit_yogurt = { color: ["#ffdfdf","#ffc0c0","#ff9b9b"], - stateLowColorMultiplier: 0.7, + stateHighColorMultiplier: 0.7, behavior: behaviors.STURDYPOWDER, category: "food", state: "solid", @@ -149,7 +186,7 @@ elements.frozen_fruit_yogurt = { elements.frozen_chocolate_yogurt = { color: ["#a87848","#a57e57","#c1a07f","#e2c5ac","#efd0b1"], - stateLowColorMultiplier: 0.7, + stateHighColorMultiplier: 0.7, behavior: behaviors.STURDYPOWDER, category: "food", state: "solid", @@ -418,7 +455,7 @@ elements.moss = { }; elements.moth = { - color: "#665233", + color: ["#df8830","#e9b477","#a1591a","#a87a46","#4e3212"], behavior: behaviors.FLY, category: "life", state: "solid", @@ -661,7 +698,6 @@ elements.banana = { breakInto: "juice", breakIntoColor: "#f0f060", reactions: { - "steam": { elem1: "potassium", elem2: null }, "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fdf8d6","#f9efa6"] }, } }; @@ -1074,14 +1110,6 @@ elements.eggplant = { breakIntoColor: ["#674ea7","#351c75"], }; -elements.potassium = { - color: "#a3a333", - behavior: behaviors.POWDER, - category: "states", - state: "solid", - breakInto: "juice", -}; - elements.onion = { color: ["#62121b","#a92940","#c04b65","#d8699e"], behavior: @@ -1282,7 +1310,7 @@ elements.legacy_rocket = { "XX|DL%1|XX", "CR:smoke|CR:fire|CR:smoke", ], - category: "special", + category: "legacy", hidden:true, state: "solid", temp:700, @@ -1292,6 +1320,84 @@ elements.legacy_rocket = { stateHigh: "molten_steel" }; +elements.legacy_dough = { + color: "#bfac91", + behavior: behaviors.STURDYPOWDER, + onMix: function(dough,ingredient) { + if (elements[ingredient.element].isFood && elements[ingredient.element].id !== elements.dough.id && elements[ingredient.element].id !== elements.flour.id && elements[ingredient.element].id !== elements.batter.id && elements[ingredient.element].id !== elements.bread.id) { + var rgb1 = dough.color.match(/\d+/g); + var rgb2 = ingredient.color.match(/\d+/g); + // average the colors + var rgb = [ + Math.round((parseInt(rgb1[0])+parseInt(rgb2[0]))/2), + Math.round((parseInt(rgb1[1])+parseInt(rgb2[1]))/2), + Math.round((parseInt(rgb1[2])+parseInt(rgb2[2]))/2) + ]; + changePixel(ingredient, "dough") + // convert rgb to hex + var hex = RGBToHex(rgb); + dough.color = pixelColorPick(dough, hex); + // 50% change to delete ingredient + if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); } + else { + ingredient.color = pixelColorPick(ingredient, hex); + } + } + }, + reactions: { + "milk": { elem2:"broth", color2:"#ECC891", tempMin:70 }, + "cream": { elem2:"broth", color2:"#ECC891", tempMin:70 }, + }, + category: "legacy", + tempHigh: 94, + stateHigh: "bread", + //stateHighColorMultiplier: 0.9, + burn:40, + burnTime:25, + burnInto:"ash", + state: "solid", + density: 526.9, + isFood: true +}; + +elements.legacy_batter = { + color: "#d4bc85", + behavior: behaviors.LIQUID, + onMix: function(batter,ingredient) { + if (elements[ingredient.element].isFood && elements[ingredient.element].id !== elements.batter.id && elements[ingredient.element].id !== elements.flour.id && elements[ingredient.element].id !== elements.yolk.id && elements[ingredient.element].id !== elements.dough.id && elements[ingredient.element].id !== elements.baked_batter.id) { + var rgb1 = batter.color.match(/\d+/g); + var rgb2 = ingredient.color.match(/\d+/g); + // average the colors + var rgb = [ + Math.round((parseInt(rgb1[0])+parseInt(rgb2[0]))/2), + Math.round((parseInt(rgb1[1])+parseInt(rgb2[1]))/2), + Math.round((parseInt(rgb1[2])+parseInt(rgb2[2]))/2) + ]; + changePixel(ingredient, "batter") + // convert rgb to hex + var hex = RGBToHex(rgb); + batter.color = pixelColorPick(batter, hex); + // 50% change to delete ingredient + if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); } + else { + ingredient.color = pixelColorPick(ingredient, hex); + } + } + }, + category: "legacy", + tempHigh: 94, + stateHigh: "baked_batter", + stateHighColorMultiplier: 0.9, + burn:40, + burnTime:25, + burnInto:"ash", + state: "liquid", + viscosity: 10000, + density: 1001, + hidden: true, + isFood: true +}; + elements.legacy_lattice = { color: "#cb4cd9", behavior: [ @@ -1300,7 +1406,7 @@ elements.legacy_lattice = { "CL|XX|CL", ], hidden: true, - category:"special", + category:"legacy", excludeRandom: true }; @@ -1352,6 +1458,37 @@ elements.left_lattice = { excludeRandom: true }; +elements.amethyst = { + color: ["#9868e0","#482888","#7848b8","#c898f0","#a878f0"], + behavior: behaviors.POWDER, + hidden: true, + category: "powders", +}; + +elements.quartz = { + color: ["#f6fff9","#f3f9f9","#f6fcf9","#fefefe","#fdfffe"], + behavior: behaviors.POWDER, + hidden: true, + category: "powders", + tempHigh: 1900, + stateHigh: "magma", + reactions: { + "molten_iron": { elem1: "amethyst", elem2: null }, + } +}; + +elements.slushy_ice = { + color: ["#f6fff9","#f3f9f9","#f6fcf9","#fefefe","#fdfffe"], + behavior: behaviors.WALL, + temp: -5, + tempHigh: 5, + stateHigh: "smashed_ice", + category: "states", + state: "solid", + density: 917, + breakInto: "smashed_ice", +}; + elements.toorhpaste = { color: ["#31ffe0","#65ffe8","#97ffef","#c9fff7","#f3fffd"], behavior: behaviors.LIQUID, @@ -1428,10 +1565,17 @@ elements.algae.breakInto = "seafoam" elements.battery.breakInto = "battery_acid" +elements.art.burn = 5 +elements.art.burnTime = 300 +elements.art.burnInto = ["ember","charcoal","fire"] + + elements.herb.breakInto = "seasoning" elements.chocolate.breakInto = "chocolate_sauce" +elements.magma.stateLow = ["basalt","basalt","basalt","basalt","basalt","basalt","basalt","rock","quartz"] + if (!elements.bless.reactions) elements.bless.reactions = {}; elements.bless.reactions.mold = { elem2: null } 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 new file mode 100644 index 00000000..0fc8d32b --- /dev/null +++ b/mods/singleColor.js @@ -0,0 +1 @@ +window.addEventListener('load', function() {for (var element in elements) {elements[element].singleColor = true;}}); diff --git a/mods/survival.js b/mods/survival.js new file mode 100644 index 00000000..b8970545 --- /dev/null +++ b/mods/survival.js @@ -0,0 +1,517 @@ +if (!settings.survival) { + settings.survival = { + "wall": 999, + "dirt": 999, + "sapling": 1, + "seeds": 5, + "ice": 25, + "cloner": 1, + } +} +settings.survival.cloner = 1; +settings.unhide = 0; +// settings.survivalClone=null; settings.survival = null; saveSettings(); + +survivalTimeout = null; +function survivalSave() { + if (survivalTimeout) { clearTimeout(survivalTimeout); } + survivalTimeout = setTimeout(function(){ + saveSettings(); + },1000); +} +function survivalAdd(element,amount,skipSave) { + if (elements[element].category === "tools") { return } + if (settings.survival[element]) { + settings.survival[element] += amount; + } + else { + settings.survival[element] = amount; + } + survivalUpdate(element); + if (!skipSave) {survivalSave()} +} +function survivalRemove(element,amount,skipSave) { + if (elements[element].category === "tools") { return } + if (settings.survival[element]) { + settings.survival[element] -= amount; + survivalUpdate(element); + } + if (settings.survival[element] <= 0) { + delete settings.survival[element]; + var btn = document.getElementById("elementButton-"+element); + if (btn) { btn.remove(); } + selectElement("unknown"); + } + if (!skipSave) {survivalSave()} +} +function survivalCount(element) { + return settings.survival[element] || 0; +} +function survivalUpdate(element) { + if (element === "gold_coin") { + // if it is not an integer, round it to 0.1 + if (settings.survival.gold_coin % 1 !== 0) { + settings.survival.gold_coin = Math.round(settings.survival.gold_coin*10)/10; + } + document.getElementById("coinCount").innerHTML = settings.survival.gold_coin||0; + } + var btn = document.getElementById("elementButton-"+element); + if (elements[element] && elements[element].category === "tools") { return } + if (btn) { + btn.innerHTML = btn.innerHTML.split("(")[0]+"("+settings.survival[element]+")"; + } + else if (elements[element]) { + createElementButton(element); + document.getElementById("elementButton-"+element).innerHTML += "("+settings.survival[element]+")"; + } +} + +runAfterAutogen(function(){ + elements.erase.name = "pick_up"; + delete elements.paint.category; + delete elements.lookup.category; + delete elements.pick; + delete elements.prop; + elements.radiation.category = "tools"; + for (var element in elements) { + if (elements[element].category !== "tools") { + elements[element].hidden = true; + elements[element].category = "inventory"; + } + } + for (var element in settings.survival) { + if (!elements[element]) { continue; } + if (elements[element].category === "tools") { continue; } + createElementButton(element); + document.getElementById("elementButton-"+element).innerHTML += "("+settings.survival[element]+")"; + } +}); + +delete elements.cloner.behavior; +elements.cloner.tick = function(pixel) { + if (settings.survivalClone) { + if (Math.random() < 0.025) { + // 1 or -1 + var x = pixel.x + (Math.random() < 0.5 ? 1 : -1); + var y = pixel.y + (Math.random() < 0.5 ? 1 : -1); + if (isEmpty(x,y)) { + createPixel(settings.survivalClone,x,y); + } + } + } + else { + for (var i = 0; i < adjacentCoords.length; i++) { + var coords = adjacentCoords[i]; + var x = pixel.x + coords[0]; + var y = pixel.y + coords[1]; + if (!isEmpty(x,y,true)) { + if (pixelMap[x][y].clone) { pixel.clone = pixelMap[x][y].clone; break } + var element = pixelMap[x][y].element; + if (element === pixel.element || elements[pixel.element].ignore.indexOf(element) !== -1) { continue } + settings.survivalClone = element; + survivalSave(); + break; + } + } + } +}; +elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molten_gold","sun","supernova","diamond"]); +elements.cloner.desc = "You can only clone one element at a time!" + +elements.smash.tool = function(pixel) { + if (elements[pixel.element].seed === true) { return } + if (elements[pixel.element].breakInto !== undefined || (elements[pixel.element].seed !== undefined && elements[pixel.element].seed !== true)) { + // times 0.25 if not shiftDown else 1 + if (Math.random() < (elements[pixel.element].hardness || 1) * (shiftDown ? 1 : 0.25)) { + var breakInto = elements[pixel.element].breakInto; + if (elements[pixel.element].seed && (!breakInto || Math.random() < 0.5)) { + if (Math.random() < 0.2) { + breakInto = elements[pixel.element].seed; + } + else { + breakInto = null; + } + } + // if breakInto is an array, pick one + if (Array.isArray(breakInto)) { + breakInto = breakInto[Math.floor(Math.random() * breakInto.length)]; + } + if (breakInto === null) { + deletePixel(pixel.x,pixel.y); + return; + } + var oldelement = pixel.element; + changePixel(pixel,breakInto); + pixelTempCheck(pixel); + if (elements[oldelement].breakIntoColor) { + pixel.color = pixelColorPick(pixel, elements[oldelement].breakIntoColor); + } + } + } +}; + +elementWorth = { + "gold_coin": 1, + "diamond": 100, + "ketchup": 15, + "jelly": 10, + "soda": 10, + "toast": 10, + "oil": 10, + "bread": 3, + "glass": 5, + "rad_glass": 6, + "glass_shard": 2, + "rad_shard": 3, + "paper": 5, + "broth": 5, + "honey": 5, + "caramel": 5, + "sap": 4, + "candy": 5, + "popcorn": 2, + "flour": 2, + "lettuce": 2, + "sauce": 2, + "wood": 0.2, + "tree_branch": 0.1, + "plant": 0.1, + "mushroom_cap": 0.1, + "mushroom_gill": 0.3, + "vine": 0.1, + "cactus": 0.1, + "cloner": 0, + "wall": 0, + "fire": 0, + "smoke": 0, + "plasma": 0, + "light": 0, + "laser": 0, + "liquid_light": 0.1, + "flash": 0, + "radiation": 0, + "petal": -1, + "cell": -1, + "cancer": -1, + "foam": -1, +} +elements.sell = { + color: ["#fff0b5","#ffe680","#c48821","#986a1a","#eca832","#f0bb62"], + tool: function(pixel) { + if (elementWorth[pixel.element] === 0) { return; } + deletePixel(pixel.x,pixel.y); + if (elementWorth[pixel.element] === -1) { return; } + survivalAdd("gold_coin",elementWorth[pixel.element]||1); + }, + category: "tools", + desc: "Exchanges pixels for their market value in Gold Coins" +} +elements.seeds.name = "seed"; + +/* +~Cloner +~Sell +Shop + Cloner Reset + ~Ammonia + ~Dirt + ~Water + ~Seeds + ~Sapling + ~Pinecone + ~Primordial Soup + ~Worm + ~Bee + ~Human + ~TNT + Seller (Runs Sell tool on pixels that touch it) + Buyer (Cloner but uses store price every time, prompt to select item on select) +Prices tab +*/ +survivalShop = { + "dirt*25": 25, + "water*25": 250, + "ammonia*25": 500, + "seeds*1": 500, + "sapling*1": 500, + "pinecone*1": 500, + "tnt*25": 1000, + "worm*1": 1000, + "bee*1": 5000, + "primordial_soup*5": 10000, + "human*1": 50000, + "sun*1": 500000, +} +function survivalBuy(element) { + var price = survivalShop[element]; + if (!price) { alert("The shop isn't selling "+element+"!"); return } + if (!settings.survival.gold_coin || settings.survival.gold_coin < price) { alert("You can't afford that!"); return } + survivalRemove("gold_coin",price); + var amount = 1; + if (element.indexOf("*") !== -1) { amount = parseInt(element.split("*")[1]); element = element.split("*")[0]; } + survivalAdd(element,amount); + selectElement(element); +} +function survivalResetCloner() { + if (!settings.survival.gold_coin || settings.survival.gold_coin < 1000) { alert("You can't afford that!"); return } + survivalRemove("gold_coin",1000); + settings.survivalClone = null; + survivalSave(); +} + +worldgentypes = {} +window.addEventListener("load",function(){ + // move to start of tools + var erase = document.getElementById("elementButton-erase"); + var sell = document.getElementById("elementButton-sell"); + var parent = erase.parentElement; + parent.removeChild(sell); + parent.insertBefore(sell,parent.firstChild); + parent.removeChild(erase); + parent.insertBefore(erase,parent.firstChild); + document.getElementById("replaceButton").remove(); + document.getElementById("savesButton").remove(); + document.getElementById("elemSelectButton").remove(); + doRandomEvents = function() {} + worldGen = function() {} + worldgentypes = {} + loadSave = function() {} + showSaves = function() {} + placeImage = function() {} + chooseElementPrompt = function() {} + document.getElementById("toolControls").insertAdjacentHTML("beforeend",``); + createCategoryDiv("shop"); + var shopDiv = document.getElementById("category-shop"); + shopDiv.style.display = "none"; + shopDiv.insertAdjacentHTML("beforeend",`

You have $${settings.survival.gold_coin||0}

`); + for (var element in survivalShop) { + var price = survivalShop[element]; + var button = document.createElement("button"); + var name = element; + var amount = 1; + if (element.indexOf("*") !== -1) { amount = parseInt(element.split("*")[1]); name = element.split("*")[0]; } + var elemname = name; + name = (elements[elemname].name||name).replace(/_/g, " ").replace("."," ").replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}).replace(" ",".").replace(/ /g, ""); + button.classList.add("elementButton"); + button.setAttribute("element",element); + button.setAttribute("category","shop"); + button.setAttribute("title",amount+" "+name+" for $"+price); + button.innerHTML = name+" ("+amount+" for $"+price+")"; + if (elements[elemname]) { + if (elements[elemname].color instanceof Array) { + button.style.backgroundImage = "linear-gradient(to bottom right, "+elements[elemname].color.join(", ")+")"; + // choose the middlemost item in array + var colorObject = elements[elemname].colorObject[Math.floor(elements[elemname].colorObject.length/2)]; + if (elements[elemname].darkText !== false && (elements[elemname].darkText || (colorObject.r+colorObject.g+colorObject.b)/3 > 200)) { + button.className += " bright" + } + } + else { + button.style.background = elements[elemname].color; + var colorObject = elements[elemname].colorObject; + if (elements[elemname].darkText !== false && (elements[elemname].darkText || (colorObject.r+colorObject.g+colorObject.b)/3 > 200)) { + button.className += " bright" + } + } + } + button.addEventListener("click",function(){ + survivalBuy(this.getAttribute("element")); + }); + shopDiv.appendChild(button); + } + shopDiv.insertAdjacentHTML("beforeend",`

`); + + createCategoryDiv("prices"); + var pricesDiv = document.getElementById("category-prices"); + pricesDiv.style.display = "none"; + for (var element in elementWorth) { + if (elementWorth[element] <= 0) { continue } + var name = (elements[element].name||element).replace(/_/g, " ").replace("."," ").replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}).replace(" ","."); + // create text with the name of the element and its worth, separated by • + var text = name+"="+elementWorth[element] + " • "; + pricesDiv.insertAdjacentHTML("beforeend",`${text}`); + } + pricesDiv.innerHTML = pricesDiv.innerHTML.slice(0,-2); + pricesDiv.innerHTML = "

"+pricesDiv.innerHTML+"

"; +}); +runAfterLoad(function(){ + checkUnlock = function(element) { + return; + } + oldClearAll = clearAll; + clearAll = function() { + if (currentPixels && currentPixels.length > 0) { + for (var i = 0; i < currentPixels.length; i++) { + var pixel = currentPixels[i]; + if (pixel && pixel.element) { + survivalAdd(pixel.element,1); + } + } + } + oldClearAll(); + } + mouseAction = function(e,mouseX,mouseY,startPos) { + if (mouseType == "left") { + mouse1Action(e,mouseX,mouseY,startPos); + } + else if (mouseType == "right") { mouse2Action(e,mouseX,mouseY,startPos); } + else if (mouseType == "middle") { mouseMiddleAction(e,mouseX,mouseY); } + } + mouse1Action = function(e,mouseX=undefined,mouseY=undefined,startPos) { + if (currentElement === "erase") { mouse2Action(e,mouseX,mouseY); return; } + else if (currentElement === "pick") { mouseMiddleAction(e,mouseX,mouseY); return; } + // If x and y are undefined, get the mouse position + if (mouseX == undefined && mouseY == undefined) { + // var canvas = document.getElementById("game"); + // var ctx = canvas.getContext("2d"); + lastPos = mousePos; + mousePos = getMousePos(canvas, e); + var mouseX = mousePos.x; + var mouseY = mousePos.y; + } + var cooldowned = false; + if ((mouseSize===1 || elements[currentElement].maxSize===1) && elements[currentElement].cooldown) { + if (pixelTicks-lastPlace < elements[currentElement].cooldown) { + return; + } + cooldowned = true; + } + lastPlace = pixelTicks; + startPos = startPos || lastPos + if (!(isMobile || (cooldowned && startPos.x===lastPos.x && startPos.y===lastPos.y) || elements[currentElement].tool || elements[currentElement].category==="tools")) { + var coords = lineCoords(startPos.x,startPos.y,mouseX,mouseY); + } + else { var coords = mouseRange(mouseX,mouseY); } + var element = elements[currentElement]; + var mixList = []; + // For each x,y in coords + for (var i = 0; i < coords.length; i++) { + var x = coords[i][0]; + var y = coords[i][1]; + + if (currentElement === "mix") { + if (!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + if (!(elements[pixel.element].movable !== true || elements[pixel.element].noMix === true) || shiftDown) { + mixList.push(pixel); + } + } + } + else if (currentElement === "shock") { + if (!isEmpty(x,y,true)) { + // One loop that repeats 5 times if shiftDown else 1 time + for (var j = 0; j < (shiftDown ? 5 : 1); j++) { + var pixel = pixelMap[x][y]; + var con = elements[pixel.element].conduct; + if (con == undefined) {continue} + if (Math.random() < con) { // If random number is less than conductivity + if (!pixel.charge && !pixel.chargeCD) { + pixel.charge = 1; + if (elements[pixel.element].colorOn) { + pixel.color = pixelColorPick(pixel); + } + } + } + else if (elements[pixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation) + pixel.temp += 0.25; + pixelTempCheck(pixel); + } + } + } + } + else if (elements[currentElement].tool && !(elements[currentElement].canPlace && isEmpty(x,y))) { + // run the tool function on the pixel + if (!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + // if the current element has an ignore property and the pixel's element is in the ignore property, don't do anything + if (elements[currentElement].ignore && elements[currentElement].ignore.indexOf(pixel.element) != -1) { + continue; + } + elements[currentElement].tool(pixel); + } + } + else if (isEmpty(x, y)) { + if (survivalCount(currentElement) < 1 && elements[currentElement].category !== "tools") { + return; + } + currentPixels.push(new Pixel(x, y, currentElement)); + if (elements[currentElement].customColor || elements[currentElement].singleColor) { + pixelMap[x][y].color = pixelColorPick(currentElement,currentColor); + } + if (elements[currentElement].category !== "tools") { survivalRemove(currentElement,1); } + } + } + if (currentElement == "mix") { + for (var i = 0; i < mixList.length; i++) { + var pixel1 = mixList[Math.floor(Math.random()*mixList.length)]; + var pixel2 = mixList[Math.floor(Math.random()*mixList.length)]; + swapPixels(pixel1,pixel2); + mixList.splice(mixList.indexOf(pixel1),1); + mixList.splice(mixList.indexOf(pixel2),1); + if (elements[pixel1.element].onMix) { + elements[pixel1.element].onMix(pixel1,pixel2); + } + if (elements[pixel2.element].onMix) { + elements[pixel2.element].onMix(pixel2,pixel1); + } + } + + } + } + mouse2Action = function(e,mouseX=undefined,mouseY=undefined,startPos) { + // Erase pixel at mouse position + if (mouseX == undefined && mouseY == undefined) { + // var canvas = document.getElementById("game"); + // var ctx = canvas.getContext("2d"); + lastPos = mousePos; + mousePos = getMousePos(canvas, e); + var mouseX = mousePos.x; + var mouseY = mousePos.y; + } + if (dragStart) { + dragStart = 0; + for (var i = 0; i < draggingPixels.length; i++) { + var pixel = draggingPixels[i]; + delete pixel.drag; + } + draggingPixels = null; + } + // If the current element is "pick" or "lookup", coords = [mouseX,mouseY] + if (currentElement == "pick" || currentElement == "lookup") { + var coords = [[mouseX,mouseY]]; + } + else if (!isMobile) { + startPos = startPos || lastPos + var coords = lineCoords(startPos.x,startPos.y,mouseX,mouseY); + } + else { + var coords = mouseRange(mouseX,mouseY); + } + // For each x,y in coords + for (var i = 0; i < coords.length; i++) { + var x = coords[i][0]; + var y = coords[i][1]; + + if (!isEmpty(x, y)) { + if (outOfBounds(x,y)) { + continue + } + var pixel = pixelMap[x][y]; + survivalAdd(pixel.element,1); + delete pixelMap[x][y]; + // Remove pixel from currentPixels + for (var j = 0; j < currentPixels.length; j++) { + if (currentPixels[j].x == x && currentPixels[j].y == y) { + currentPixels.splice(j, 1); + break; + } + } + } + } + } +}) + +window.addEventListener("beforeunload",function(){ + clearAll(); + saveSettings(); +}); \ No newline at end of file diff --git a/mods/weapons.js b/mods/weapons.js index 04ed8a20..deeae4e4 100644 --- a/mods/weapons.js +++ b/mods/weapons.js @@ -96,4 +96,67 @@ elements.right_missile = { category: "weapons", state: "solid", density: 1300, +}, + elements.RL_cluster_munition = { + color: "#444444", + behavior: [ + "XX|XX|XX", + "CRcluster%20|XX|CR:cluster%20", + "M2|M1|M2", + ], + category: "weapons", + state: "solid", + density: 1300, +}, + elements.cluster = { + color: "#444444", + behavior: [ + "XX|EX:10%10|XX", + "XX|XX|XX", + "M2|M1 AND EX:10%10|M2", + ], + category: "weapons", + state: "solid", + density: 1300, + hidden: true, +}, + elements.machine_gun_left = { + color: "#C0C0C0", + behavior: [ + "XX|XX|XX", + "CR:left_bullet|XX|XX", + "XX|XX|XX", + ], + category: "weapons", + state: "solid", + density: 1300, +}, + elements.machine_gun_right = { + color: "#C0C0C0", + behavior: [ + "XX|XX|XX", + "XX|XX|CR:right_bullet", + "XX|XX|XX", + ], + category: "weapons", + state: "solid", + density: 1300, +}, +elements.left_bullet = { + color: "#4c4e42", + behavior: [ + "M2|XX|XX", + "M1 AND EX:5|XX|XX", + "M2|XX|XX", + ], + category:"weapons", +}, + elements.right_bullet = { + color: "#4c4e42", + behavior: [ + "XX|XX|M2", + "XX|XX|M1 AND EX:5", + "XX|XX|M2", + ], + category:"weapons", }; \ No newline at end of file