This commit is contained in:
Cube14yt 2025-11-25 17:37:17 +08:00 committed by GitHub
parent 9ca4b13921
commit c32e71a56e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 626 additions and 666 deletions

View File

@ -4,9 +4,7 @@ v 0.11 "axolotl" eats fish
v 0.2 crocodiles scales and axolotls actually eat fish now
v 0.3 chameleons + bugfixes
v 0.4 turtles, tortoise + improved logic
thats it for now
v 0.41 Bugfixes (How was this even working before this fix)
*/
const defaultColors = ["#02c937", "#18d64a", "#09e644"];
@ -73,10 +71,6 @@ function poisonOther(pixel1, pixel2) {
pixel2.poisoned ??= 30;
}
function isInBounds(x, y) {
return x >= 0 && x < width && y >= 0 && y < height;
}
elements.human.reactions.snake =
{ attr1: { panic: 5 } }
@ -87,7 +81,7 @@ if (!elements.glue.ignore.includes("scale")) {
elements.glue.ignore.push("scale");
}
danger = ["crocodile", "snake"];
let danger = ["crocodile", "snake"];
@ -219,7 +213,6 @@ elements.toad_tadpole = {
"bleach": { elem1: null, chance: 0.05 },
"poison": { elem1: null },
"radiation": { elem1: ["toad", "toad", "frog", "worm", null], chance: 0.4 },
"poison": { elem1: null },
"poison_gas": { elem1: null },
},
tempHigh: 100,
@ -362,10 +355,10 @@ elements.snake = {
"slug": { elem2: null, func: behaviors.FEEDPIXEL },
"snail": { elem2: "limestone", func: behaviors.FEEDPIXEL },
"egg": {
elem2: "egg",
func: function (pixel1, pixel2) {
if (pixel2.animal === "snake") return; // Don't eat own egg
behaviors.FEEDPIXEL(pixel1, pixel2);
behaviors.FEEDPIXEL(pixel1);
deletePixel(pixel2.x, pixel2.y)
}
},
"radiation": { elem1: ["ash", "meat", "cooked_meat", "rotten_meat", "lizard", "crocodile", null], chance: 0.4 },
@ -433,10 +426,10 @@ elements.crocodile = {
"head": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"human": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"chameleon": {
reactionFunction: function (pixel, otherPixel) {
func: function (pixel, otherPixel) {
let isNormalColor = defaultColors.includes(pixel.color);
if (otherPixel.threatened !== true || isNormalColor === true) {
behaviors.FEEDPIXEL(pixel, otherPixel);
behaviors.FEEDPIXEL(pixel);
deletePixel(otherPixel.x, otherPixel.y)
}
}
@ -704,11 +697,6 @@ elements.turtle = {
state: "solid",
category: "life",
foodNeed: 10,
tempHigh: 100,
stateHigh: "cooked_meat",
tempLow: -10,
stateLow: "frozen_meat",
breakInto: ["scute", "blood", "meat", "limestone"],
reactions: {
"fish": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.1 },
"kelp": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.5 },
@ -726,44 +714,16 @@ elements.turtle = {
"poison": { elem1: "limestone" },
"poison_gas": { elem1: "limestone" },
},
}
elements.tortoise = {
color: ["#47b000", "#406000"],
behavior: [
"XX|XX|XX",
"XX|FX%1|M2%5",
"M2|M1|M2",
],
density: 1080,
state: "solid",
category: "life",
foodNeed: 10,
tempHigh: 100,
stateHigh: "cooked_meat",
tempLow: -10,
stateLow: "frozen_meat",
breakInto: ["blood", "meat", "limestone"],
reactions: {
"grass": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"plant": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"evergreen": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"pistil": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"petal": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"lettuce": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"tomato": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"pumpkin": { elem2: null, func: behaviors.FEEDPIXEL, chance: 0.2 },
"radiation": { elem1: ["ash", "meat", "cooked_meat", "rotten_meat", "limestone"], chance: 0.4 },
"oxygen": { elem2: "carbon_dioxide", chance: 0.5 },
"mercury": { elem1: "rotten_meat", chance: 0.1 },
"bleach": { elem1: "rotten_meat", chance: 0.1 },
"infection": { elem1: "rotten_meat", chance: 0.025 },
"uranium": { elem1: "rotten_meat", chance: 0.1 },
"cyanide": { elem1: "rotten_meat", chance: 0.1 },
"chlorine": { elem1: "meat", chance: 0.1 },
"alcohol": { elem1: "meat", chance: 0.025 },
"vinegar": { elem1: "rotten_meat", chance: 0.001 },
"poison": { elem1: "limestone" },
"poison_gas": { elem1: "limestone" },
tick: function (pixel) {
pixel.cd ??= 600;
pixel.cd--;
for (let i = 0; i < squareCoords.length; i++) {
let x = pixel.x + squareCoords[i][0];
let y = pixel.y + squareCoords[i][1];
if (isEmpty(x, y) && pixel.cd <= 0 && Math.random() <= 0.005) {
createPixel("scute", x, y);
pixel.cd = 600;
}
}
}
}