diff --git a/mods/flesh_infection.js b/mods/flesh_infection.js new file mode 100644 index 00000000..2755d0b9 --- /dev/null +++ b/mods/flesh_infection.js @@ -0,0 +1,439 @@ +eLists.FESTER = ["dirt","rock","rock_wall","basalt","limestone","steel","iron","dead_bug","mud","sand","wet_sand","clay_soil","clay","mycelium","skin","meat","rotten_meat","wood","ant_wall","dead_plant","plant","hair","bone","cancer","straw","cloth","brick","bamboo","sponge","paper","plastic","concrete"], + +elements.jaws = { + color: "#d9d9d9", + behavior: [ + "XX|ST:flesh_mound AND SM%0.75|XX", + "ST:flesh_mound|XX|ST:flesh_mound", + "XX|ST:flesh_mound AND M1|XX", + ], + reactions: { + "sugar": { "elem1": "quicklime", "elem2": null, "chance": 0.003 }, + "acid": { "elem1": "quicklime", "elem2": null }, + }, + category:"flesh", + tempHigh: 1000, + stateHigh: ["steam","salt","meat","quicklime"], + state: "solid", + density: 2000, + hardness: 0.5, + breakInto: ["flesh_mound","quicklime"], + hidden: true, + ignore: ["jaws","flesh_mound","flesh_beast","solid_flesh","flesh_wood"] +}, + +elements.flesh_mound = { + color: ["#9e4839","#ba6449","#d2856c","#a14940","#E94336"], + behavior: [ + "XX|CR:mucus%0.005|XX", + "CR:mucus%0.005|XX|CR:mucus%0.005", + "XX|CR:mucus%0.005|XX", + ], + tick: function(pixel) { + if (pixel.start === pixelTicks && pixel.fruit === undefined && !pixel.stop) { + if (Math.random() < 0.95) { + pixel.fruit = Math.random() < 0.75 ? "flesh_beast" : "jaw"; + } + else { pixel.fruit = null } + } + if (!isEmpty(pixel.x-1,pixel.y,true)) { + if (pixelMap[pixel.x-1][pixel.y].fruit === undefined && pixelMap[pixel.x-1][pixel.y].element === "flesh_mound") { + pixelMap[pixel.x-1][pixel.y].fruit = pixel.fruit; + } + } + else if (!isEmpty(pixel.x+1,pixel.y,true)) { + if (pixelMap[pixel.x+1][pixel.y].fruit === undefined && pixelMap[pixel.x+1][pixel.y].element === "flesh_mound") { + pixelMap[pixel.x+1][pixel.y].fruit = pixel.fruit; + } + } + else if (!isEmpty(pixel.x,pixel.y+1,true)) { + if (pixelMap[pixel.x][pixel.y+1].fruit === undefined && pixelMap[pixel.x][pixel.y+1].element === "flesh_mound") { + pixelMap[pixel.x][pixel.y+1].fruit = pixel.fruit; + } + } + else if (!isEmpty(pixel.x,pixel.y-1,true)) { + if (pixelMap[pixel.x][pixel.y-1].fruit === undefined && pixelMap[pixel.x][pixel.y-1].element === "flesh_mound") { + pixelMap[pixel.x][pixel.y-1].fruit = pixel.fruit; + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + pixel.sp = 0; //not supported + } + else if (!outOfBounds(pixel.x,pixel.y-1) && pixelMap[pixel.x][pixel.y-1].element === "flesh_mound" && pixelMap[pixel.x][pixel.y-1].sp === 0) { + pixel.sp = 0; + } + else { pixel.sp = 1 } //supported + if (pixel.stop) { + if (pixel.sp === 0) { tryMove(pixel, pixel.x, pixel.y+1); } + return; + } + if (pixel.sp === 0) { tryMove(pixel, pixel.x, pixel.y+1); } + else { + if (pixel.fert && pixel.stage && Math.random() < 0.01 && isEmpty(pixel.x,pixel.y+1)) { + clonePixel(pixel,pixel.x,pixel.y+1); + pixelMap[pixel.x][pixel.y+1].fert = true; + pixelMap[pixel.x][pixel.y+1].stage = pixel.stage-1; + } + } + if (pixel.fert===undefined) { // able to grow down + pixel.fert = Math.random() < 0.50; + } + if (pixel.stage===undefined) { + pixel.stage = Math.floor(Math.random()*20)+10; + } + if (Math.random() < 0.03 && isEmpty(pixel.x-1,pixel.y) && !isEmpty(pixel.x-1,pixel.y-1) && (outOfBounds(pixel.x-1,pixel.y-1) || pixelMap[pixel.x-1][pixel.y-1].element !== "flesh_mound")) { + createPixel("flesh_mound",pixel.x-1,pixel.y); + pixelMap[pixel.x-1][pixel.y].fruit = pixel.fruit; + } + if (Math.random() < 0.03 && isEmpty(pixel.x+1,pixel.y) && !isEmpty(pixel.x+1,pixel.y-1) && (outOfBounds(pixel.x+1,pixel.y-1) || pixelMap[pixel.x+1][pixel.y-1].element !== "flesh_mound")) { + createPixel("flesh_mound",pixel.x+1,pixel.y); + pixelMap[pixel.x+1][pixel.y].fruit = pixel.fruit; + } + if (Math.random() < 0.03 && isEmpty(pixel.x,pixel.y-1) && ( + (!isEmpty(pixel.x-1,pixel.y-1) && (outOfBounds(pixel.x-1,pixel.y-1) || pixelMap[pixel.x-1][pixel.y-1].element !== "flesh_mound")) || + (!isEmpty(pixel.x+1,pixel.y-1) && (outOfBounds(pixel.x+1,pixel.y-1) || pixelMap[pixel.x+1][pixel.y-1].element !== "flesh_mound"))) + ) { + createPixel("flesh_mound",pixel.x,pixel.y-1); + pixelMap[pixel.x][pixel.y-1].fruit = pixel.fruit; + } + if (pixel.fruit && Math.random() < 0.0001) { + 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)) { + createPixel(pixel.fruit,x,y) + break; + } + } + } + if (pixel.h < 2 && Math.random() < 0.0005 && isEmpty(pixel.x,pixel.y-1)) { + createPixel(pixel.element,pixel.x,pixel.y-1); + pixelMap[pixel.x][pixel.y-1].h = pixel.h+1; + } + var coords = [ + [pixel.x+1,pixel.y], + [pixel.x-1,pixel.y], + [pixel.x+1,pixel.y+1], + [pixel.x-1,pixel.y+1], + ]; + for (var i = 0; i < coords.length; i++) { + if (Math.random() < 0.005 && isEmpty(coords[i][0],coords[i][1])) { + if (!isEmpty(coords[i][0],coords[i][1]+1,true)) { + var soil = pixelMap[coords[i][0]][coords[i][1]+1]; + if (eLists.FESTER.indexOf(soil.element) !== -1) { + createPixel(pixel.element,coords[i][0],coords[i][1]); + } + } + } + } + if (Math.random() < 0.0002 && pixel.age > 500 && pixel.temp < 90 && pixel.rooting === false) { + pixel.rooting = true; + } + if (Math.random() < 0.002 && pixel.age > 500 && pixel.temp < 90 && pixel.rooting === true) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel && (eLists.FESTER.indexOf(dirtPixel.element) !== -1 || dirtPixel.element === "grass")) { + changePixel(dirtPixel,"vein_root"); + } + } + } + pixel.age++; + doDefaults(pixel); + }, + renderer: renderPresets.PLANTCHAR, + properties: { + "h": 0, + "age": 0, + "rooting": false, + "fruit": undefined, + }, + reactions: { + "cell": { elem2:"flesh_mound", chance:0.005 }, + "sugar_water": { elem2:"flesh_mound", chance:0.05 }, + "mucus": { elem2:null, chance:0.005 }, + "plant": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + "grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + }, + tempHigh: 100, + stateHigh: "meat", + tempLow: -2, + stateLow: "frozen_meat", + burn:3, + burnTime:20, + breakInto: "meat", + category:"flesh", + state: "solid", + density: 1400, +} + +elements.vein_root = { + color: ["#c72114","#8d3728","#a95338","#c72114","#d83225","#c1745b","#903830", "#c72114",], + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "CH:dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh%0.5 AND CR:vein_root%0.005|CH:dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh,fibrous_flesh%0.5|CH:dirt,mud,sand,wet_sand,clay_soil,clay,mycelium,grass,color_sand,skin,meat,rotten_meat,concrete,dead_plant,dead_bug,root>vein_root,fibrous_flesh%0.5 AND CR:vein_root%0.005", + ], + reactions: { + "rock": { elem2:"sand", chance:0.0008 }, + "mud": { elem2:"dirt", chance:0.01 }, + "wet_sand": { elem2:"sand", chance:0.01 }, + "water": { elem2:null, chance:0.001 }, + "blood": { elem2:null, chance:0.01 }, + "sugar_water": { elem2:null, chance:0.0025 }, + "mucus": { elem2:null, chance:0.0025 } + }, + tempHigh: 175, + stateHigh: "meat", + tempLow: -50, + stateLow: "frozen_meat", + burn: 20, + burnTime: 60, + burnInto: "meat", + breakInto: "blood", + category: "flesh", + state: "solid", + density: 1250, + conduct: 0.1, + hidden: true +} + +elements.fibrous_flesh = { + color: ["#c72114","#7c2617","#984227","#c72114","#b0634a","#802720","#c72114"], + behavior: behaviors.STURDYPOWDER, + tempHigh:175, + stateHigh: "meat", + tempLow: -50, + stateLow: "frozen_meat", + burn: 20, + burnTime: 60, + burnInto: "meat", + category:"flesh", + hidden: true, + breakInto: "blood", + state: "solid", + density: 462 +} + +elements.solid_flesh = { + color: ["#7c2617","#984227","#c72114","#b0634a","#802720"], + behavior: behaviors.WALL, + tempHigh:175, + stateHigh: "meat", + tempLow: -50, + stateLow: "frozen_meat", + burn: 20, + burnTime: 60, + burnInto: "meat", + category:"flesh", + hidden: true, + breakInto: ["blood","meat","meat"], + state: "solid", + density: 462 +} + +elements.flesh_beast = { + color: ["#9e4839","#ba6449","#a14940"], + behavior: [ + "XX|CR:mucus%0.05 AND M2%1.5|M2%5 AND SW:mucus%14", + "XX|FX%2|M2 AND BO", + "XX|M1|M2 AND SW:mucus%14", + ], + reactions: { + "cell": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "head": { elem2:"flesh_mound", chance:0.001, func:behaviors.FEEDPIXEL }, + "body": { elem2:"flesh_mound", chance:0.001, func:behaviors.FEEDPIXEL }, + "frog": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "tadpole": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "fish": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "rat": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "bird": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "bone": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "bone_marrow": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "skin": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "sugar": { elem2:"flesh_mound", chance:0.04, func:behaviors.FEEDPIXEL }, + "sugar_water": { elem2:"flesh_mound", chance:0.05, func:behaviors.FEEDPIXEL }, + "plant": { elem2:["dead_plant","flesh_mound",null], chance:0.005, func:behaviors.FEEDPIXEL }, + "grass": { elem2:["dead_plant","flesh_mound",null], chance:0.005, func:behaviors.FEEDPIXEL }, + "oxygen": { elem2:"carbon_dioxide", chance:0.5 }, + "meat": { elem2:"flesh_mound", chance:0.1, func:behaviors.FEEDPIXEL }, + "cooked_meat": { elem2:"flesh_mound", chance:0.1, func:behaviors.FEEDPIXEL }, + "cured_meat": { elem2:"flesh_mound", chance:0.1, func:behaviors.FEEDPIXEL }, + "cheese": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "rotten_cheese": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "melted_cheese": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "tomato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "sauce": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "vine": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "evergreen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "algae": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "grass_seed": { elem2:null, chance:0.3 , func:behaviors.FEEDPIXEL}, + "wheat_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "wheat": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "potato_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "potato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "corn_seed": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "corn": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL}, + "lichen": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL }, + "flower_seed": { elem2:null, chance:0.4 , func:behaviors.FEEDPIXEL}, + "flour": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL}, + "dough": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "bread": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "toast": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "gingerbread": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL }, + "rice": { elem2:null, chance:0.1 , func:behaviors.FEEDPIXEL}, + "yogurt": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL }, + "beans": { elem2:null, chance:0.15, func:behaviors.FEEDPIXEL }, + "salt": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "sugar": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "crumb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "herb": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "popcorn": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "candy": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "caramel": { elem2:null, chance:0.4, func:behaviors.FEEDPIXEL }, + "lichen": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "egg": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "yolk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "eggnog": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "milk": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "grape": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL }, + "batter": { elem2:null, chance:0.25, func:behaviors.FEEDPIXEL }, + "baked_batter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "butter": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "melted_butter": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "lettuce": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "baked_potato": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "ice_cream": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "cream": { elem2:null, chance:0.3, func:behaviors.FEEDPIXEL }, + "pumpkin": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "pumpkin_seed": { elem2:null, chance:0.2, func:behaviors.FEEDPIXEL }, + "coffee_bean": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "coffee_ground": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut_meat": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "nut_butter": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "jelly": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "worm": { elem2:"flesh_mound", chance:0.1, func:behaviors.FEEDPIXEL }, + "ant": { elem2:null, chance:0.1, func:behaviors.FEEDPIXEL }, + "frog": { elem2:"flesh_mound", chance:0.005, func:behaviors.FEEDPIXEL }, + "snail": { elem2:"flesh_mound", chance:0.1, func:behaviors.FEEDPIXEL }, + "slug": { elem2:"flesh_mound", chance:0.1, func:behaviors.FEEDPIXEL } + }, + egg: "flesh_beast", + category: "flesh", + temp: 37.6, + tempHigh: 120, + stateHigh: "rotten_meat", + tempLow: -18, + stateLow: "frozen_meat", + breakInto: ["mucus","rotten_meat"], + burn:80, + burnTime:150, + state: "solid", + density: 1450, + conduct: 0.25 +} + +elements.flesh_wood = { + color: ["#9e4839","#ba6449","#a14940"], + tick: function(pixel) { + if (!pixel.burning) { + if (!pixel.lc) { pixel.lc = "#7c2617" } + if (!pixel.wc) { pixel.wc = "#ba6449" } + if (isEmpty(pixel.x-1,pixel.y-1) && Math.random() < 0.02) { + if (Math.random() < 0.55) { + createPixel("solid_flesh",pixel.x-1,pixel.y-1); + pixelMap[pixel.x-1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x-1][pixel.y-1], pixel.lc); + } + else { + createPixel("flesh_wood",pixel.x-1,pixel.y-1); + pixelMap[pixel.x-1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x-1][pixel.y-1], pixel.wc); + pixelMap[pixel.x-1][pixel.y-1].wc = pixel.wc; + pixelMap[pixel.x-1][pixel.y-1].lc = pixel.lc; + } + } + if (isEmpty(pixel.x+1,pixel.y-1) && Math.random() < 0.02) { + if (Math.random() < 0.55) { + createPixel("solid_flesh",pixel.x+1,pixel.y-1); + pixelMap[pixel.x+1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x+1][pixel.y-1], pixel.lc); + } + else { + createPixel("flesh_wood",pixel.x+1,pixel.y-1); + pixelMap[pixel.x+1][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x+1][pixel.y-1], pixel.wc); + pixelMap[pixel.x+1][pixel.y-1].wc = pixel.wc; + pixelMap[pixel.x+1][pixel.y-1].lc = pixel.lc; + } + } + if (isEmpty(pixel.x,pixel.y-1) && Math.random() < 0.02) { + if (Math.random() < 0.8) { + createPixel("solid_flesh",pixel.x,pixel.y-1); + pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1], pixel.lc); + } + else { + createPixel("flesh_wood",pixel.x,pixel.y-1); + pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1], pixel.wc); + pixelMap[pixel.x][pixel.y-1].wc = pixel.wc; + pixelMap[pixel.x][pixel.y-1].lc = pixel.lc; + } + } + } + doDefaults(pixel); + }, + renderer: renderPresets.WOODCHAR, + movable: false, + tempHigh: 175, + stateHigh: "meat", + tempLow: -30, + stateLow: "meat", + category: "flesh", + burn: 2, + burnTime: 300, + burnInto: ["blood","ash","cooked_meat","ash"], + hidden: true, + state: "solid", + density: 1500, + hardness: 0.15, + breakInto: ["blood","meat"], + forceSaveColor: true +} + +elements.mucus = { + color: ["#81cf63","#81cf63","#81cf63","#81cf63","#81cf63","#81cf63","#439809","#258b08","#118511","#127b12","#136d14"], + behavior: [ + "XX|DB%1 AND SW:flesh_mound%90|XX", + "DB%1 AND M2%25|DL%0.001|DB%1 AND M2%25", + "DB%1 AND M2%25|DB%2 AND M1|DB%1 AND M2%25", + ], + ignore: ["flesh_beast","flesh_mound","vein_root","glass","rad_glass","glass_shard","rad_shard","stained_glass","baked_clay","acid","acid_gas","neutral_acid","acid_cloud","water","salt_water","sugar_water","dirty_water","copper","gold","porcelain","plastic","bead","microplastic","molten_plastic","pool_water","chlorine","hydrogen","gold_coin","silver","nickel","calcium","bone","earthquake","tornado","tsunami","liquid_light","sensor"], + reactions: { + "ash": { elem1:null, elem2:null }, + "limestone": { elem1:null, elem2:["calcium","carbon_dioxide"] }, + "quicklime": { elem1:null, elem2:null }, + "slaked_lime": { elem1:null, elem2:null }, + "borax": { elem1:null, elem2:null }, + "ammonia": { elem1:null, elem2:null }, + "bleach": { elem1:null, elem2:null }, + "cement": { elem1:null, elem2:null }, + "caustic_potash": { elem1:"water", elem2:"potassium_salt" }, + "bone": { elem2:"flesh_mound", chance:0.01 }, + "water": { elem1:null, elem2:"dirty_water" }, + "salt_water": { elem1:null, elem2:"water" }, + "sugar_water": { elem1:null, elem2:"water" }, + "plant": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + "grass": { elem2:["dead_plant","flesh_mound"], chance:0.005 }, + "tree_branch": { elem1:null, elem2:["wood","wood","dead_plant","flesh_mound"] }, + "charcoal": { elem1:null, elem2:"carbon_dioxide" }, + "rock": { elem1:null, elem2:"sand", chance:0.05 }, + "baking_soda": { elem1:"salt_water", elem2:["carbon_dioxide","foam"] }, + "calcium": { elem1:"chlorine", elem2:"hydrogen", chance:0.01 }, + "zinc": { elem1:"hydrogen", elem2:null, chance:0.03 }, + "sugar": { elem1:"steam", elem2:"carbon_dioxide" }, + }, + tempHigh: 120, + stateHigh: ["steam","steam","salt"], + tempLow: 0, + category:"liquids", + state: "liquid", + density: 1450, + stain: 0.05 +} \ No newline at end of file