commit
0cd465e63f
|
|
@ -196,7 +196,7 @@
|
||||||
<tr><td>texturepack.js</td><td>Tools that let you create and share custom texture packs</td><td>nousernamefound</td></tr>
|
<tr><td>texturepack.js</td><td>Tools that let you create and share custom texture packs</td><td>nousernamefound</td></tr>
|
||||||
<tr><td>the_ground.js</td><td>Several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr>
|
<tr><td>the_ground.js</td><td>Several rock types, worldgen settings, and gemstones</td><td>Alice</td></tr>
|
||||||
<tr><td>worldEdit.js</td><td>Selection and editing tools</td><td>RedBirdly</td></tr>
|
<tr><td>worldEdit.js</td><td>Selection and editing tools</td><td>RedBirdly</td></tr>
|
||||||
<tr><td>worldgenlibrary.js</td><td>World generation library</td><td>Adora</td></tr>
|
<tr><td>worldgenlibrary.js</td><td>World generation library</td><td>Orchid</td></tr>
|
||||||
|
|
||||||
<!----><tr><td class="modCat" colspan="3">Science & Chemistry</td></tr><!---->
|
<!----><tr><td class="modCat" colspan="3">Science & Chemistry</td></tr><!---->
|
||||||
<tr><td>alcohol.js</td><td>Methanol, (iso-)propanol, and butanol</td><td>Alice</td></tr>
|
<tr><td>alcohol.js</td><td>Methanol, (iso-)propanol, and butanol</td><td>Alice</td></tr>
|
||||||
|
|
@ -234,7 +234,7 @@
|
||||||
<tr><td>metals.js</td><td>Several metals</td><td>Alice</td></tr>
|
<tr><td>metals.js</td><td>Several metals</td><td>Alice</td></tr>
|
||||||
<tr><td>mixture.js</td><td>Many chemicals can be mixed</td><td>lllllllllwith10ls</td></tr>
|
<tr><td>mixture.js</td><td>Many chemicals can be mixed</td><td>lllllllllwith10ls</td></tr>
|
||||||
<tr><td>more_gold.js</td><td>Green Gold</td><td>pixelegend4</td></tr>
|
<tr><td>more_gold.js</td><td>Green Gold</td><td>pixelegend4</td></tr>
|
||||||
<tr><td>morechemistry.js</td><td>New chemicals, compounds, and machines</td><td>Adora</td></tr>
|
<tr><td>morechemistry.js</td><td>New chemicals, compounds, and machines</td><td>Orchid</td></tr>
|
||||||
<tr><td>moreliquids.js</td><td>Various liquids</td><td>te-agma-at</td></tr>
|
<tr><td>moreliquids.js</td><td>Various liquids</td><td>te-agma-at</td></tr>
|
||||||
<tr><td>neutronium_compressor.js</td><td>Compressor from Minecraft's Avaritia mod that compresses 10,000 pixels of an element into a singularity</td><td>Alice</td></tr>
|
<tr><td>neutronium_compressor.js</td><td>Compressor from Minecraft's Avaritia mod that compresses 10,000 pixels of an element into a singularity</td><td>Alice</td></tr>
|
||||||
<tr><td>noblegas.js</td><td>The missing noble gases</td><td>nousernamefound</td></tr>
|
<tr><td>noblegas.js</td><td>The missing noble gases</td><td>nousernamefound</td></tr>
|
||||||
|
|
@ -253,6 +253,7 @@
|
||||||
<tr><td>colored_lightbulbs.js</td><td>Light bulb that can be painted</td><td>guzzo86, ggod</td></tr>
|
<tr><td>colored_lightbulbs.js</td><td>Light bulb that can be painted</td><td>guzzo86, ggod</td></tr>
|
||||||
<tr><td>combustion.js</td><td>Components necessary for combustion engines</td><td>uptzik</td></tr>
|
<tr><td>combustion.js</td><td>Components necessary for combustion engines</td><td>uptzik</td></tr>
|
||||||
<tr><td>conveyance.js</td><td>Conveyors, operated with and without electricity</td><td>Melecie</td></tr>
|
<tr><td>conveyance.js</td><td>Conveyors, operated with and without electricity</td><td>Melecie</td></tr>
|
||||||
|
<tr><td>datawire.js</td><td>Adds a wire that transfers data and other operators and machines for it</td><td>Orchid</td></tr>
|
||||||
<tr><td>drill.js</td><td>Drills made out of several materials</td><td>Suss</td></tr>
|
<tr><td>drill.js</td><td>Drills made out of several materials</td><td>Suss</td></tr>
|
||||||
<tr><td>ExtraMachines.js</td><td>Sensors, energy resources, materials, and more</td><td>Mecoolnotcool</td></tr>
|
<tr><td>ExtraMachines.js</td><td>Sensors, energy resources, materials, and more</td><td>Mecoolnotcool</td></tr>
|
||||||
<tr><td>fans.js</td><td>Fans</td><td>Cube14yt</td></tr>
|
<tr><td>fans.js</td><td>Fans</td><td>Cube14yt</td></tr>
|
||||||
|
|
@ -350,7 +351,7 @@
|
||||||
<tr><td>ocean.js</td><td>Marine life</td><td>SquareScreamYT</td></tr>
|
<tr><td>ocean.js</td><td>Marine life</td><td>SquareScreamYT</td></tr>
|
||||||
<tr><td>ores.js</td><td>Ore generation along with tools to mine them</td><td>nousernamefound</td></tr>
|
<tr><td>ores.js</td><td>Ore generation along with tools to mine them</td><td>nousernamefound</td></tr>
|
||||||
<tr><td>petal_dye.js</td><td>Boil petals to make dye</td><td>Suss</td></tr>
|
<tr><td>petal_dye.js</td><td>Boil petals to make dye</td><td>Suss</td></tr>
|
||||||
<tr><td>plants.js</td><td>Wide variety of new plants and fruits</td><td>Adora</td></tr>
|
<tr><td>plants.js</td><td>Wide variety of new plants and fruits</td><td>Orchid</td></tr>
|
||||||
<tr><td>primordial_birthpool.js</td><td>Cross between Primordial Soup and Birthpool. Requires fey_and_more.js</td><td>Alice</td></tr>
|
<tr><td>primordial_birthpool.js</td><td>Cross between Primordial Soup and Birthpool. Requires fey_and_more.js</td><td>Alice</td></tr>
|
||||||
<tr><td>spring.js</td><td>Many nature elements, like sakura trees, butterflies, beehives, and more</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
|
<tr><td>spring.js</td><td>Many nature elements, like sakura trees, butterflies, beehives, and more</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
|
||||||
<tr><td>the_ground_og.js</td><td>Simplified and more stable version of the_ground.js</td><td>Alice</td></tr>
|
<tr><td>the_ground_og.js</td><td>Simplified and more stable version of the_ground.js</td><td>Alice</td></tr>
|
||||||
|
|
@ -361,7 +362,7 @@
|
||||||
<!----><tr><td class="modCat" colspan="3">Fun & Games</td></tr><!---->
|
<!----><tr><td class="modCat" colspan="3">Fun & Games</td></tr><!---->
|
||||||
<tr><td>10kelements.js</td><td>Customizable amount of randomly generated elements</td><td>nousernamefound</td></tr>
|
<tr><td>10kelements.js</td><td>Customizable amount of randomly generated elements</td><td>nousernamefound</td></tr>
|
||||||
<tr><td>all_around_fillers.js</td><td>Directional Filler variants</td><td>idk73248</td></tr>
|
<tr><td>all_around_fillers.js</td><td>Directional Filler variants</td><td>idk73248</td></tr>
|
||||||
<tr><td>allliquids.js</td><td>Made all elements liquids</td><td>Adora</td></tr>
|
<tr><td>allliquids.js</td><td>Made all elements liquids</td><td>Orchid</td></tr>
|
||||||
<tr><td>amogus.js</td><td>Small Among Us structure</td><td>Alice</td></tr>
|
<tr><td>amogus.js</td><td>Small Among Us structure</td><td>Alice</td></tr>
|
||||||
<tr><td>bfdi.js</td><td>Several references to Battle for Dream Island</td><td>Taterbob</td></tr>
|
<tr><td>bfdi.js</td><td>Several references to Battle for Dream Island</td><td>Taterbob</td></tr>
|
||||||
<tr><td>citybuilding.js</td><td>Seeds that create miniature buildings and other city-related items</td><td>SquareScreamYT</td></tr>
|
<tr><td>citybuilding.js</td><td>Seeds that create miniature buildings and other city-related items</td><td>SquareScreamYT</td></tr>
|
||||||
|
|
@ -440,7 +441,7 @@
|
||||||
<tr><td>changeTempReactionParameter.js</td><td>The changeTemp property to modded reactions</td><td>Alice</td></tr>
|
<tr><td>changeTempReactionParameter.js</td><td>The changeTemp property to modded reactions</td><td>Alice</td></tr>
|
||||||
<tr><td>code_library.js</td><td>Functions and variables common to some other mods</td><td>Alice</td></tr>
|
<tr><td>code_library.js</td><td>Functions and variables common to some other mods</td><td>Alice</td></tr>
|
||||||
<tr><td>controllable_pixel_test.js</td><td>Pixel that can be controlled with the keyboard keys <a href="https://github.com/R74nCom/sandboxels/commit/58dfa9477f2ed7ec9c44b00a35162e7c63bc129c">[More Info]</a> [PC ONLY]</td><td>Alice</td></tr>
|
<tr><td>controllable_pixel_test.js</td><td>Pixel that can be controlled with the keyboard keys <a href="https://github.com/R74nCom/sandboxels/commit/58dfa9477f2ed7ec9c44b00a35162e7c63bc129c">[More Info]</a> [PC ONLY]</td><td>Alice</td></tr>
|
||||||
<tr><td>customexplosion.js</td><td>Added a custom explosion element and interface for it. check out its <a href="https://sandboxels-mods.the-enchanteden.repl.co/Mods/customexplosion.js">source code</a> for how modders can use it</td><td>Alex</td></tr>
|
<tr><td>customexplosion.js</td><td>Added a custom explosion element and interface for it.</td><td>Orchid</td></tr>
|
||||||
<tr><td>date_test.js</td><td>K-pop idol birthday testing stuff</td><td>Alice</td></tr>
|
<tr><td>date_test.js</td><td>K-pop idol birthday testing stuff</td><td>Alice</td></tr>
|
||||||
<tr><td>drawPixels_change_test.js</td><td>Test of altering drawPixels(). Gives burning pixels a red overlay similar to the yellow overlay for charged pixels</td><td>Alice</td></tr>
|
<tr><td>drawPixels_change_test.js</td><td>Test of altering drawPixels(). Gives burning pixels a red overlay similar to the yellow overlay for charged pixels</td><td>Alice</td></tr>
|
||||||
<tr><td>example_mod.js</td><td>Example mod for new modders</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
|
<tr><td>example_mod.js</td><td>Example mod for new modders</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
|
||||||
|
|
@ -455,6 +456,7 @@
|
||||||
<tr><td>modlangs.js</td><td>Customisable property in an element to allow for translations in mods. See the file for instructions on how to implement</td><td>SquareScreamYT</td></tr>
|
<tr><td>modlangs.js</td><td>Customisable property in an element to allow for translations in mods. See the file for instructions on how to implement</td><td>SquareScreamYT</td></tr>
|
||||||
<tr><td>nested_for_reaction_example.js</td><td>Example of using a nested for loop to add reactions. It makes various things kill plants</td><td>Alice</td></tr>
|
<tr><td>nested_for_reaction_example.js</td><td>Example of using a nested for loop to add reactions. It makes various things kill plants</td><td>Alice</td></tr>
|
||||||
<tr><td>nv7.js</td><td>Giant Nv7 image [Large]</td><td>Nv7</td></tr>
|
<tr><td>nv7.js</td><td>Giant Nv7 image [Large]</td><td>Nv7</td></tr>
|
||||||
|
<tr><td>orchidslibrary.js</td><td>Library used by morechemistry.js, plants.js, and datawire.js</td><td>Orchid</td></tr>
|
||||||
<tr><td>place_all_elements.js</td><td>Experimental function that places every pixel</td><td>Alice</td></tr>
|
<tr><td>place_all_elements.js</td><td>Experimental function that places every pixel</td><td>Alice</td></tr>
|
||||||
<tr><td>randomness_but_tick.js</td><td>Random experimental elements using the tick function feature</td><td>Alice</td></tr>
|
<tr><td>randomness_but_tick.js</td><td>Random experimental elements using the tick function feature</td><td>Alice</td></tr>
|
||||||
<tr><td>randomness_but_tool.js</td><td>Random experimental elements using the tool function feature</td><td>Alice</td></tr>
|
<tr><td>randomness_but_tool.js</td><td>Random experimental elements using the tool function feature</td><td>Alice</td></tr>
|
||||||
|
|
@ -464,7 +466,7 @@
|
||||||
<tr><td>structure_test.js</td><td>Test for implementing structures into Sandboxels</td><td>Alice</td></tr>
|
<tr><td>structure_test.js</td><td>Test for implementing structures into Sandboxels</td><td>Alice</td></tr>
|
||||||
<tr><td>test.js</td><td>Test that adds mayo :)</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
|
<tr><td>test.js</td><td>Test that adds mayo :)</td><td><a href="https://R74n.com" class="R74nLink">R74n</a></td></tr>
|
||||||
<tr><td>tool_pixel_behavior.js</td><td>Gives unique behaviors to tools if placed with cheats</td><td>Alice</td></tr>
|
<tr><td>tool_pixel_behavior.js</td><td>Gives unique behaviors to tools if placed with cheats</td><td>Alice</td></tr>
|
||||||
<tr><td>worldgenlibrary.js</td><td>World generation library</td><td>Adora</td></tr>
|
<tr><td>worldgenlibrary.js</td><td>World generation library</td><td>Orchid</td></tr>
|
||||||
<tr><td>worldgen_test.js</td><td>Element that generates a save with a grass layer, dirt layer, rock layer, and a pond</td><td>Alice</td></tr>
|
<tr><td>worldgen_test.js</td><td>Element that generates a save with a grass layer, dirt layer, rock layer, and a pond</td><td>Alice</td></tr>
|
||||||
|
|
||||||
<!----><tr><td class="modCat" colspan="3">Broken or Deprecated</td></tr><!---->
|
<!----><tr><td class="modCat" colspan="3">Broken or Deprecated</td></tr><!---->
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,244 @@
|
||||||
|
/*
|
||||||
|
Version 1.0.0
|
||||||
|
*/
|
||||||
|
if(!enabledMods.includes("/mods/orchidslibrary.js")){
|
||||||
|
let continueWithout = confirm("Missing dependency for datawire.js: \"orchidslibrary.js\". Continue without? (cancel will add mod and refresh the page)");
|
||||||
|
if(!continueWithout){
|
||||||
|
addMod("/mods/orchidslibrary.js", true);
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
elements.data_wire = {
|
||||||
|
desc: "Transfers data.",
|
||||||
|
color: ["#6b1502", "#631402", "#6e1400", "#631200"],
|
||||||
|
properties: {cd: 0, value: null},
|
||||||
|
tick: function(pixel){
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null){
|
||||||
|
if(p2.value != null && pixel.cd == 0){
|
||||||
|
pixel.value = p2.value;
|
||||||
|
pixel.cd = 15;
|
||||||
|
};
|
||||||
|
pixel.value = (pixel.cd == 3) ? null : pixel.value;
|
||||||
|
if(elements[p2.element].dataInFunc != undefined && pixel.value != null){
|
||||||
|
elements[p2.element].dataInFunc(p2, pixel.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pixel.cd -= (pixel.cd == 0) ? 0 : 1;
|
||||||
|
},
|
||||||
|
category: "data",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
state: "solid",
|
||||||
|
};
|
||||||
|
elements.data_input = {
|
||||||
|
desc: "Holds a data value that can be outputted to any nearby data wire.",
|
||||||
|
color: ["#e06500", "#f57105", "#f06f05", "#e66c09"],
|
||||||
|
value: null,
|
||||||
|
onSelect: function(){
|
||||||
|
promptInput("Enter data info", (input)=>{elements.data_input.value = input;}, "Data Input", elements.data_input.value);
|
||||||
|
},
|
||||||
|
category: "data",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
state: "solid",
|
||||||
|
properties: {
|
||||||
|
value:null,
|
||||||
|
},
|
||||||
|
tick: function(pixel){
|
||||||
|
if(pixel.value == null){
|
||||||
|
pixel.value = elements.data_input.value;
|
||||||
|
}
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null && elements[p2.element].dataInFunc != undefined && pixel.value != null){
|
||||||
|
elements[p2.element].dataInFunc(p2, pixel.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.toggle_data_input = {
|
||||||
|
desc: "Holds a data value that can be outputted to any nearby data wire when toggled on.",
|
||||||
|
color: ["#6e3302", "#783905", "#823c03", "#7d3a02"],
|
||||||
|
value: null,
|
||||||
|
onSelect: function(){
|
||||||
|
promptInput("Enter data info", (input)=>{elements.data_input.value = input;}, "Data Input", elements.data_input.value);
|
||||||
|
},
|
||||||
|
category: "data",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
state: "solid",
|
||||||
|
properties: {
|
||||||
|
value:null,
|
||||||
|
val: null,
|
||||||
|
toggle: false,
|
||||||
|
clickCd: 0,
|
||||||
|
},
|
||||||
|
tick: function(pixel){
|
||||||
|
if(pixel.val == null){
|
||||||
|
pixel.val = elements.data_input.value;
|
||||||
|
}
|
||||||
|
pixel.value = (pixel.toggle) ? pixel.val : null;
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null && elements[p2.element].dataInFunc != undefined && pixel.value != null){
|
||||||
|
elements[p2.element].dataInFunc(p2, pixel.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pixel.clickCd -= (pixel.clickCd == 0) ? 0 : 1;
|
||||||
|
},
|
||||||
|
onClicked: function(pixel){
|
||||||
|
if(pixel.clickCd == 0){
|
||||||
|
pixel.clickCd = 20;
|
||||||
|
pixel.toggle = !pixel.toggle;
|
||||||
|
if(pixel.toggle){
|
||||||
|
pixel.color = noiseify("#edba00", 8);
|
||||||
|
} else {
|
||||||
|
pixel.color = noiseify("#6e3302", 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.join = {
|
||||||
|
desc: "Combines multiple data inputs. Click to reset value.",
|
||||||
|
color: ["#046e00", "#067a02", "#097006", "#065904", "#056602"],
|
||||||
|
properties: {val: null, clickCd: 0},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
if(pixel.val != null && !pixel.val.includes(value)){
|
||||||
|
pixel.val += value;
|
||||||
|
}
|
||||||
|
if(pixel.val == null){
|
||||||
|
pixel.val = value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
category: "data",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
state: "solid",
|
||||||
|
tick: function(pixel){
|
||||||
|
let p2 = getPixel(pixel.x+1, pixel.y);
|
||||||
|
if(p2 != null && p2.element == "data_wire"){
|
||||||
|
p2.value = pixel.val;
|
||||||
|
}
|
||||||
|
pixel.clickCd -= (pixel.clickCd == 0) ? 0 : 1;
|
||||||
|
},
|
||||||
|
onClicked: function(pixel){
|
||||||
|
if(pixel.clickCd == 0){
|
||||||
|
pixel.clickCd = 20;
|
||||||
|
pixel.val = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.data_sensor = {
|
||||||
|
desc: "Scans adjacent pixels for a target property and outputs them, uses \"element\" by default. Click on pixel to change properties.",
|
||||||
|
color: ["#3d3c28", "#4d4b32", "#4a482f", "#403e28"],
|
||||||
|
properties: {
|
||||||
|
value: null,
|
||||||
|
property: "element",
|
||||||
|
clickCd: 0,
|
||||||
|
},
|
||||||
|
tick: function(pixel){
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null && !["data_wire"].includes(p2.element)){
|
||||||
|
pixel.value = p2[pixel.property];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
pixel.clickCd -= (pixel.clickCd == 0) ? 0 : 1;
|
||||||
|
},
|
||||||
|
onClicked: function(pixel){
|
||||||
|
let propertyArr = [];
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null){
|
||||||
|
for(let property in p2){
|
||||||
|
if(typeof p2[property] != "function" && !propertyArr.includes(property)){
|
||||||
|
propertyArr.push(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
promptChoose("Choose property this data sensor detects:", propertyArr, (input)=>{pixel.property = input || pixel.property;}, "Property to Detect");
|
||||||
|
},
|
||||||
|
category: "data",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
state: "solid",
|
||||||
|
}
|
||||||
|
elements.if = {
|
||||||
|
desc: "Takes 3 inputs, conditon (1 (true) or 0 (false), x-1), ifTrue (output if true, y-1 (pixel above)), and ifFalse (output if false, y+1 (pixel below)).",
|
||||||
|
color: ["#00574b", "#005247", "#02594e", "#025c50"],
|
||||||
|
category: "data",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
state: "solid",
|
||||||
|
tick: function(pixel){
|
||||||
|
let conditionPixel = getPixel(pixel.x-1, pixel.y), truePixel = getPixel(pixel.x, pixel.y-1), falsePixel = getPixel(pixel.x, pixel.y+1);
|
||||||
|
let condition = (conditionPixel != null &&conditionPixel.value != undefined) ? parseInt(conditionPixel.value) : false;
|
||||||
|
let trueOut = (truePixel != null && truePixel.value != undefined) ? truePixel.value : 1;
|
||||||
|
let falseOut = (falsePixel != null && falsePixel.value != undefined) ? falsePixel.value : 0;
|
||||||
|
let outPixel = getPixel(pixel.x+1, pixel.y);
|
||||||
|
if(outPixel != null && outPixel.value !== undefined){
|
||||||
|
outPixel.value = (condition) ? trueOut : falseOut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.equals = {
|
||||||
|
desc: "Takes 2 inputs, A (y-1 (pixel above)) and B (y+1 (pixel below), returns 1 if they are equal and 0 if they are not.",
|
||||||
|
color: ["#12ccb3", "#15ebce", "#0bd6bb", "#14dec3"],
|
||||||
|
category: "data",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
state: "solid",
|
||||||
|
tick: function(pixel){
|
||||||
|
let a = getPixel(pixel.x, pixel.y-1), b = getPixel(pixel.x, pixel.y+1);
|
||||||
|
if(a != null && b != null){
|
||||||
|
let aVal = (a.value != undefined) ? a.value : 1;
|
||||||
|
let bVal = (b.value != undefined) ? b.value : 0;
|
||||||
|
let outPixel = getPixel(pixel.x+1, pixel.y);
|
||||||
|
if(outPixel != null && outPixel.value !== undefined){
|
||||||
|
outPixel.value = (aVal == bVal) ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.prop_setter = {
|
||||||
|
category: "data",
|
||||||
|
properties: {
|
||||||
|
val: null,
|
||||||
|
},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
pixel.val = value;
|
||||||
|
},
|
||||||
|
color: ["#deb150", "#ebba52", "#ebba52", "#e3b44d", "#dbab44"],
|
||||||
|
state: "solid",
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
tick: function(pixel){
|
||||||
|
if(pixel.val != null){
|
||||||
|
let valArr = pixel.val.split(":");
|
||||||
|
let prop = valArr[0], value = valArr[1];
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null && p2[prop] != undefined && elements[p2.element].category != "data"){
|
||||||
|
if(prop == "element"){
|
||||||
|
changePixel(p2, value);
|
||||||
|
} else if (prop == "x" || prop == "y"){
|
||||||
|
let x = (prop == "x") ? value : p2.x, y = (prop == "y") ? value : p2.y;
|
||||||
|
tryMove(p2, parseInt(x), parseInt(y), null, true);
|
||||||
|
} else {
|
||||||
|
if(typeof p2[prop] == "number"){
|
||||||
|
p2[prop] = parseInt(value);
|
||||||
|
} else if(typeof p2[prop] == "boolean"){
|
||||||
|
p2[prop] = value.includes("true");
|
||||||
|
} else if(typeof p2[prop] == "string"){
|
||||||
|
p2[prop] = value;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,35 +1,14 @@
|
||||||
/*
|
/*
|
||||||
Version 2.1.0
|
Version 2.2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function pixelToggle(pixel, multi = {r:1,g:1,b:1}){
|
if(!enabledMods.includes("/mods/orchidslibrary.js")){
|
||||||
if(pixel.toggle != undefined){
|
let continueWithout = confirm("Missing dependency for morechemistry.js: \"orchidslibrary.js\". Continue without? (cancel will add mod and refresh the page)");
|
||||||
pixel.toggle = !pixel.toggle;
|
if(!continueWithout){
|
||||||
let rgb;
|
addMod("/mods/orchidslibrary.js", true);
|
||||||
if(Array.isArray(elements[pixel.element].color)){
|
window.location.reload();
|
||||||
let elemColor = elements[pixel.element].color[Math.round(Math.random()*elements[pixel.element].color.length)];
|
}
|
||||||
rgb = hexToRGB(elemColor) || getRGB(elemColor);
|
|
||||||
} else {
|
} else {
|
||||||
let elemColor = elements[pixel.element].color;
|
|
||||||
rgb = hexToRGB(elemColor) || getRGB(elemColor);
|
|
||||||
}
|
|
||||||
let num = 5 - Math.round(Math.random()*10);
|
|
||||||
if(pixel.toggle){
|
|
||||||
for(let key in rgb){
|
|
||||||
rgb[key] += (100*multi[key]);
|
|
||||||
rgb[key] = Math.round(Math.max(Math.min(rgb[key], 255), 0));
|
|
||||||
}
|
|
||||||
pixel.color = `rgb(${rgb.r+num},${rgb.g+num},${rgb.b+num})`;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pixel.color = `rgb(${rgb.r+num},${rgb.g+num},${rgb.b+num})`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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.cloner.keyInput = "str:clone", elements.ecloner.keyInput = "str:clone", elements.slow_cloner.keyInput = "str:clone", elements.floating_cloner.keyInput = "str:clone";
|
elements.cloner.keyInput = "str:clone", elements.ecloner.keyInput = "str:clone", elements.slow_cloner.keyInput = "str:clone", elements.floating_cloner.keyInput = "str:clone";
|
||||||
let xDown = false;
|
let xDown = false;
|
||||||
elements.copper_sulfate = {
|
elements.copper_sulfate = {
|
||||||
|
|
@ -54,7 +33,9 @@ elements.copper_sulfate = {
|
||||||
mushroom_spore: {"elem2": null},
|
mushroom_spore: {"elem2": null},
|
||||||
zinc: {"stain2": "#2A1210"},
|
zinc: {"stain2": "#2A1210"},
|
||||||
fire: {"elem1": null,"elem2": "poison_gas","chance": 0.1},
|
fire: {"elem1": null,"elem2": "poison_gas","chance": 0.1},
|
||||||
sugar: {"elem1": "oxidized_copper","elem2": null,"color1": ["#CB3D3D","#A6292B","#6E1B1B"]}
|
sugar: {"elem1": "oxidized_copper","elem2": null,"color1": ["#CB3D3D","#A6292B","#6E1B1B"]},
|
||||||
|
magnesium: {elem1: "copper", elem2: "epsom_salt"},
|
||||||
|
wood: {stain2: "#043023"},
|
||||||
},
|
},
|
||||||
tempHigh: 110,
|
tempHigh: 110,
|
||||||
fireColor: [
|
fireColor: [
|
||||||
|
|
@ -192,6 +173,16 @@ elements.toggle_cloner = {
|
||||||
p2.clone = pixel.clone;
|
p2.clone = pixel.clone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
if(value.includes(":")){
|
||||||
|
let valueArr = value.split(":");
|
||||||
|
if(Array.isArray(pixel[valueArr[0]]) && !pixel[valueArr[0]].includes(valueArr[1])){
|
||||||
|
pixel[valueArr[0]].push(valueArr[1]);
|
||||||
|
} else {
|
||||||
|
pixel[valueArr[0]] = (Number.isInteger(pixel[valueArr[0]])) ? parseInt(valueArr[1]) : valueArr[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -234,6 +225,16 @@ elements.multi_toggle_cloner = {
|
||||||
},
|
},
|
||||||
onSelect: function(){
|
onSelect: function(){
|
||||||
logMessage("Place cloner, then add elements to the clone list by selecting the element and hold down shift while clicking in it, then click on it to toggle on or off. Shift clicking with an element already found in the list will remove it.");
|
logMessage("Place cloner, then add elements to the clone list by selecting the element and hold down shift while clicking in it, then click on it to toggle on or off. Shift clicking with an element already found in the list will remove it.");
|
||||||
|
},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
if(value.includes(":")){
|
||||||
|
let valueArr = value.split(":");
|
||||||
|
if(Array.isArray(pixel[valueArr[0]]) && !pixel[valueArr[0]].includes(valueArr[1])){
|
||||||
|
pixel[valueArr[0]].push(valueArr[1]);
|
||||||
|
} else {
|
||||||
|
pixel[valueArr[0]] = (Number.isInteger(pixel[valueArr[0]])) ? parseInt(valueArr[1]) : valueArr[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,6 +312,16 @@ elements.e_temper = {
|
||||||
p2.temp += difference/4;
|
p2.temp += difference/4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
if(value.includes(":")){
|
||||||
|
let valueArr = value.split(":");
|
||||||
|
if(Array.isArray(pixel[valueArr[0]]) && !pixel[valueArr[0]].includes(valueArr[1])){
|
||||||
|
pixel[valueArr[0]].push(valueArr[1]);
|
||||||
|
} else {
|
||||||
|
pixel[valueArr[0]] = (Number.isInteger(pixel[valueArr[0]])) ? parseInt(valueArr[1]) : valueArr[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,6 +380,16 @@ elements.toggle_temper = {
|
||||||
}
|
}
|
||||||
if(pixel.clickCd > 0){pixel.clickCd--;};
|
if(pixel.clickCd > 0){pixel.clickCd--;};
|
||||||
},
|
},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
if(value.includes(":")){
|
||||||
|
let valueArr = value.split(":");
|
||||||
|
if(Array.isArray(pixel[valueArr[0]]) && !pixel[valueArr[0]].includes(valueArr[1])){
|
||||||
|
pixel[valueArr[0]].push(valueArr[1]);
|
||||||
|
} else {
|
||||||
|
pixel[valueArr[0]] = (Number.isInteger(pixel[valueArr[0]])) ? parseInt(valueArr[1]) : valueArr[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elements.multitool = {
|
elements.multitool = {
|
||||||
|
|
@ -661,6 +682,16 @@ elements.target_sensor = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pixel.clickCd -= (pixel.clickCd > 0) ? 1 : 0;
|
pixel.clickCd -= (pixel.clickCd > 0) ? 1 : 0;
|
||||||
|
},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
if(value.includes(":")){
|
||||||
|
let valueArr = value.split(":");
|
||||||
|
if(Array.isArray(pixel[valueArr[0]]) && !pixel[valueArr[0]].includes(valueArr[1])){
|
||||||
|
pixel[valueArr[0]].push(valueArr[1]);
|
||||||
|
} else {
|
||||||
|
pixel[valueArr[0]] = (Number.isInteger(pixel[valueArr[0]])) ? parseInt(valueArr[1]) : valueArr[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -673,10 +704,30 @@ Pixel.prototype.inRange = function(range){
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
elements.acid.ignore = elements.acid.ignore.concat(["nitric_acid", "aqua_regia", "chloroauric_acid", "nitrogen_dioxide", "nitric_acid_ice", "nitrogen_dioxide_ice", "acid", "chloroauric_acid", "magnesium_chloride", "magnesium_carbonate", "magnesium_hydroxide", "magnesium", "gallium", "gallium_chloride", "salt", "aluminum", "aluminum_chloride", "target_portal_in"]);
|
function acidTick(pixel){
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
let ignore = false;
|
||||||
|
for(let item of elements[pixel.element].ignore){
|
||||||
|
if(p2 != null && item.startsWith("*")&&p2.element.endsWith(item.split("*")[1])){
|
||||||
|
ignore = true;
|
||||||
|
} else if (p2 != null && item.endsWith("*")&&p2.element.startsWith(item.split("*")[0])){
|
||||||
|
ignore = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(p2 != null && !(elements[pixel.element].ignore.includes(p2.element) || ignore || p2.element == pixel.element)){
|
||||||
|
deletePixel(x,y);
|
||||||
|
deletePixel(pixel.x, pixel.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.acid.behavior = behaviors.LIQUID;
|
||||||
|
elements.acid.tick = acidTick;
|
||||||
|
elements.acid.ignore = elements.acid.ignore.concat(["nitric_acid", "aqua_regia", "nitrogen_dioxide", "nitric_acid_ice", "nitrogen_dioxide_ice", "acid", "chloroauric_acid", "*chloride", "*carbonate", "*acetate", "*sulfate", "*gallium", "*hydroxide", "salt", "*aluminum", "target_portal_in", "*magnesium", "*copper", "*iron", "*calcium", "sulfuric_acid", "*vinegar", "*gypsum", "*wall", "epsom_salt", "*platinum", "chloroplatinic_acid", "*sulfur*"]);
|
||||||
elements.nitric_acid = {
|
elements.nitric_acid = {
|
||||||
alias: "HNO₃",
|
alias: "HNO₃",
|
||||||
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"]],
|
behavior: behaviors.LIQUID,
|
||||||
ignore: elements.acid.ignore,
|
ignore: elements.acid.ignore,
|
||||||
state: "liquid",
|
state: "liquid",
|
||||||
color: ["#f5e7e1", "#f7e8e1", "#f7ebe6"],
|
color: ["#f5e7e1", "#f7e8e1", "#f7ebe6"],
|
||||||
|
|
@ -688,6 +739,7 @@ elements.nitric_acid = {
|
||||||
density: 1510,
|
density: 1510,
|
||||||
category: "liquids",
|
category: "liquids",
|
||||||
tick: function(pixel){
|
tick: function(pixel){
|
||||||
|
acidTick(pixel);
|
||||||
for(let coords of squareCoords){
|
for(let coords of squareCoords){
|
||||||
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
let p2 = getPixel(x,y);
|
let p2 = getPixel(x,y);
|
||||||
|
|
@ -718,6 +770,7 @@ elements.nitrogen_dioxide = {
|
||||||
};
|
};
|
||||||
|
|
||||||
elements.nitrogen_dioxide_ice = {
|
elements.nitrogen_dioxide_ice = {
|
||||||
|
temp: -20,
|
||||||
color: ["#4f1607", "#4d1709", "#541606", "#471407"],
|
color: ["#4f1607", "#4d1709", "#541606", "#471407"],
|
||||||
behavior: behaviors.WALL,
|
behavior: behaviors.WALL,
|
||||||
state: "solid",
|
state: "solid",
|
||||||
|
|
@ -727,6 +780,7 @@ elements.nitrogen_dioxide_ice = {
|
||||||
};
|
};
|
||||||
|
|
||||||
elements.nitric_acid_ice = {
|
elements.nitric_acid_ice = {
|
||||||
|
temp: -45,
|
||||||
behavior: behaviors.WALL,
|
behavior: behaviors.WALL,
|
||||||
color: ["#f5e7e4", "#f5efed", "#fcfafa"],
|
color: ["#f5e7e4", "#f5efed", "#fcfafa"],
|
||||||
state: "solid",
|
state: "solid",
|
||||||
|
|
@ -738,7 +792,7 @@ elements.nitric_acid_ice = {
|
||||||
elements.aqua_regia = {
|
elements.aqua_regia = {
|
||||||
alias: "3HCl•HNO₃",
|
alias: "3HCl•HNO₃",
|
||||||
color:["#ffc766", "#f5c36e", "#f7c163", "#ffcd75"],
|
color:["#ffc766", "#f5c36e", "#f7c163", "#ffcd75"],
|
||||||
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"]],
|
behavior: behaviors.LIQUID,
|
||||||
ignore: elements.acid.ignore,
|
ignore: elements.acid.ignore,
|
||||||
category: "liquids",
|
category: "liquids",
|
||||||
state: "liquid",
|
state: "liquid",
|
||||||
|
|
@ -748,22 +802,24 @@ elements.aqua_regia = {
|
||||||
gold_coin: {elem1: "chloroauric_acid", elem2: null, chance: 0.15},
|
gold_coin: {elem1: "chloroauric_acid", elem2: null, chance: 0.15},
|
||||||
blue_gold: {elem1: ["chloroauric_acid", "gallium_chloride"], elem2: null, chance: 0.15},
|
blue_gold: {elem1: ["chloroauric_acid", "gallium_chloride"], elem2: null, chance: 0.15},
|
||||||
purple_gold: {elem1: ["chloroauric_acid", "chloroauric_acid", "chloroauric_acid", "aluminum_chloride"], elem2: null, chance: 0.15},
|
purple_gold: {elem1: ["chloroauric_acid", "chloroauric_acid", "chloroauric_acid", "aluminum_chloride"], elem2: null, chance: 0.15},
|
||||||
}
|
},
|
||||||
|
tick: acidTick,
|
||||||
};
|
};
|
||||||
elements.chloroauric_acid = {
|
elements.chloroauric_acid = {
|
||||||
color: ["#f7bb2f", "#f5bb33", "#f5b727", "#e8ae25"],
|
color: ["#f7bb2f", "#f5bb33", "#f5b727", "#e8ae25"],
|
||||||
alias: "H(AuCl₄)",
|
alias: "H(AuCl₄)",
|
||||||
behavior: behaviors.POWDER,
|
behavior: behaviors.POWDER,
|
||||||
category: "powders",
|
category: "salts",
|
||||||
state: "solid",
|
state: "solid",
|
||||||
density: 3900,
|
density: 3900,
|
||||||
reactions: {
|
reactions: {
|
||||||
potassium: {elem1: "gold_coin", elem2: "potassium_salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}},
|
potassium: {elem1: "gold_coin", elem2: "potassium_salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}, color1: ["#574000", "#705200", "#634900", "#755600"]},
|
||||||
sodium: {elem1: "gold_coin", elem2: "salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}},
|
sodium: {elem1: "gold_coin", elem2: "salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}, color1: ["#574000", "#705200", "#634900", "#755600"]},
|
||||||
caustic_potash: {elem1: "gold_coin", elem2: "potassium_salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("water", x, y);}}}},
|
caustic_potash: {elem1: "gold_coin", elem2: "potassium_salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("water", x, y);}}}},
|
||||||
lye: {elem1: "gold_coin", elem2: "salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("water", x, y);}}}},
|
lye: {elem1: "gold_coin", elem2: "salt", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("water", x, y);}}}, color1: ["#574000", "#705200", "#634900", "#755600"]},
|
||||||
magnesium: {elem1: "gold_coin", elem2: "magnesium_chloride", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}},
|
magnesium: {elem1: "gold_coin", elem2: "magnesium_chloride", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}, color1: ["#574000", "#705200", "#634900", "#755600"]},
|
||||||
metal_scrap: {elem1: "gold_coin", elem2: "slag", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}},
|
metal_scrap: {elem1: "gold_coin", elem2: "slag", func: function(pixel){for(let coords of squareCoords){let x=pixel.x+coords[0],y=pixel.y+coords[1]; if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random()<0.25){createPixel("hydrogen", x, y);}}}, color1: ["#574000", "#705200", "#634900", "#755600"]},
|
||||||
|
copper: {elem1: "copper_chloride", elem2: "gold", color2: ["#574000", "#705200", "#634900", "#755600"]}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
elements.magnesium_chloride = {
|
elements.magnesium_chloride = {
|
||||||
|
|
@ -778,16 +834,30 @@ elements.magnesium_chloride = {
|
||||||
lye: {elem1: "magnesium_hydroxide", elem2: "salt"},
|
lye: {elem1: "magnesium_hydroxide", elem2: "salt"},
|
||||||
caustic_potash: {elem1: "magnesium_hydroxide", elem2: "potassium_salt"},
|
caustic_potash: {elem1: "magnesium_hydroxide", elem2: "potassium_salt"},
|
||||||
ash: {elem1: "magnesium_carbonate", elem2: ["dust","dust",null,"potassium_salt", "charcoal"]}
|
ash: {elem1: "magnesium_carbonate", elem2: ["dust","dust",null,"potassium_salt", "charcoal"]}
|
||||||
|
},
|
||||||
|
tempHigh: 714,
|
||||||
}
|
}
|
||||||
|
elements.molten_magnesium_chloride = {
|
||||||
|
alias: "MgCl₂",
|
||||||
|
density: 2150,
|
||||||
|
behavior: behaviors.MOLTEN,
|
||||||
|
state: "liquid",
|
||||||
|
color: ["#ffeb91", "#ffea8c", "#ffd480", "#ffd685", "#ffc37a"],
|
||||||
|
category: "states",
|
||||||
|
tempLow: 713,
|
||||||
|
stateLow: "magnesium_chloride",
|
||||||
|
stateHigh: ["acid_gas", "magnesium"],
|
||||||
|
tempHigh: 800,
|
||||||
|
temp: 720,
|
||||||
}
|
}
|
||||||
elements.calcium_chloride = {
|
elements.calcium_chloride = {
|
||||||
|
flameColor: ["#fc8721", "#f58625", "#fa8d2d"],
|
||||||
alias: "CaCl₂",
|
alias: "CaCl₂",
|
||||||
category: "salts",
|
category: "salts",
|
||||||
density: 2150,
|
density: 2150,
|
||||||
behavior: behaviors.POWDER,
|
behavior: behaviors.POWDER,
|
||||||
state: "solid",
|
state: "solid",
|
||||||
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
|
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
|
||||||
density: 2320,
|
|
||||||
reactions: {
|
reactions: {
|
||||||
baking_soda: {elem1: "limestone", elem2: "salt"},
|
baking_soda: {elem1: "limestone", elem2: "salt"},
|
||||||
lye: {elem1: "slaked_lime", elem2: "salt"},
|
lye: {elem1: "slaked_lime", elem2: "salt"},
|
||||||
|
|
@ -795,7 +865,24 @@ elements.calcium_chloride = {
|
||||||
ash: {elem1: "limestone", elem2: ["dust","dust",null,"potassium_salt", "charcoal"]},
|
ash: {elem1: "limestone", elem2: ["dust","dust",null,"potassium_salt", "charcoal"]},
|
||||||
epsom_salt: {elem1: "hardened_gypsum", elem2: "magnesium_chloride"},
|
epsom_salt: {elem1: "hardened_gypsum", elem2: "magnesium_chloride"},
|
||||||
carbon_dioxide: {elem1: "limestone", elem2: "chlorine", chance: 0.001, tempMin: 60}
|
carbon_dioxide: {elem1: "limestone", elem2: "chlorine", chance: 0.001, tempMin: 60}
|
||||||
|
},
|
||||||
|
tempHigh: 772,
|
||||||
|
stateHigh: "molten_calcium_chloride",
|
||||||
}
|
}
|
||||||
|
elements.molten_calcium_chloride = {
|
||||||
|
flameColor: ["#fc8721", "#f58625", "#fa8d2d"],
|
||||||
|
alias: "CaCl₂",
|
||||||
|
density: 2150,
|
||||||
|
behavior: behaviors.MOLTEN,
|
||||||
|
state: "liquid",
|
||||||
|
color: ["#ffeb91", "#ffea8c", "#ffd480", "#ffd685", "#ffc37a"],
|
||||||
|
category: "states",
|
||||||
|
tempLow: 771,
|
||||||
|
stateLow: "calcium_chloride",
|
||||||
|
reactions: {
|
||||||
|
oxygen: {elem1: "quicklime", elem2: "chlorine", chance: 0.005, tempMin: 800}
|
||||||
|
},
|
||||||
|
temp: 780,
|
||||||
}
|
}
|
||||||
elements.sodium.reactions.carbon_dioxide = {elem1: "baking_soda", elem2: null}, elements.magnesium.reactions.carbon_dioxide = {elem1: "magnesium_carbonate", elem2:null};
|
elements.sodium.reactions.carbon_dioxide = {elem1: "baking_soda", elem2: null}, elements.magnesium.reactions.carbon_dioxide = {elem1: "magnesium_carbonate", elem2:null};
|
||||||
elements.acid.reactions.magnesium = {elem1: "hydrogen", elem2: "magnesium_chloride"};
|
elements.acid.reactions.magnesium = {elem1: "hydrogen", elem2: "magnesium_chloride"};
|
||||||
|
|
@ -807,7 +894,8 @@ elements.magnesium_carbonate = {
|
||||||
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
|
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
|
||||||
density: 2960,
|
density: 2960,
|
||||||
reactions: {
|
reactions: {
|
||||||
acid: {elem1: "magnesium_chloride", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]}
|
acid: {elem1: "magnesium_chloride", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]},
|
||||||
|
vinegar: {elem1: "magnesium_acetate", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elements.magnesium_hydroxide = {
|
elements.magnesium_hydroxide = {
|
||||||
|
|
@ -818,9 +906,17 @@ elements.magnesium_hydroxide = {
|
||||||
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
|
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
|
||||||
density: 2340,
|
density: 2340,
|
||||||
reactions: {
|
reactions: {
|
||||||
acid: {elem1: "magnesium_chloride", elem2: "water"}
|
acid: {elem1: "magnesium_chloride", elem2: "water"},
|
||||||
}
|
vinegar: {elem1: "magnesium_acetate", elem2: "water"},
|
||||||
|
},
|
||||||
|
tempHigh: 350,
|
||||||
|
stateHigh: ["steam", "magnesium"],
|
||||||
}
|
}
|
||||||
|
elements.vinegar.reactions.limestone = undefined;
|
||||||
|
elements.limestone.reactions = {vinegar: {elem1: "calcium_acetate", elem2: ["carbon_dioxide", "foam", "seltzer", "seltzer"]}};
|
||||||
|
elements.quicklime.reactions.vinegar = {elem1: "calcium_acetate", elem2: "oxygen"};
|
||||||
|
elements.oxidized_copper.reactions.vinegar = {elem1: "copper_acetate", elem2: "water"};
|
||||||
|
elements.slaked_lime.reactions.vinegar = {elem1: "calcium_acetate", elem2: "water"};
|
||||||
elements.hardened_gypsum = {
|
elements.hardened_gypsum = {
|
||||||
alias: "CaSO₄•2H₂O",
|
alias: "CaSO₄•2H₂O",
|
||||||
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
|
color: ["#f2f2f2", "#f5f5f5", "#ebebeb", "#e6e6e6"],
|
||||||
|
|
@ -838,7 +934,7 @@ elements.gypsum = {
|
||||||
behavior: behaviors.STURDYPOWDER,
|
behavior: behaviors.STURDYPOWDER,
|
||||||
density: 2420,
|
density: 2420,
|
||||||
tick: function(pixel){
|
tick: function(pixel){
|
||||||
let chance = (pixel.temp-18)/100*(pixel.temp/40)*((pixelTicks-pixel.start)/250);
|
let chance = ((pixel.temp-18)/100*(Math.abs(pixel.temp)/40)*((pixelTicks-pixel.start)/250))*0.1;
|
||||||
if(Math.random()<chance){
|
if(Math.random()<chance){
|
||||||
changePixel(pixel, "hardened_gypsum");
|
changePixel(pixel, "hardened_gypsum");
|
||||||
}
|
}
|
||||||
|
|
@ -880,8 +976,8 @@ elements.aluminum_chloride = {
|
||||||
behavior: behaviors.POWDER,
|
behavior: behaviors.POWDER,
|
||||||
state: "solid",
|
state: "solid",
|
||||||
density: 2480,
|
density: 2480,
|
||||||
|
tempHigh: 630,
|
||||||
|
stateHigh: ["chlorine", "aluminum"],
|
||||||
}
|
}
|
||||||
elements.acid.reactions.aluminum = {elem1: "hydrogen", elem2: "aluminum_chloride"};
|
elements.acid.reactions.aluminum = {elem1: "hydrogen", elem2: "aluminum_chloride"};
|
||||||
elements.acid.reactions.purple_gold = {elem1: ["aluminum_chloride", "aluminum_chloride", "hydrogen"], elem2: "gold"};
|
elements.acid.reactions.purple_gold = {elem1: ["aluminum_chloride", "aluminum_chloride", "hydrogen"], elem2: "gold"};
|
||||||
|
|
@ -956,5 +1052,520 @@ elements.target_portal_in = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
if(value.includes(":")){
|
||||||
|
let valueArr = value.split(":");
|
||||||
|
if(Array.isArray(pixel[valueArr[0]]) && !pixel[valueArr[0]].includes(valueArr[1])){
|
||||||
|
pixel[valueArr[0]].push(valueArr[1]);
|
||||||
|
} else {
|
||||||
|
pixel[valueArr[0]] = (Number.isInteger(pixel[valueArr[0]])) ? parseInt(valueArr[1]) : valueArr[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.aluminum_acetate = {
|
||||||
|
density: 1002,
|
||||||
|
color: ["#e8e8e8", "#ededed", "#e8e8e8", "#dedede"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
state: "solid",
|
||||||
|
category: "salts",
|
||||||
|
alias: "Al(CH₃COO)₃",
|
||||||
|
reactions: {
|
||||||
|
acid: {elem1: "aluminum_chloride", elem2: "vinegar"},
|
||||||
|
},
|
||||||
|
tempHigh: 120,
|
||||||
|
stateHigh: ["vinegar", "aluminum"],
|
||||||
|
}
|
||||||
|
elements.magnesium_acetate = {
|
||||||
|
density: 1450,
|
||||||
|
color: ["#e8e8e8", "#ededed", "#e8e8e8", "#dedede"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
state: "solid",
|
||||||
|
category: "salts",
|
||||||
|
alias: "Mg(CH₃COO)₂",
|
||||||
|
reactions: {
|
||||||
|
acid: {elem1: "magnesium_chloride", elem2: "vinegar"},
|
||||||
|
baking_soda: {elem1: "magnesium_carbonate", elem2: "sodium_acetate"},
|
||||||
|
ash: {elem1: "magnesium_carbonate", elem2: ["dust", "dust", null, "potassium_acetate"]},
|
||||||
|
},
|
||||||
|
tempHigh: 300,
|
||||||
|
stateHigh: ["vinegar", "magnesium_carbonate"],
|
||||||
|
}
|
||||||
|
elements.calcium_acetate = {
|
||||||
|
flameColor: ["#fc8721", "#f58625", "#fa8d2d"],
|
||||||
|
density: 1509,
|
||||||
|
color: ["#e8e8e8", "#ededed", "#e8e8e8", "#dedede"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
state: "solid",
|
||||||
|
category: "salts",
|
||||||
|
alias: "Ca(CH₃COO)₂",
|
||||||
|
reactions: {
|
||||||
|
acid: {elem1: "calcium_chloride", elem2: "vinegar"},
|
||||||
|
baking_soda: {elem1: "limestone", elem2: "sodium_acetate"},
|
||||||
|
ash: {elem1: "limestone", elem2: ["dust", "dust", null, "potassium_acetate"]},
|
||||||
|
epsom_salt: {elem1: "hardened_gypsum", elem2: "magnesium_acetate"},
|
||||||
|
copper_sulfate: {elem1: "hardened_gypsum", elem2: "copper_acetate"},
|
||||||
|
},
|
||||||
|
tempHigh: 650,
|
||||||
|
stateHigh: ["vinegar", "limestone"]
|
||||||
|
}
|
||||||
|
elements.potassium_acetate = {
|
||||||
|
density: 1570,
|
||||||
|
fireColor: ["#e3a6ff", "#d798f5", "#d88efa"],
|
||||||
|
color: ["#e8e8e8", "#ededed", "#e8e8e8", "#dedede"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
state: "solid",
|
||||||
|
category: "salts",
|
||||||
|
alias: "CH₃COOK",
|
||||||
|
reactions: {
|
||||||
|
acid: {elem1: "potassium_salt", elem2: "vinegar"},
|
||||||
|
baking_soda: {elem1: "caustic_potash", elem2: "sodium_acetate"},
|
||||||
|
|
||||||
|
},
|
||||||
|
tempHigh: 292,
|
||||||
|
}
|
||||||
|
elements.copper_acetate = {
|
||||||
|
density: 1880,
|
||||||
|
fireColor:["#4dff58", "#4ee658", "#59f054", "#54f05c"],
|
||||||
|
color: ["#00594d", "#036357", "#045661", "#044052"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
state: "solid",
|
||||||
|
category: "salts",
|
||||||
|
alias: "Cu(CH₃COO)₂",
|
||||||
|
reactions: {
|
||||||
|
sodium: {elem1: "copper", elem2: "sodium_acetate"},
|
||||||
|
potassium: {elem1: "copper", elem2: "potassium_acetate"},
|
||||||
|
magnesium: {elem1: "copper", elem2: "magnesium_acetate"},
|
||||||
|
calcium: {elem1: "copper", elem2: "calcium_acetate"},
|
||||||
|
aluminum: {elem1: "copper", elem2: "aluminum_acetate"},
|
||||||
|
wood: {stain2: "#043023"},
|
||||||
|
},
|
||||||
|
tempHigh: 240,
|
||||||
|
stateHigh: ["vinegar", "oxidized_copper"],
|
||||||
|
}
|
||||||
|
elements.copper_chloride = {
|
||||||
|
density: 3390,
|
||||||
|
tempHigh: 620,
|
||||||
|
stateHigh: ["copper", "chlorine"],
|
||||||
|
color: ["#59f0c2", "#57f2b2", "#53edce", "#61eddf"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
state: "solid",
|
||||||
|
category: "salts",
|
||||||
|
alias: "CuCl₂",
|
||||||
|
reactions: {
|
||||||
|
sodium: {elem1: "copper", elem2: "sodium_acetate"},
|
||||||
|
potassium: {elem1: "copper", elem2: "potassium_acetate"},
|
||||||
|
magnesium: {elem1: "copper", elem2: "magnesium_acetate"},
|
||||||
|
calcium: {elem1: "copper", elem2: "calcium_acetate"},
|
||||||
|
aluminum: {elem1: "copper", elem2: "aluminum_acetate"},
|
||||||
|
wood: {stain2: "#043023"},
|
||||||
|
},
|
||||||
|
properties: {
|
||||||
|
anhydrous: false
|
||||||
|
},
|
||||||
|
fireColor: "#19abff",
|
||||||
|
tick: function(pixel){
|
||||||
|
if(pixelTicks-pixel.start == 2 && xDown){
|
||||||
|
pixel.anhydrous = true;
|
||||||
|
let rgb = {r: 74, g: 42, b: 10};
|
||||||
|
let num = 6 - (Math.round(Math.random()*12));
|
||||||
|
for(let key in rgb){
|
||||||
|
rgb[key] += num;
|
||||||
|
}
|
||||||
|
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
|
||||||
|
}
|
||||||
|
let multi = (pixel.temp-70)/100;
|
||||||
|
multi = (multi < 0) ? 0 : ((multi > 1) ? 1 : multi);
|
||||||
|
if(Math.random() < 0.05*multi){
|
||||||
|
pixel.anhydrous = true;
|
||||||
|
let rgb = {r: 74, g: 42, b: 10};
|
||||||
|
let num = 6 - (Math.round(Math.random()*12));
|
||||||
|
for(let key in rgb){
|
||||||
|
rgb[key] += num;
|
||||||
|
}
|
||||||
|
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
|
||||||
|
}
|
||||||
|
if(pixel.anhydrous){
|
||||||
|
let neighbors = [];
|
||||||
|
for(let coords of squareCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
neighbors[neighbors.length] = (isEmpty(x,y) && !outOfBounds(x,y)) ? "air" : (!outOfBounds(x,y)) ? pixelMap[x][y].element : undefined;
|
||||||
|
}
|
||||||
|
if(neighbors.includes("air") && pixel.temp < 50 && Math.random() < 0.00035){
|
||||||
|
pixel.anhydrous = false;
|
||||||
|
let rgb = (Math.random() > 0.5) ? {r: 116, g: 237, b: 203} : {r: 116, g: 237, b: 231};
|
||||||
|
let num = 6 - (Math.round(Math.random()*12));
|
||||||
|
for(let key in rgb){
|
||||||
|
rgb[key] += num;
|
||||||
|
}
|
||||||
|
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
|
||||||
|
|
||||||
|
} else if (neighbors.includes("steam") || neighbors.includes("water") || neighbors.includes("salt_water") || neighbors.includes("sugar_water") || neighbors.includes("dirty_water") || neighbors.includes("seltzer") || neighbors.includes("pool_water") || neighbors.includes("slush")){
|
||||||
|
pixel.anhydrous = false;
|
||||||
|
let rgb = (Math.random() > 0.5) ? {r: 116, g: 237, b: 203} : {r: 116, g: 237, b: 231};
|
||||||
|
let num = 6 - (Math.round(Math.random()*12));
|
||||||
|
for(let key in rgb){
|
||||||
|
rgb[key] += num;
|
||||||
|
}
|
||||||
|
pixel.color = `rgb(${rgb.r},${rgb.g},${rgb.b})`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.magnesium.reactions.water = {elem1: "magnesium_hydroxide", elem2: "hydrogen"};
|
||||||
|
elements.sulfuric_acid = {
|
||||||
|
alias: "H₂SO₄",
|
||||||
|
category: "liquids",
|
||||||
|
ignore: elements.acid.ignore,
|
||||||
|
tick: acidTick,
|
||||||
|
color: ["#f5f5f5", "#fcfcfc", "#fffce8", "#fffce6"],
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
state: "liquid",
|
||||||
|
density: 1830,
|
||||||
|
reactions: {
|
||||||
|
magnesium_carbonate: {elem1: ["carbon_dioxide", "foam","foam"], elem2: "epsom_salt"},
|
||||||
|
limestone: {elem1: ["carbon_dioxide", "foam","foam"], elem2: "hardened_gypsum"},
|
||||||
|
quicklime: {elem1: "water", elem2: "hardened_gypsum"},
|
||||||
|
slaked_lime: {elem1: "water", elem2: "hardened_gypsum"},
|
||||||
|
copper_acetate: {elem1: "vinegar", elem2: "copper_sulfate"},
|
||||||
|
copper_oxide: {elem1: "water", elem2: "copper_sulfate"},
|
||||||
|
copper_chloride: {elem1: "acid_gas", elem2: "copper_sulfate"},
|
||||||
|
magnesium: {elem1: "hydrogen", elem2: "epsom_salt"},
|
||||||
|
calcium: {elem1: "hydrogen", elem2: "hardened_gypsum"},
|
||||||
|
magnesium_chloride: {elem1: "acid_gas", elem2: "epsom_salt"},
|
||||||
|
calcium_chloride: {elem1: "acid_gas", elem2: "hardened_gypsum"},
|
||||||
|
calcium_acetate: {elem1: "vinegar", elem2: "hardened_gypsum"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
elements.platinum = {
|
||||||
|
alias: "Pt",
|
||||||
|
color: ["#cccccc", "#cfcfcf", "#d9d9d9", "#dedede"],
|
||||||
|
category: "solids",
|
||||||
|
state: "solid",
|
||||||
|
density: 21450,
|
||||||
|
behavior: behaviors.WALL,
|
||||||
|
reactions: {
|
||||||
|
aqua_regia: {elem1: "chloroplatinic_acid", elem2: "hydrogen"},
|
||||||
|
},
|
||||||
|
tempHigh: 1768,
|
||||||
|
stateHigh: "molten_platinum",
|
||||||
|
}
|
||||||
|
elements.molten_platinum = {
|
||||||
|
color: ["#ffd429", "#f7b228", "#ffb13d", "#ffd83d"],
|
||||||
|
behavior: behaviors.MOLTEN,
|
||||||
|
category: "states",
|
||||||
|
state: "liquid",
|
||||||
|
density: 21450,
|
||||||
|
tempLow: 1767,
|
||||||
|
stateLow: "platinum",
|
||||||
|
temp: 1770
|
||||||
|
}
|
||||||
|
elements.chloroplatinic_acid = {
|
||||||
|
color: ["#e6842e", "#f5923b", "#f5853b", "#f57a33"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
category: "salts",
|
||||||
|
state: "solid",
|
||||||
|
density: 2431,
|
||||||
|
alias: "H₂PtCl₆",
|
||||||
|
tempHigh: 500,
|
||||||
|
stateHigh: ["acid_gas", "chlorine", "platinum", "platinum"],
|
||||||
|
reactions: {
|
||||||
|
sodium: {elem1: "salt", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
potassium: {elem1: "potassium_salt", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
magnesium: {elem1: "magnesium_chloride", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
calcium: {elem1: "calcium_chloride", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
aluminum: {elem1: "aluminum_chloride", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
baking_soda: {elem1: ["salt", "foam"], elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
limestone: {elem1: ["calcium_chloride", "foam"], elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
caustic_potash: {elem1: "potassium_salt", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
lye: {elem1: "salt", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
ash: {elem1: ["potassium_salt", "foam", "charcoal", null, null], elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]},
|
||||||
|
copper: {elem1: "copper_chloride", elem2: "platinum", color2: ["#404040", "#525252", "#454545", "#2e2e2e", "#262626"]}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.magnet = {
|
||||||
|
keyInput: "range",
|
||||||
|
category: "machines",
|
||||||
|
range: 0,
|
||||||
|
attract: ["#1e43fc", "#1137f2", "#1c42ff", "#143bff"],
|
||||||
|
repel: ["#ff1814", "#ff1612", "#ff201c", "#ff0e0a"],
|
||||||
|
off: ["#303030", "#454545", "#3b3b3b", "#3d3d3d"],
|
||||||
|
color: ["#303030", "#454545", "#3b3b3b", "#3d3d3d"],
|
||||||
|
properties: {
|
||||||
|
range: null,
|
||||||
|
dragPixels: [],
|
||||||
|
clickCd: 0,
|
||||||
|
targetElems: [],
|
||||||
|
mode: 0,
|
||||||
|
},
|
||||||
|
onSelect: function(){
|
||||||
|
promptInput("Enter the range of this machine:", (input)=>{elements.magnet.range = parseInt(input);}, "Magnet Range", elements.magnet.range);
|
||||||
|
},
|
||||||
|
onClicked: function(pixel, elem){
|
||||||
|
if(pixel.targetElems.includes(elem) && elem != "unknown" && pixel.clickCd <= 0){
|
||||||
|
pixel.targetElems.splice(pixel.targetElems.indexOf(elem), 1);
|
||||||
|
pixel.clickCd = 20;
|
||||||
|
} else if (elem != "unknown" && pixel.clickCd <= 0) {
|
||||||
|
pixel.targetElems.push(elem);
|
||||||
|
pixel.clickCd = 20;
|
||||||
|
}
|
||||||
|
if(elem == "unknown" && pixel.clickCd <= 0){
|
||||||
|
switch(pixel.mode){
|
||||||
|
case 0:
|
||||||
|
pixel.mode = 1; //attract
|
||||||
|
pixel.color = elements.magnet.attract[Math.round(Math.random()*elements.magnet.attract.length)];
|
||||||
|
while(pixel.color == undefined){
|
||||||
|
pixel.color = elements.magnet.attract[Math.round(Math.random()*elements.magnet.attract.length)];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
pixel.mode = 2; //repel
|
||||||
|
pixel.color = elements.magnet.repel[Math.round(Math.random()*elements.magnet.repel.length)];
|
||||||
|
while(pixel.color == undefined){
|
||||||
|
pixel.color = elements.magnet.repel[Math.round(Math.random()*elements.magnet.repel.length)];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
pixel.mode = 0; //off
|
||||||
|
pixel.color = elements.magnet.off[Math.round(Math.random()*elements.magnet.off.length)];
|
||||||
|
while(pixel.color == undefined){
|
||||||
|
pixel.color = elements.magnet.off[Math.round(Math.random()*elements.magnet.off.length)];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pixel.mode = 0;
|
||||||
|
pixel.color = elements.magnet.off[Math.round(Math.random()*elements.magnet.off.length)];
|
||||||
|
while(pixel.color == undefined){
|
||||||
|
pixel.color = elements.magnet.off[Math.round(Math.random()*elements.magnet.off.length)];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
pixel.clickCd = 20;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tick: function(pixel){
|
||||||
|
pixel.clickCd -= (pixel.clickCd == 0) ? 0 : 1;
|
||||||
|
if(pixel.range == null){
|
||||||
|
pixel.range = elements.magnet.range;
|
||||||
|
};
|
||||||
|
let range = mouseRange(pixel.x, pixel.y, pixel.range);
|
||||||
|
for(let p of pixel.dragPixels){
|
||||||
|
if(!p.inRange(range) || pixel.mode == 0 || !currentPixels.includes(p) || !pixel.targetElems.includes(p.element)){
|
||||||
|
p.drag = false;
|
||||||
|
pixel.dragPixels.splice(pixel.dragPixels.indexOf(p), 1);
|
||||||
|
} else {
|
||||||
|
switch(pixel.mode){
|
||||||
|
case 1:
|
||||||
|
let dX = pixel.x-p.x, dY = pixel.y-p.y;
|
||||||
|
tryMove(p, p.x+Math.sign(dX), p.y+Math.sign(dY), null, true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
let dx = p.x-pixel.x, dy = p.y-pixel.y;
|
||||||
|
tryMove(p, p.x+Math.sign(dx), p.y+Math.sign(dy), null, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for(let coords of range){
|
||||||
|
let p2 = getPixel(coords[0], coords[1]);
|
||||||
|
if(p2 != null && pixel.targetElems.includes(p2.element) && pixel.mode != 0 && !pixel.dragPixels.includes(p2)){
|
||||||
|
p2.drag = true;
|
||||||
|
pixel.dragPixels.push(p2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataInFunc: function(pixel, value){
|
||||||
|
if(value.includes(":")){
|
||||||
|
let valueArr = value.split(":");
|
||||||
|
if(Array.isArray(elements[pixel.element].properties[valueArr[0]]) && !pixel[valueArr[0]].includes(valueArr[1])){
|
||||||
|
pixel[valueArr[0]].push(valueArr[1]);
|
||||||
|
} else if(!Array.isArray(elements[pixel.element].properties[valueArr[0]])){
|
||||||
|
pixel[valueArr[0]] = (Number.isInteger(pixel[valueArr[0]])) ? parseInt(valueArr[1]) : valueArr[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elements.liquid_sulfur_trioxide = {
|
||||||
|
density: 1920,
|
||||||
|
color: ["#fffdc7", "#fffdcc", "#f7f6da", "#f5f3bc"],
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
state: "liquid",
|
||||||
|
category: "states",
|
||||||
|
reactions: {
|
||||||
|
plant: {elem1: null, elem2: "dead_plant"},
|
||||||
|
fruit_leaves: {elem1: null, elem2: "dead_plant"},
|
||||||
|
fruit_branch: {elem1: null, elem2: "wood"},
|
||||||
|
tree_branch: {elem1: null, elem2: "wood"},
|
||||||
|
fruit_vine: {elem1: null, elem2: "dead_plant"},
|
||||||
|
low_fruit_vine: {elem1: null, elem2: "dead_plant"},
|
||||||
|
water: {elem1: null, elem2:"sulfuric_acid"},
|
||||||
|
quicklime: {elem1: null, elem2: "hardened_gypsum"},
|
||||||
|
},
|
||||||
|
tick: function(pixel){
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null && eLists.ANIMAL.includes(p2.element)){
|
||||||
|
if(p2.element == "rat"){
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "rotten_meat");
|
||||||
|
} else {
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "dead_bug");
|
||||||
|
}
|
||||||
|
} else if (p2 != null && eLists.CLEANANIMAL.includes(p2.element)){
|
||||||
|
if(["frog", "tadpole"].includes(p2.element)){
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "rotten_meat");
|
||||||
|
} else {
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "dead_bug");
|
||||||
|
}
|
||||||
|
} else if (p2 != null && eLists.SEEDS.includes(p2.element)){
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "dead_plant");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tempLow: 16,
|
||||||
|
stateLow: "sulfur_trioxide",
|
||||||
|
}
|
||||||
|
elements.sulfur_trioxide = {
|
||||||
|
temp: 16,
|
||||||
|
density: 1920,
|
||||||
|
color: ["#fffdc7", "#fffdcc", "#f7f6da", "#f5f3bc"],
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
state: "solid",
|
||||||
|
category: "salts",
|
||||||
|
reactions: {
|
||||||
|
plant: {elem1: null, elem2: "dead_plant"},
|
||||||
|
fruit_leaves: {elem1: null, elem2: "dead_plant"},
|
||||||
|
fruit_branch: {elem1: null, elem2: "wood"},
|
||||||
|
tree_branch: {elem1: null, elem2: "wood"},
|
||||||
|
fruit_vine: {elem1: null, elem2: "dead_plant"},
|
||||||
|
low_fruit_vine: {elem1: null, elem2: "dead_plant"},
|
||||||
|
water: {elem1: null, elem2:"sulfuric_acid"},
|
||||||
|
quicklime: {elem1: null, elem2: "hardened_gypsum"},
|
||||||
|
grass: {elem1: null, elem2: "dead_plant"},
|
||||||
|
vine: {elem1: null, elem2: "dead_plant"},
|
||||||
|
evergreen: {elem1: null, elem2: "dead_plant"},
|
||||||
|
},
|
||||||
|
tick: function(pixel){
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null && eLists.ANIMAL.includes(p2.element)){
|
||||||
|
if(p2.element == "rat"){
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "rotten_meat");
|
||||||
|
} else {
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "dead_bug");
|
||||||
|
}
|
||||||
|
} else if (p2 != null && eLists.CLEANANIMAL.includes(p2.element)){
|
||||||
|
if(["frog", "tadpole"].includes(p2.element)){
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "rotten_meat");
|
||||||
|
} else {
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "dead_bug");
|
||||||
|
}
|
||||||
|
} else if (p2 != null && eLists.SEEDS.includes(p2.element)){
|
||||||
|
deletePixel(pixel.x,pixel.y);
|
||||||
|
changePixel(p2, "dead_plant");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tempHigh: 17,
|
||||||
|
stateHigh: "liquid_sulfur_trioxide",
|
||||||
|
}
|
||||||
|
elements.sulfur.burnInto = "liquid_sulfur_trioxide", elements.molten_sulfur.burnInto = "liquid_sulfur_trioxide", elements.sulfur_gas.burnInto = "liquid_sulfur_trioxide";
|
||||||
|
|
||||||
|
/*Inspired by the bismuth element from nousersthings.js*/
|
||||||
|
elements.bismuth = {
|
||||||
|
color: ["#d4d4d4", "#d6d6d6", "#dedede", "#d9d9d9", "#dbdbd5"],
|
||||||
|
tempHigh: 271,
|
||||||
|
stateHigh: "molten_bismuth",
|
||||||
|
category: "solids",
|
||||||
|
state: "solid",
|
||||||
|
density: 9807,
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.molten_bismuth = {
|
||||||
|
color: ["#d4d4d4", "#d6d6d6", "#dedede", "#d9d9d9", "#dbdbd5"],
|
||||||
|
category: "states",
|
||||||
|
state: "liquid",
|
||||||
|
behavior: behaviors.MOLTEN,
|
||||||
|
tick: function(pixel){
|
||||||
|
if(pixel.temp > 250 && pixel.temp < 270){
|
||||||
|
chance = 0.000075-(Math.min((pixel.temp-250)/20, 0)*0.00005);
|
||||||
|
if(Math.random()<chance){
|
||||||
|
let colors = [
|
||||||
|
{r:255, g:127, b:0},
|
||||||
|
{r: 255, g:200, b:0},
|
||||||
|
{r: 255, g:255, b:0},
|
||||||
|
{r:0, g:255, b:0},
|
||||||
|
{r:0, g:255, b:255},
|
||||||
|
{r:0, g:0, b:255},
|
||||||
|
{r:255, g:0, b:255},
|
||||||
|
{r:255, g:0, b:70},
|
||||||
|
{r:255, g:105, b:0},
|
||||||
|
];
|
||||||
|
let num = Math.round(Math.random()*7);
|
||||||
|
let newColorArr = [];
|
||||||
|
for(let i = 0; i < colors.length; i++){
|
||||||
|
newColorArr[i] = colors[(i+num)%colors.length];
|
||||||
|
}
|
||||||
|
changePixel(pixel, "bismuth");
|
||||||
|
pixel.colorArr = newColorArr;
|
||||||
|
pixel.crystallized = true;
|
||||||
|
pixel.color = normalize(newColorArr[0]);
|
||||||
|
pixel.position = 1;
|
||||||
|
} else {
|
||||||
|
let positions = [], coordsArr = [];
|
||||||
|
for(let coords of squareCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null && p2.element == "bismuth" && p2.crystallized){
|
||||||
|
positions.push(p2.position);
|
||||||
|
coordsArr.push([x,y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Math.random()<0.005 && positions.length > 0){
|
||||||
|
let lowestIndex = positions.indexOf(Math.min(...positions));
|
||||||
|
let newPos = positions[lowestIndex]+1;
|
||||||
|
let coords = coordsArr[lowestIndex], colors = pixelMap[coords[0]][coords[1]].colorArr || [
|
||||||
|
{r:255, g:127, b:0},
|
||||||
|
{r: 255, g:200, b:0},
|
||||||
|
{r: 255, g:255, b:0},
|
||||||
|
{r:0, g:255, b:0},
|
||||||
|
{r:0, g:255, b:255},
|
||||||
|
{r:0, g:0, b:255},
|
||||||
|
{r:255, g:0, b:255},
|
||||||
|
{r:255, g:0, b:70},
|
||||||
|
{r:255, g:105, b:0},
|
||||||
|
];
|
||||||
|
let current = ((newPos%11)/10)*colors.length;
|
||||||
|
let currentIndex = Math.floor(current);
|
||||||
|
let d = current-currentIndex;
|
||||||
|
let c1 = colors[currentIndex%colors.length], c2 = colors[(currentIndex+1)%colors.length];
|
||||||
|
changePixel(pixel, "bismuth");
|
||||||
|
pixel.crystallized = true;
|
||||||
|
pixel.position = newPos;
|
||||||
|
let num = 207 + (Math.round(Math.random()*12)-6);
|
||||||
|
let rgb = getRGB(interpolateRgb(c1, c2, d));
|
||||||
|
rgb.r = Math.round(rgb.r*(num/255)), rgb.g = Math.round(rgb.g*(num/255)), rgb.b = Math.round(rgb.b*(num/255));
|
||||||
|
pixel.color = normalize(rgb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tempLow: 250,
|
||||||
|
stateLow: "bismuth",
|
||||||
|
temp: 270,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
Version 1.0.0
|
||||||
|
*/
|
||||||
|
function noiseify(color, range){
|
||||||
|
if(color.startsWith("#")){
|
||||||
|
color = hexToRGB(color);
|
||||||
|
} else {
|
||||||
|
color = getRGB(color);
|
||||||
|
}
|
||||||
|
let num = Math.round(Math.random()*(range*2))-range;
|
||||||
|
for(let value in color){
|
||||||
|
color[value] += num;
|
||||||
|
}
|
||||||
|
return `rgb(${color.r},${color.g},${color.b})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let is2d = (arr)=>{
|
||||||
|
return arr.some(item => Array.isArray(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
function colorMix(p1, p2, bias = 0.5){
|
||||||
|
c1 = p1.color;
|
||||||
|
p1.color = interpolateRgb(getRGB(p1.color), getRGB(p2.color), bias);
|
||||||
|
p2.color = interpolateRgb(getRGB(c1), getRGB(p2.color), bias);
|
||||||
|
}
|
||||||
|
|
||||||
|
function interpolateRgb(rgb1, rgb2, ratio = 0.5) {
|
||||||
|
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 normalize(interpolatedRgb);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRGB(rgb){
|
||||||
|
if(rgb.startsWith("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]) };
|
||||||
|
} else {
|
||||||
|
return hexToRGB(rgb2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function pixelToggle(pixel, multi = {r:1,g:1,b:1}){
|
||||||
|
if(pixel.toggle != undefined){
|
||||||
|
pixel.toggle = !pixel.toggle;
|
||||||
|
let rgb;
|
||||||
|
if(Array.isArray(elements[pixel.element].color)){
|
||||||
|
let elemColor = elements[pixel.element].color[Math.round(Math.random()*elements[pixel.element].color.length)];
|
||||||
|
rgb = hexToRGB(elemColor) || getRGB(elemColor);
|
||||||
|
} else {
|
||||||
|
let elemColor = elements[pixel.element].color;
|
||||||
|
rgb = hexToRGB(elemColor) || getRGB(elemColor);
|
||||||
|
}
|
||||||
|
let num = 5 - Math.round(Math.random()*10);
|
||||||
|
if(pixel.toggle){
|
||||||
|
for(let key in rgb){
|
||||||
|
rgb[key] += (100*multi[key]);
|
||||||
|
rgb[key] = Math.round(Math.max(Math.min(rgb[key], 255), 0));
|
||||||
|
}
|
||||||
|
pixel.color = `rgb(${rgb.r+num},${rgb.g+num},${rgb.b+num})`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pixel.color = `rgb(${rgb.r+num},${rgb.g+num},${rgb.b+num})`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function normalize(obj){
|
||||||
|
return `rgb(${obj.r},${obj.g},${obj.b})`;
|
||||||
|
}
|
||||||
187
mods/plants.js
187
mods/plants.js
|
|
@ -1,18 +1,14 @@
|
||||||
/*
|
/*
|
||||||
Version 2.2.0
|
Version 2.2.1
|
||||||
*/
|
*/
|
||||||
function noiseify(color, range){
|
let plants;
|
||||||
if(color.startsWith("#")){
|
if(!enabledMods.includes("/mods/orchidslibrary.js")){
|
||||||
color = hexToRGB(color);
|
let continueWithout = confirm("Missing dependency for plants.js: \"orchidslibrary.js\". Continue without? (cancel will add mod and refresh the page)");
|
||||||
|
if(!continueWithout){
|
||||||
|
addMod("/mods/orchidslibrary.js", true);
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
color = getRGB(color);
|
|
||||||
}
|
|
||||||
let num = Math.round(Math.random()*(range*2))-range;
|
|
||||||
for(let value in color){
|
|
||||||
color[value] += num;
|
|
||||||
}
|
|
||||||
return `rgb(${color.r},${color.g},${color.b})`;
|
|
||||||
}
|
|
||||||
let is2d = (arr)=>{
|
let is2d = (arr)=>{
|
||||||
return arr.some(item => Array.isArray(item));
|
return arr.some(item => Array.isArray(item));
|
||||||
}
|
}
|
||||||
|
|
@ -57,11 +53,11 @@ class growInterval {
|
||||||
}
|
}
|
||||||
let flowerExclude = ["pineapple"];
|
let flowerExclude = ["pineapple"];
|
||||||
let vineGrow = ["wood", "rock_wall", "straw", "wall", "ewall", "bush_cane", "bush_base", "fruit_branch"];
|
let vineGrow = ["wood", "rock_wall", "straw", "wall", "ewall", "bush_cane", "bush_base", "fruit_branch"];
|
||||||
let plants = {
|
plants = {
|
||||||
tree: [],
|
tree: [],
|
||||||
vine: ["grape", "tomato"],
|
vine: ["grape", "tomato"],
|
||||||
bush: [],
|
bush: [],
|
||||||
other: ["pineapple", "watermelon", "banana"],
|
other: ["pineapple", "watermelon", "banana", "onion"],
|
||||||
includes: function(target){
|
includes: function(target){
|
||||||
for(item in this){
|
for(item in this){
|
||||||
if(this[item] && Array.isArray(this[item]) && this[item].includes(target)){return true;}
|
if(this[item] && Array.isArray(this[item]) && this[item].includes(target)){return true;}
|
||||||
|
|
@ -311,6 +307,108 @@ elements.grape.tick = function(pixel){
|
||||||
}
|
}
|
||||||
elements.wood.properties = {age: 0, fruit: ""};
|
elements.wood.properties = {age: 0, fruit: ""};
|
||||||
|
|
||||||
|
elements.nutrient_agar = {
|
||||||
|
category: "life",
|
||||||
|
behavior: behaviors.STURDYPOWDER,
|
||||||
|
properties: {
|
||||||
|
value: null,
|
||||||
|
},
|
||||||
|
state: "solid",
|
||||||
|
color: ["#edeae4", "#f2f0eb", "#e8e7e3", "#f5f1e9"],
|
||||||
|
tick: function(pixel) {
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
let p2 = getPixel(x,y);
|
||||||
|
if(p2 != null){
|
||||||
|
if(["wine", "yeast", "grape", "apple", "plum"].includes(p2.element) && pixel.value == null){
|
||||||
|
pixel.value = "yeast";
|
||||||
|
} else if(p2.element == "mold" && pixel.value == null){
|
||||||
|
pixel.value = "mold";
|
||||||
|
}else if(p2.element == "mushroom_spore" && pixel.value == null){
|
||||||
|
pixel.value = "mushroom_spore";
|
||||||
|
}else if (p2.element == pixel.element && p2.value != null && pixel.value == null && Math.random()<0.0035){
|
||||||
|
pixel.value = p2.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Math.random() < 0.00075){
|
||||||
|
if(pixel.value == null && Math.random() < 0.025){
|
||||||
|
let elems = ["mold", "mold", "mushroom_spore"];
|
||||||
|
let elem = elems[Math.round(Math.random()*elems.length)];
|
||||||
|
while(elem == undefined){
|
||||||
|
elem = elems[Math.round(Math.random()*elems.length)];
|
||||||
|
}
|
||||||
|
changePixel(pixel, elem);
|
||||||
|
} else {
|
||||||
|
changePixel(pixel, pixel.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.mold = {
|
||||||
|
category: "life",
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
color: ["#33402a", "#303d25", "#2b4f39", "#254231"],
|
||||||
|
reactions: {
|
||||||
|
cheese: {elem2: ["rotten_cheese", "rotten_cheese", "mold"], chance: 0.075},
|
||||||
|
meat: {elem2: ["rotten_meat", "rotten_meat", "mold"], chance: 0.075},
|
||||||
|
},
|
||||||
|
state: "solid",
|
||||||
|
tick: function(pixel){
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1], p2 = getPixel(x,y);
|
||||||
|
if(p2 != null){
|
||||||
|
if(plants.includes(p2.element) && Math.random() < 0.025){
|
||||||
|
let elems = ["mold", "rotten_fruit", "rotten_fruit"];
|
||||||
|
let elem = elems[Math.round(Math.random()*elems.length)];
|
||||||
|
while(elem == undefined){
|
||||||
|
elem = elems[Math.round(Math.random()*elems.length)];
|
||||||
|
}
|
||||||
|
changePixel(p2, elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.rotten_fruit = {
|
||||||
|
color: ["#5e3d00", "#5c3c01", "#4a3205", "#634102"],
|
||||||
|
category: "life",
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
reactions: {
|
||||||
|
cheese: {elem2: ["rotten_cheese", "rotten_cheese", "mold"], chance: 0.075},
|
||||||
|
meat: {elem2: ["rotten_meat", "rotten_meat", "mold"], chance: 0.075},
|
||||||
|
},
|
||||||
|
state: "solid",
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.yeast = {
|
||||||
|
color: ["#e3d3a6", "#f2dea7", "#e3cf98", "#f2dfaa"],
|
||||||
|
category: "life",
|
||||||
|
density: 1033,
|
||||||
|
behavior: behaviors.POWDER,
|
||||||
|
reactions: {
|
||||||
|
sugar_water: {elem2: "wine", color2: ["#6e85b5", "#6d81ab"], chance: 0.00025},
|
||||||
|
water: {elem2: "seltzer", chance: 0.00005},
|
||||||
|
},
|
||||||
|
tick: function(pixel){
|
||||||
|
for(let coords of adjacentCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1], p2 = getPixel(x,y);
|
||||||
|
if(p2 != null){
|
||||||
|
if(p2.element == "juice" && Math.random() < 0.00025){
|
||||||
|
let rgb = getRGB(p2.color);
|
||||||
|
for(key in rgb){
|
||||||
|
rgb[key] = Math.max(rgb[key] - 10, 0);
|
||||||
|
}
|
||||||
|
changePixel(p2, "wine");
|
||||||
|
p2.color = normalize(rgb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
elements.fruit_branch = {
|
elements.fruit_branch = {
|
||||||
color: elements.tree_branch.color,
|
color: elements.tree_branch.color,
|
||||||
behavior: [
|
behavior: [
|
||||||
|
|
@ -741,22 +839,6 @@ elements.tomato_seed = new vineSeed("tomato", ["#F8F5D1","#E7E5CF","#E3E1C5"]);
|
||||||
elements.apple = new fruit("apple", ["#FF0507", "#EC0A0D", "#F22426", "#DC2C2E"], ["#F9C497", "#EED3BB", "#EEDEBB"]);
|
elements.apple = new fruit("apple", ["#FF0507", "#EC0A0D", "#F22426", "#DC2C2E"], ["#F9C497", "#EED3BB", "#EEDEBB"]);
|
||||||
elements.apple.bloomColor = ["#fff0f7", "#fcebf3", "#fff0f7", "#ffe6f2", "#fff7fb"];
|
elements.apple.bloomColor = ["#fff0f7", "#fcebf3", "#fff0f7", "#ffe6f2", "#fff7fb"];
|
||||||
elements.apple_seed = new treeSeed("apple", ["#3B1C01", "#3E2107", "#3A1C02"]);
|
elements.apple_seed = new treeSeed("apple", ["#3B1C01", "#3E2107", "#3A1C02"]);
|
||||||
function colorMix(p1, p2, bias = 0.5){
|
|
||||||
p1.color = interpolateRgb(getRGB(p1.color), getRGB(p2.color), bias);
|
|
||||||
p2.color = interpolateRgb(getRGB(p1.color), getRGB(p2.color), bias);
|
|
||||||
}
|
|
||||||
function interpolateRgb(rgb1, rgb2, ratio = 0.5) {
|
|
||||||
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 normalize(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.juice.tick = function(pixel){
|
elements.juice.tick = function(pixel){
|
||||||
for(let i = 0; i < squareCoords.length; i++){
|
for(let i = 0; i < squareCoords.length; i++){
|
||||||
|
|
@ -790,9 +872,6 @@ elements.fruit_milk.onMix = function(pixel){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function normalize(obj){
|
|
||||||
return `rgb(${obj.r},${obj.g},${obj.b})`;
|
|
||||||
}
|
|
||||||
|
|
||||||
elements.milk.reactions.juice = {func: function(p1, p2){
|
elements.milk.reactions.juice = {func: function(p1, p2){
|
||||||
let rgb = interpolateRgb(getRGB(p1.color), getRGB(p2.color), 0.25);
|
let rgb = interpolateRgb(getRGB(p1.color), getRGB(p2.color), 0.25);
|
||||||
|
|
@ -1502,3 +1581,45 @@ elements.onion_seed = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elements.grape.reactions.sugar_water = {elem2: "wine", chance: 0.0006};
|
||||||
|
elements.grape.reactions.water = {elem2: "wine", chance: 0.00006};
|
||||||
|
elements.wine = {
|
||||||
|
density: 992,
|
||||||
|
color: ["#381b30", "#402137", "#261321", "#38192f"],
|
||||||
|
behavior: behaviors.LIQUID,
|
||||||
|
category: "liquids",
|
||||||
|
state: "liquid",
|
||||||
|
properties: {
|
||||||
|
alcChance: 0.13,
|
||||||
|
},
|
||||||
|
tick: function(pixel){
|
||||||
|
if(Math.random() < 0.00025){
|
||||||
|
pixel.alcChance += 0.01;
|
||||||
|
}
|
||||||
|
if(pixel.temp >70){
|
||||||
|
let chanceMulti = (pixel.temp-70)/20;
|
||||||
|
let chance = (pixel.alcChance/100)*chanceMulti;
|
||||||
|
for(let coords of squareCoords){
|
||||||
|
let x = pixel.x+coords[0], y = pixel.y+coords[1];
|
||||||
|
if(isEmpty(x,y) && !outOfBounds(x,y) && Math.random() < chance){
|
||||||
|
createPixel("alcohol_gas", x,y);
|
||||||
|
if(Math.random() < 0.5){
|
||||||
|
let rgb = getRGB(pixel.color);
|
||||||
|
for(let key in rgb){
|
||||||
|
rgb[key] += 10;
|
||||||
|
rgb[key] = Math.max(rgb[key], 0);
|
||||||
|
}
|
||||||
|
changePixel(pixel, "juice");
|
||||||
|
|
||||||
|
pixel.color = noiseify(RGBToHex(rgb), 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tempHigh: 100,
|
||||||
|
stateHigh: ["sugar", "carbon_dioxide", "steam", "alcohol_gas"],
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue