From 19cc8b1cd88c6c460630fceec16d723a3a1c4c7f Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 28 Feb 2023 09:35:19 -0500 Subject: [PATCH] wh40k life eater virus --- mods/life_eater.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 mods/life_eater.js diff --git a/mods/life_eater.js b/mods/life_eater.js new file mode 100644 index 00000000..b452a38b --- /dev/null +++ b/mods/life_eater.js @@ -0,0 +1,59 @@ +function spreadLifeEater(pixel) { + for(i = 0; i < adjacentCoords.length; i++) { //iterate through neighbor spots + if(!isEmpty(pixel.x+adjacentCoords[i][0],pixel.y+adjacentCoords[i][1],true)) { //check for adjacentCoords + var newPixel = pixelMap[pixel.x+adjacentCoords[i][0]][pixel.y+adjacentCoords[i][1]] + if( + (["life","auto creepers"].includes(elements[newPixel.element].category) || newPixel.element == "blood") && + !["life_eater_virus","life_eater_infection","organic_slurry"].includes(newPixel.element) + ) { + changePixel(newPixel,"life_eater_infection"); + }; + }; + }; +}; + + +elements.life_eater_virus = { + color: ["#7bb064", "#aabd60", "#9e9e29"], + behavior: behaviors.GAS, + tick: function(pixel) { + spreadLifeEater(pixel); + }, + category: "life", + state: "gas", + density: airDensity, + excludeRandom: true, +}; + +elements.life_eater_infection = { + color: ["#3d6e29", "#666617", "#7d5716"], + behavior: behaviors.LIQUID, + tick: function(pixel) { + spreadLifeEater(pixel); + + if(pixelTicks - pixel.start > 6) { + changePixel(pixel,Math.random() < 0.5 ? "methane" : "organic_slurry"); + }; + }, + category: "life", + state: "liquid", + density: 1050, + burn: 70, + burnTime: 20, + excludeRandom: true, +}; + +elements.organic_slurry = { + color: ["#6f8046", "#857539"], + behavior: behaviors.LIQUID, + reactions: { + "dirt": {elem1: null, elem2: "mud"}, + "sand": {elem1: null, elem2: "wet_sand"}, + }, + category: "life", + state: "liquid", + density: 1050, + burn: 80, + burnTime: 10, + excludeRandom: true, +}; \ No newline at end of file