From bd33129bb984c8be4bbfabe37382a59980fdad27 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Fri, 9 Dec 2022 12:50:15 -0500 Subject: [PATCH] iocalfaeus clones --- mods/iocalfaeus_clones.js | 100 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 mods/iocalfaeus_clones.js diff --git a/mods/iocalfaeus_clones.js b/mods/iocalfaeus_clones.js new file mode 100644 index 00000000..d6e03c78 --- /dev/null +++ b/mods/iocalfaeus_clones.js @@ -0,0 +1,100 @@ +elements.iorefrius_gas = { + color: ["#217349", "#1b5f3c"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.cold) { + pixel.cold = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.cold && Math.random() < 0.04)) { + pixel.cold = true; + }; + }; + }; + }; + if(pixel.cold == true) { + pixel.temp -= 16; + }; + if(pixel.cold == true && Math.random() < 0.02) { + pixel.cold = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; + +elements.iolucius_gas = { + color: ["#e9c5ed", "#e2b0e8"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.lit) { + pixel.lit = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.lit && Math.random() < 0.04)) { + pixel.lit = true; + }; + }; + }; + }; + if(Math.random() < 0.05) { + if(pixel.lit == true) { + var randomLightOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var lightX = pixel.x + randomLightOffset[0]; + var lightY = pixel.y + randomLightOffset[1]; + if(isEmpty(lightX,lightY,false)) { + createPixel("light",lightX,lightY); + }; + }; + }; + if(pixel.lit == true && Math.random() < 0.02) { + pixel.lit = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; + +elements.ioradius_gas = { + color: ["#a6a258", "#97944e"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.rlit) { + pixel.rlit = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || newPixel.element === "radiation" || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.rlit && Math.random() < 0.04)) { + pixel.rlit = true; + }; + }; + }; + }; + if(Math.random() < 0.05) { + if(pixel.rlit == true) { + var randomRadiationOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var radiationX = pixel.x + randomRadiationOffset[0]; + var radiationY = pixel.y + randomRadiationOffset[1]; + if(isEmpty(radiationX,radiationY,false)) { + createPixel("radiation",radiationX,radiationY); + }; + }; + }; + if(pixel.rlit == true && Math.random() < 0.02) { + pixel.rlit = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; \ No newline at end of file