Merge pull request #740 from CarbonMonoxida/patch-14
This commit is contained in:
commit
0d70ccdaa4
|
|
@ -1,3 +1,5 @@
|
||||||
|
//this mod is still on proggres (WIP) you can give feedback or report bug to these discord account. @salmonfishy or @carbon_monoxides6
|
||||||
|
|
||||||
elements.carbon_monoxide = {
|
elements.carbon_monoxide = {
|
||||||
color: "#b5b5b5",
|
color: "#b5b5b5",
|
||||||
behavior: behaviors.GAS,
|
behavior: behaviors.GAS,
|
||||||
|
|
@ -18,9 +20,9 @@ elements.carbon_monoxide = {
|
||||||
darkText: true,
|
darkText: true,
|
||||||
fireColor: "#ebba34",
|
fireColor: "#ebba34",
|
||||||
reactions: {
|
reactions: {
|
||||||
"head": { elem1:"rotten_meat", chance:0.5 },
|
"head": { elem2:"rotten_meat", chance:0.5 },
|
||||||
"body": { elem1:"rotten_meat", chance:0.5 },
|
"body": { elem2:"rotten_meat", chance:0.5 },
|
||||||
"human": { elem1:"rotten_meat", chance:0.5 },
|
"human": { elem2:"rotten_meat", chance:0.5 },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
elements.liquid_carbon_monoxide = {
|
elements.liquid_carbon_monoxide = {
|
||||||
|
|
@ -107,7 +109,6 @@ elements.electrons = {
|
||||||
"XX|SH|XX",
|
"XX|SH|XX",
|
||||||
],
|
],
|
||||||
tick: behaviors.BOUNCY,
|
tick: behaviors.BOUNCY,
|
||||||
reactions: {},
|
|
||||||
temp: 20,
|
temp: 20,
|
||||||
category: "energy",
|
category: "energy",
|
||||||
state: "gas",
|
state: "gas",
|
||||||
|
|
@ -216,11 +217,12 @@ elements.radiated_water = {
|
||||||
"head": { elem2:"ash" },
|
"head": { elem2:"ash" },
|
||||||
"bird": { elem2:"rotten_meat"},
|
"bird": { elem2:"rotten_meat"},
|
||||||
"cell": { elem2:"cancer"},
|
"cell": { elem2:"cancer"},
|
||||||
|
"worm": { elem2:"rotten_meat"},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
elements.polluted_air = {
|
elements.polluted_air = {
|
||||||
behavior: behaviors.GAS,
|
behavior: behaviors.DGAS,
|
||||||
category: "radiated",
|
category: "radiated",
|
||||||
state:"gas",
|
state:"gas",
|
||||||
density :10,
|
density :10,
|
||||||
|
|
@ -250,6 +252,9 @@ elements.siren = {
|
||||||
"fallout": {"charge1":1},
|
"fallout": {"charge1":1},
|
||||||
"radiated_water": {"charge1":1},
|
"radiated_water": {"charge1":1},
|
||||||
"polluted_air": {"charge1":1},
|
"polluted_air": {"charge1":1},
|
||||||
|
"radiation": {"charge1":1},
|
||||||
|
"rad_snow": {"charge1":1},
|
||||||
|
"rad_rock": {"charge1":1},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -335,6 +340,8 @@ elements.rad_cleaner = {
|
||||||
"polluted_air": {elem2: "oxygen"},
|
"polluted_air": {elem2: "oxygen"},
|
||||||
"rad_snow": {elem2: "snow"},
|
"rad_snow": {elem2: "snow"},
|
||||||
"rad_rock": {elem2: "rock"},
|
"rad_rock": {elem2: "rock"},
|
||||||
|
"radiated_metal": {elem2: ["nickel","tin","iron"], },
|
||||||
|
"fallout": {elem2: "rock", },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -577,4 +584,576 @@ elements.rotten_lemon = {
|
||||||
reactions: {
|
reactions: {
|
||||||
"water": { elem2: "dirty_water" },
|
"water": { elem2: "dirty_water" },
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.cow = {
|
||||||
|
color: ["#d9d9d9","#616161",],
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|XX",
|
||||||
|
"XX|FX%5.0|M2%5.0 AND BO",
|
||||||
|
"XX|M1|XX",],
|
||||||
|
category: "life",
|
||||||
|
state: "powder",
|
||||||
|
density: 2800,
|
||||||
|
tempHigh: 250,
|
||||||
|
stateHigh: "cooked_meat",
|
||||||
|
tempLow: -10,
|
||||||
|
stateLow: "frozen_meat",
|
||||||
|
reactions: {
|
||||||
|
"water": { elem2: null, chance: 0.2,},
|
||||||
|
"milk": { elem2: null, chance: 0.1, },
|
||||||
|
"alcohol": { elem2: null, chance: 0.21, },
|
||||||
|
"poison": { elem1: "rotten_meat", elem2: null, },
|
||||||
|
"grass": { elem2: null, },
|
||||||
|
"plague": { elem1: "rotten_meat", chance: 0.3, },
|
||||||
|
"worm": { elem2: null, },
|
||||||
|
"flea": { elem2: null, },
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.hazmat_head = {
|
||||||
|
color: ["#404040","#1a1a1a","#737373"],
|
||||||
|
category: "life",
|
||||||
|
hidden: true,
|
||||||
|
density: 1080,
|
||||||
|
state: "solid",
|
||||||
|
conduct: .05,
|
||||||
|
temp: 40,
|
||||||
|
tempHigh: 3500,
|
||||||
|
stateHigh: ["ash","iron",],
|
||||||
|
tempLow: -180,
|
||||||
|
stateLow: "frozen_meat",
|
||||||
|
breakInto: ["blood","meat","bone","metal_scrap"],
|
||||||
|
forceSaveColor: true,
|
||||||
|
reactions: {
|
||||||
|
"oxygen": { elem2:"carbon_dioxide", chance:0.5 },
|
||||||
|
"meat": { elem2:null, chance:0.1 },
|
||||||
|
"cooked_meat": { elem2:null, chance:0.1 },
|
||||||
|
"cured_meat": { elem2:null, chance:0.1 },
|
||||||
|
"sugar": { elem2:null, chance:0.1 },
|
||||||
|
"broth": { elem2:null, chance:0.2 },
|
||||||
|
"yolk": { elem2:null, chance:0.1 },
|
||||||
|
"hard_yolk": { elem2:null, chance:0.1 },
|
||||||
|
"dough": { elem2:null, chance:0.1 },
|
||||||
|
"batter": { elem2:null, chance:0.2 },
|
||||||
|
"butter": { elem2:null, chance:0.1 },
|
||||||
|
"melted_butter": { elem2:null, chance:0.2 },
|
||||||
|
"chocolate": { elem2:null, chance:0.2 },
|
||||||
|
"melted_chocolate": { elem2:null, chance:0.3 },
|
||||||
|
"grape": { elem2:null, chance:0.1 },
|
||||||
|
"tomato": { elem2:null, chance:0.1 },
|
||||||
|
"herb": { elem2:null, chance:0.1 },
|
||||||
|
"lettuce": { elem2:null, chance:0.1 },
|
||||||
|
"corn": { elem2:null, chance:0.1 },
|
||||||
|
"popcorn": { elem2:null, chance:0.15 },
|
||||||
|
"potato": { elem2:null, chance:0.1 },
|
||||||
|
"baked_potato": { elem2:null, chance:0.15 },
|
||||||
|
"bread": { elem2:null, chance:0.1 },
|
||||||
|
"toast": { elem2:null, chance:0.1 },
|
||||||
|
"gingerbread": { elem2:null, chance:0.1 },
|
||||||
|
"baked_batter": { elem2:null, chance:0.2 },
|
||||||
|
"wheat": { elem2:null, chance:0.1 },
|
||||||
|
"candy": { elem2:null, chance:0.1 },
|
||||||
|
"yogurt": { elem2:null, chance:0.2 },
|
||||||
|
"frozen_yogurt": { elem2:null, chance:0.1 },
|
||||||
|
"ice_cream": { elem2:null, chance:0.2 },
|
||||||
|
"beans": { elem2:[null,null,null,null,null,null,null,null,"stench"], chance:0.2 },
|
||||||
|
"tea": { elem2:null, chance:0.2 },
|
||||||
|
"coffee": { elem2:null, chance:0.2 },
|
||||||
|
"milk": { elem2:null, chance:0.2 },
|
||||||
|
"cream": { elem2:null, chance:0.2 },
|
||||||
|
"soda": { elem2:null, chance:0.2 },
|
||||||
|
"chocolate_milk": { elem2:null, chance:0.2 },
|
||||||
|
"fruit_milk": { elem2:null, chance:0.2 },
|
||||||
|
"pilk": { elem2:null, chance:0.2 },
|
||||||
|
"eggnog": { elem2:null, chance:0.2 },
|
||||||
|
"juice": { elem2:null, chance:0.2 },
|
||||||
|
"cheese": { elem2:null, chance:0.1 },
|
||||||
|
"melted_cheese": { elem2:null, chance:0.2 },
|
||||||
|
"alcohol": { elem2:null, chance:0.2 },
|
||||||
|
"antidote": { elem2:null, chance:0.2 },
|
||||||
|
"honey": { elem2:null, chance:0.2 },
|
||||||
|
"caramel": { elem2:null, chance:0.2 },
|
||||||
|
"molasses": { elem2:null, chance:0.05 },
|
||||||
|
"ketchup": { elem2:null, chance:0.1 },
|
||||||
|
"pumpkin_seed": { elem2:null, chance:0.1 },
|
||||||
|
"nut": { elem2:null, chance:0.1 },
|
||||||
|
"nut_meat": { elem2:null, chance:0.1 },
|
||||||
|
"nut_butter": { elem2:null, chance:0.1 },
|
||||||
|
"nut_milk": { elem2:null, chance:0.2 },
|
||||||
|
"jelly": { elem2:null, chance:0.2 },
|
||||||
|
"mayo": { elem2:null, chance:0.2 },
|
||||||
|
"mashed_potato": { elem2:null, chance:0.2 },
|
||||||
|
"sauce": { elem2:null, chance:0.2 },
|
||||||
|
"pickle": { elem2:null, chance:0.1 },
|
||||||
|
"light": { stain1:"#fff154" },
|
||||||
|
},
|
||||||
|
properties: {
|
||||||
|
dead: false
|
||||||
|
},
|
||||||
|
tick: function(pixel) {
|
||||||
|
doHeat(pixel);
|
||||||
|
doBurning(pixel);
|
||||||
|
doElectricity(pixel);
|
||||||
|
if (pixel.dead) {
|
||||||
|
// Turn into rotten_meat if pixelTicks-dead > 500
|
||||||
|
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
|
||||||
|
changePixel(pixel,"rotten_meat");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the body
|
||||||
|
if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "hazmat_body") {
|
||||||
|
var body = pixelMap[pixel.x][pixel.y+1];
|
||||||
|
if (body.dead) { // If body is dead, kill head
|
||||||
|
pixel.dead = body.dead;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { var body = null }
|
||||||
|
|
||||||
|
if (tryMove(pixel, pixel.x, pixel.y+1)) {
|
||||||
|
// create blood if severed 10% chance
|
||||||
|
if (isEmpty(pixel.x, pixel.y+1) && !pixel.dead && Math.random() < 0.1 && !pixel.charge) {
|
||||||
|
createPixel("blood", pixel.x, pixel.y+1);
|
||||||
|
// set dead to true 15% chance
|
||||||
|
if (Math.random() < 0.15) {
|
||||||
|
pixel.dead = pixelTicks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// homeostasis
|
||||||
|
if (pixel.temp > 40) { pixel.temp -= 1; }
|
||||||
|
else if (pixel.temp < 40) { pixel.temp += 1; }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.hazmat_body = {
|
||||||
|
color: ["#ffdf4f","#e8c00e","#ffd412"],
|
||||||
|
category: "life",
|
||||||
|
hidden: true,
|
||||||
|
density: 1570,
|
||||||
|
state: "solid",
|
||||||
|
conduct: .25,
|
||||||
|
temp: 39,
|
||||||
|
tempHigh: 3500,
|
||||||
|
stateHigh: ["metal_scrap","ash"],
|
||||||
|
tempLow: -180,
|
||||||
|
stateLow: "frozen_meat",
|
||||||
|
breakInto: ["blood","meat","bone","metal_scrap","radiation","fallout",],
|
||||||
|
forceSaveColor: true,
|
||||||
|
reactions: {
|
||||||
|
"egg": { elem2:"yolk", chance:0.5, oneway:true },
|
||||||
|
"grape": { elem2:"juice", chance:0.5, color2:"#291824", oneway:true },
|
||||||
|
"ant": { elem2:"dead_bug", chance:0.05, oneway:true },
|
||||||
|
"fly": { elem2:"dead_bug", oneway:true },
|
||||||
|
"firefly": { elem2:"dead_bug", oneway:true },
|
||||||
|
"bee": { elem2:"dead_bug", oneway:true },
|
||||||
|
"flea": { elem2:"dead_bug", oneway:true },
|
||||||
|
"termite": { elem2:"dead_bug", oneway:true },
|
||||||
|
"worm": { elem2:"slime", chance:0.05, oneway:true },
|
||||||
|
"stink_bug": { elem2:"stench", oneway:true },
|
||||||
|
"grass_seed": { elem2:null, chance:0.05 },
|
||||||
|
"gold_coin": { elem2:null, chance:0.05 },
|
||||||
|
"diamond": { elem2:null, chance:0.05 },
|
||||||
|
},
|
||||||
|
properties: {
|
||||||
|
dead: false,
|
||||||
|
dir: 1,
|
||||||
|
panic: 0
|
||||||
|
},
|
||||||
|
tick: function(pixel) {
|
||||||
|
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
|
||||||
|
if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down
|
||||||
|
var headpixel = pixelMap[pixel.x][pixel.y-2];
|
||||||
|
if (headpixel.element == "hazmat_head") {
|
||||||
|
if (isEmpty(pixel.x, pixel.y-1)) {
|
||||||
|
movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
doHeat(pixel);
|
||||||
|
doBurning(pixel);
|
||||||
|
doElectricity(pixel);
|
||||||
|
if (pixel.dead) {
|
||||||
|
// Turn into rotten_meat if pixelTicks-dead > 500
|
||||||
|
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
|
||||||
|
changePixel(pixel,"rotten_meat");
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the head
|
||||||
|
if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "hazmat_head") {
|
||||||
|
var head = pixelMap[pixel.x][pixel.y-1];
|
||||||
|
if (head.dead) { // If head is dead, kill body
|
||||||
|
pixel.dead = head.dead;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { var head = null }
|
||||||
|
if (pixel.burning) {
|
||||||
|
pixel.panic += 0.1;
|
||||||
|
if (head && pixelTicks-pixel.burnStart > 240) {
|
||||||
|
pixel.color = head.color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pixel.panic > 0) {
|
||||||
|
pixel.panic -= 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEmpty(pixel.x, pixel.y-1)) {
|
||||||
|
// create blood if decapitated 10% chance
|
||||||
|
if (Math.random() < 0.1 && !pixel.charge) {
|
||||||
|
createPixel("blood", pixel.x, pixel.y-1);
|
||||||
|
// set dead to true 15% chance
|
||||||
|
if (Math.random() < 0.15) {
|
||||||
|
pixel.dead = pixelTicks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (head == null) { return }
|
||||||
|
else if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance
|
||||||
|
var movesToTry = [
|
||||||
|
[1*pixel.dir,0],
|
||||||
|
[1*pixel.dir,-1],
|
||||||
|
];
|
||||||
|
// While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break.
|
||||||
|
while (movesToTry.length > 0) {
|
||||||
|
var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0];
|
||||||
|
if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) {
|
||||||
|
var origx = pixel.x+move[0];
|
||||||
|
var origy = pixel.y+move[1];
|
||||||
|
if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) {
|
||||||
|
movePixel(head, head.x+move[0], head.y+move[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 15% chance to change direction
|
||||||
|
if (Math.random() < 0.15) {
|
||||||
|
pixel.dir *= -1;
|
||||||
|
}
|
||||||
|
// homeostasis
|
||||||
|
if (pixel.temp > 39) { pixel.temp -= 1; }
|
||||||
|
else if (pixel.temp < 39) { pixel.temp += 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.hazmat_human = {
|
||||||
|
// color: ["#404040","#1a1a1a","#737373"],
|
||||||
|
color: ["#404040","#1a1a1a","#737373"],
|
||||||
|
category: "life",
|
||||||
|
properties: {
|
||||||
|
dead: false,
|
||||||
|
dir: 1,
|
||||||
|
panic: 0
|
||||||
|
},
|
||||||
|
tick: function(pixel) {
|
||||||
|
if (isEmpty(pixel.x, pixel.y+1)) {
|
||||||
|
createPixel("hazmat_body", pixel.x, pixel.y+1);
|
||||||
|
pixel.element = "hazmat_head";
|
||||||
|
}
|
||||||
|
else if (isEmpty(pixel.x, pixel.y-1)) {
|
||||||
|
createPixel("hazmat_head", pixel.x, pixel.y-1);
|
||||||
|
pixelMap[pixel.x][pixel.y-1].color = pixel.color;
|
||||||
|
pixel.element = "hazmat_body";
|
||||||
|
pixel.color = pixelColorPick(pixel)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
deletePixel(pixel.x, pixel.y);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
related: ["hazmat_body","hazmat_head"],
|
||||||
|
cooldown: defaultCooldown,
|
||||||
|
forceSaveColor: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.zombie_head = {
|
||||||
|
color: ["#57f542","#43de2f","#46c435"],
|
||||||
|
category: "life",
|
||||||
|
hidden: true,
|
||||||
|
density: 1025,
|
||||||
|
state: "solid",
|
||||||
|
conduct: .07,
|
||||||
|
temp: 28,
|
||||||
|
tempHigh: 320,
|
||||||
|
stateHigh: ["ash","zombie_virus",],
|
||||||
|
tempLow: -45,
|
||||||
|
stateLow: ["frozen_meat","zombie_virus",],
|
||||||
|
breakInto: ["infection","rotten_meat","bone","zombie_virus",],
|
||||||
|
forceSaveColor: true,
|
||||||
|
reactions: {
|
||||||
|
"head": { elem2: ["rotten_meat","zombie",], chance:0.8, },
|
||||||
|
"body": { elem2: ["rotten_meat","zombie",], chance:0.5, },
|
||||||
|
"oxygen": { elem2:"carbon_dioxide", chance:0.5 },
|
||||||
|
"rotten_meat": { elem2: null, chance:0.5 },
|
||||||
|
"meat": { elem2:null, chance:0.1 },
|
||||||
|
"cooked_meat": { elem2:null, chance:0.1 },
|
||||||
|
"cured_meat": { elem2:null, chance:0.1 },
|
||||||
|
"light": { stain1:"#45eb2f" },
|
||||||
|
},
|
||||||
|
properties: {
|
||||||
|
dead: false
|
||||||
|
},
|
||||||
|
tick: function(pixel) {
|
||||||
|
doHeat(pixel);
|
||||||
|
doBurning(pixel);
|
||||||
|
doElectricity(pixel);
|
||||||
|
if (pixel.dead) {
|
||||||
|
// Turn into rotten_meat if pixelTicks-dead > 500
|
||||||
|
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
|
||||||
|
changePixel(pixel,"rotten_meat");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the body
|
||||||
|
if (!isEmpty(pixel.x, pixel.y+1, true) && pixelMap[pixel.x][pixel.y+1].element == "zombie_body") {
|
||||||
|
var body = pixelMap[pixel.x][pixel.y+1];
|
||||||
|
if (body.dead) { // If body is dead, kill head
|
||||||
|
pixel.dead = body.dead;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { var body = null }
|
||||||
|
|
||||||
|
if (tryMove(pixel, pixel.x, pixel.y+1)) {
|
||||||
|
// create blood if severed 10% chance
|
||||||
|
if (isEmpty(pixel.x, pixel.y+1) && !pixel.dead && Math.random() < 0.1 && !pixel.charge) {
|
||||||
|
createPixel("blood", pixel.x, pixel.y+1);
|
||||||
|
// set dead to true 15% chance
|
||||||
|
if (Math.random() < 0.15) {
|
||||||
|
pixel.dead = pixelTicks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// homeostasis
|
||||||
|
if (pixel.temp > 28) { pixel.temp -= 1; }
|
||||||
|
else if (pixel.temp < 28) { pixel.temp += 1; }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.zombie_body = {
|
||||||
|
color: ["#2d7ecf","#4d94db","#65a175",],
|
||||||
|
category: "life",
|
||||||
|
hidden: true,
|
||||||
|
density: 1520,
|
||||||
|
state: "solid",
|
||||||
|
conduct: .29,
|
||||||
|
temp: 29,
|
||||||
|
tempHigh: 350,
|
||||||
|
stateHigh: ["zombie_virus","ash"],
|
||||||
|
tempLow: -180,
|
||||||
|
stateLow: ["frozen_meat","zombie_virus",],
|
||||||
|
breakInto: ["infection","rotten_meat","bone","zombie_virus",],
|
||||||
|
forceSaveColor: true,
|
||||||
|
reactions: {
|
||||||
|
"head": { elem2: "zombie", },
|
||||||
|
"body": { elem2: "zombie", },
|
||||||
|
},
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
dead: false,
|
||||||
|
dir: 1,
|
||||||
|
panic: 0
|
||||||
|
},
|
||||||
|
tick: function(pixel) {
|
||||||
|
if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall
|
||||||
|
if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down
|
||||||
|
var headpixel = pixelMap[pixel.x][pixel.y-2];
|
||||||
|
if (headpixel.element == "zombie_head") {
|
||||||
|
if (isEmpty(pixel.x, pixel.y-1)) {
|
||||||
|
movePixel(pixelMap[pixel.x][pixel.y-2], pixel.x, pixel.y-1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
swapPixels(pixelMap[pixel.x][pixel.y-2], pixelMap[pixel.x][pixel.y-1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
doHeat(pixel);
|
||||||
|
doBurning(pixel);
|
||||||
|
doElectricity(pixel);
|
||||||
|
if (pixel.dead) {
|
||||||
|
// Turn into rotten_meat if pixelTicks-dead > 500
|
||||||
|
if (pixelTicks-pixel.dead > 200 && Math.random() < 0.1) {
|
||||||
|
changePixel(pixel,"rotten_meat");
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find the head
|
||||||
|
if (!isEmpty(pixel.x, pixel.y-1, true) && pixelMap[pixel.x][pixel.y-1].element == "zombie_head") {
|
||||||
|
var head = pixelMap[pixel.x][pixel.y-1];
|
||||||
|
if (head.dead) { // If head is dead, kill body
|
||||||
|
pixel.dead = head.dead;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { var head = null }
|
||||||
|
if (pixel.burning) {
|
||||||
|
pixel.panic += 0.1;
|
||||||
|
if (head && pixelTicks-pixel.burnStart > 240) {
|
||||||
|
pixel.color = head.color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pixel.panic > 0) {
|
||||||
|
pixel.panic -= 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEmpty(pixel.x, pixel.y-1)) {
|
||||||
|
// create blood if decapitated 10% chance
|
||||||
|
if (Math.random() < 0.1 && !pixel.charge) {
|
||||||
|
createPixel("blood", pixel.x, pixel.y-1);
|
||||||
|
// set dead to true 15% chance
|
||||||
|
if (Math.random() < 0.15) {
|
||||||
|
pixel.dead = pixelTicks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (head == null) { return }
|
||||||
|
else if (Math.random() < 0.1*(isEmpty(pixel.x, pixel.y+1) ? 1 : pixel.panic+1)) { // Move 10% chance
|
||||||
|
var movesToTry = [
|
||||||
|
[1*pixel.dir,0],
|
||||||
|
[1*pixel.dir,-1],
|
||||||
|
];
|
||||||
|
// While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break.
|
||||||
|
while (movesToTry.length > 0) {
|
||||||
|
var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0];
|
||||||
|
if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) {
|
||||||
|
var origx = pixel.x+move[0];
|
||||||
|
var origy = pixel.y+move[1];
|
||||||
|
if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1]) && pixel.x===origx && pixel.y===origy) {
|
||||||
|
movePixel(head, head.x+move[0], head.y+move[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 15% chance to change direction
|
||||||
|
if (Math.random() < 0.15) {
|
||||||
|
pixel.dir *= -1;
|
||||||
|
}
|
||||||
|
// homeostasis
|
||||||
|
if (pixel.temp > 29) { pixel.temp -= 1; }
|
||||||
|
else if (pixel.temp < 29) { pixel.temp += 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.zombie = {
|
||||||
|
// color: ["#404040","#1a1a1a","#737373"],
|
||||||
|
color: ["#57f542","#43de2f","#46c435"],
|
||||||
|
category: "life",
|
||||||
|
properties: {
|
||||||
|
dead: false,
|
||||||
|
dir: 1,
|
||||||
|
panic: 0,
|
||||||
|
},
|
||||||
|
tick: function(pixel) {
|
||||||
|
if (isEmpty(pixel.x, pixel.y+1)) {
|
||||||
|
createPixel("zombie_body", pixel.x, pixel.y+1);
|
||||||
|
pixel.element = "zombie_head";
|
||||||
|
}
|
||||||
|
else if (isEmpty(pixel.x, pixel.y-1)) {
|
||||||
|
createPixel("zombie_head", pixel.x, pixel.y-1);
|
||||||
|
pixelMap[pixel.x][pixel.y-1].color = pixel.color;
|
||||||
|
pixel.element = "zombie_body";
|
||||||
|
pixel.color = pixelColorPick(pixel)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
deletePixel(pixel.x, pixel.y);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
related: ["zombie_body","zombie_head"],
|
||||||
|
cooldown: defaultCooldown,
|
||||||
|
forceSaveColor: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.zombie_virus = {
|
||||||
|
behavior: behaviors.DGAS,
|
||||||
|
color: ["#660266","#bd06bd","#f041f0",],
|
||||||
|
category: "special",
|
||||||
|
density: 30,
|
||||||
|
state: "gas",
|
||||||
|
reactions: {
|
||||||
|
"head": { elem2: ["zombie","rotten_meat",], chance: 0.2, },
|
||||||
|
"body": { elem2: ["zombie","rotten_meat",], chance: 0.2, },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.matter = {
|
||||||
|
behavior: behaviors.GAS,
|
||||||
|
color: ["#c4f8ff","#b0f6ff","#9ccfd6",],
|
||||||
|
darkText: true,
|
||||||
|
category: "energy",
|
||||||
|
density: 2.20,
|
||||||
|
state: "gas",
|
||||||
|
reactions: {
|
||||||
|
"antimatter": { elem1: "explosion", },
|
||||||
|
"positron": { elem1: "explosion", },
|
||||||
|
"electron": { elem1: "explosion", },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
elements.particle_accelerator_left = {
|
||||||
|
behavior: behaviors.SOLID,
|
||||||
|
color: ["#363aa3","#858585","#d1d1d1"],
|
||||||
|
density: 2400,
|
||||||
|
category: "machines",
|
||||||
|
state: "solid",
|
||||||
|
reactions: {
|
||||||
|
"matter": { elem2: ["accelerated_matter_left",] },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
elements.particle_accelerator_right = {
|
||||||
|
behavior: behaviors.SOLID,
|
||||||
|
color: ["#363aa3","#858585","#d1d1d1"],
|
||||||
|
density: 2400,
|
||||||
|
category: "machines",
|
||||||
|
state: "solid",
|
||||||
|
reactions: {
|
||||||
|
"matter": { elem2: ["accelerated_matter_right",] },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
elements.accelerated_matter_left = {
|
||||||
|
color: ["#c0ecf0","#a8f8ff",],
|
||||||
|
behavior: [
|
||||||
|
"M2|XX|XX",
|
||||||
|
"M1 AND XX|XX|XX",
|
||||||
|
"M2|XX|XX",
|
||||||
|
],
|
||||||
|
hidden: true,
|
||||||
|
state: "gas",
|
||||||
|
category: "energy",
|
||||||
|
density: 2.20,
|
||||||
|
reactions: {
|
||||||
|
"accelerated_matter_right": { elem1: ["antimatter","pop",], chance: 0.3, },
|
||||||
|
"accelerated_matter_left": { elem1: ["antimatter","pop",], chance: 0.3, },
|
||||||
|
"antimatter": { elem1: "pop", chance: 0.01, },
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
elements.accelerated_matter_right = {
|
||||||
|
color: ["#c0ecf0","#a8f8ff",],
|
||||||
|
behavior: [
|
||||||
|
"XX|XX|M2",
|
||||||
|
"XX|XX|M1 AND XX",
|
||||||
|
"XX|XX|M2",
|
||||||
|
],
|
||||||
|
hidden: true,
|
||||||
|
state: "gas",
|
||||||
|
category:"energy",
|
||||||
|
density: 2.20,
|
||||||
|
reactions: {
|
||||||
|
"accelerated_matter_left": { elem1: ["antimatter","pop",], chance: 0.3, },
|
||||||
|
"accelerated_matter_right": { elem1: ["antimatter","pop",], chance: 0.3, },
|
||||||
|
"antimatter": { elem1: "pop", chance: 0.01, },
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue