wh40k life eater virus

This commit is contained in:
Laetitia (O-01-67) 2023-02-28 09:35:19 -05:00 committed by GitHub
parent 777b748f0f
commit 19cc8b1cd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 59 additions and 0 deletions

59
mods/life_eater.js Normal file
View File

@ -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,
};