From 28ce11f6ca9cadfb44ae3958af72487d9e95da8a Mon Sep 17 00:00:00 2001 From: Cube14yt Date: Sun, 25 May 2025 14:30:57 +0800 Subject: [PATCH 1/4] Add files via upload --- coldblooded.js | 226 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 coldblooded.js diff --git a/coldblooded.js b/coldblooded.js new file mode 100644 index 00000000..e1a5d689 --- /dev/null +++ b/coldblooded.js @@ -0,0 +1,226 @@ + +function eatBee(pixel1, pixel2) { + pixel1.color = "#5c138a"; + pixel1.poisoned ??= 30; +} + + +elements.lizard = { + color: ["#00ff1a", "#038f11"], + behavior: [ + ["M2%2", "XX", "M2%2"], + ["M1%10", "XX", "M1%10"], + ["M2", "M1", "M2"], + ], + category: "life", + state: "solid", + reactions: { + "fly": { elem2: null, func:behaviors.FEEDPIXEL }, + "ant": { elem2: null, func: behaviors.FEEDPIXEL }, + "termite": { elem2: null, func: behaviors.FEEDPIXEL }, + "worm": { elem2: null, func: behaviors.FEEDPIXEL }, + "bee": { elem2: null, func: eatBee }, + "firefly": { elem2: null, func: eatBee }, + }, + foodNeed: 5, + temp: 20, + tempHigh: 120, + stateHigh: "cooked_meat", + tempLow: -20, + stateLow: "frozen_meat", + breakInto: "blood", + density: 1050, + eggColor: "#ffffff", + tick: function(pixel) { + if (pixel.poisoned !== undefined) { + pixel.poisoned--; + if (pixel.poisoned <= 0) { + deletePixel(pixel.x, pixel.y); + return; + } + } + }, +}; + + + +elements.toad = { + color: ["#693800","#945a18"], + behavior: [ + ["XX", "XX", "M2%3 AND SW:water, salt_water, dirty_water, pool_water, seltzer%5"], + ["XX", "FX%25", "M2%6 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8"], + ["M2", "M1 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8", "M2 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8"], +], + + category: "life", + state: "solid", + reactions: { + "fly": { elem2: null, func: behaviors.FEEDPIXEL }, + "ant": { elem2: null, func: behaviors.FEEDPIXEL }, + "termite": { elem2: null, func: behaviors.FEEDPIXEL }, + "worm": { elem2: null, func: behaviors.FEEDPIXEL }, + "spider": { elem2: null, func: behaviors.FEEDPIXEL }, + "bee": { elem2: null, func: eatBee }, + "firefly": { elem2: null, func: eatBee }, + "snail": { elem2: "limestone", func: behaviors.FEEDPIXEL }, + "slug": { elem2: null, func: behaviors.FEEDPIXEL }, + "pool_water": {chance: 0.70, elem1: null}, + "dirty_water": {chance: 0.70, elem1: null}, + }, + foodNeed: 10, + baby: "toad_tadpole", + temp: 18, + tempHigh: 100, + stateHigh: "cooked_meat", + tempLow: -20, + stateLow: "frozen_meat", + breakInto: "slime", + density: 1200, + tick: function(pixel) { + if (pixel.poisoned !== undefined) { + pixel.poisoned--; + if (pixel.poisoned <= 0) { + deletePixel(pixel.x, pixel.y); + return; + } + } + }, +}; + + +elements.toad_tadpole = { + color: "#87b574", + behavior: [ + "XX|XX|M2%25 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", + "XX|FX%0.5|SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", + "M2|M1|M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", + ], + reactions: { + "algae": { elem2:null, chance:0.25 }, + "kelp": { elem2:"water", chance:0.25 }, + "pool_water": {chance: 0.70, elem1: null}, + "dirty_water": {chance: 0.70, elem1: null}, + }, + tempHigh: 100, + stateHigh: "steam", + tempLow: -10, + stateLow: "ice", + breakInto: ["slime",null], + category:"life", + hidden: true, + state: "solid", + density: 1450, + conduct: 0.2, + tick: function(pixel) { + +if (pixelTicks-pixel.start > 500) { + changePixel(pixel,"toad"); + } + + pixel.lifetime ??= 30 + + let up = pixel.y > 0 ? pixelMap[pixel.x][pixel.y - 1] : null; +let down = pixel.y < pixelMap[0].length - 1 ? pixelMap[pixel.x][pixel.y + 1] : null; +let left = pixel.x > 0 ? pixelMap[pixel.x - 1][pixel.y] : null; +let right = pixel.x < pixelMap.length - 1 ? pixelMap[pixel.x + 1][pixel.y] : null; + + if( + (up && up.element === "water") || + (down && down.element === "water") || + (left && left.element === "water") || + (right && right.element === "water")) + { + pixel.lifetime = 30; + } else { + pixel.lifetime--; + if (pixel.lifetime <= 0 && Math.random() <= 0.1) { + deletePixel(pixel.x, pixel.y); + createPixel("slime", pixel.x, pixel.y); + } + } + } +}, + +elements.newt = { + color: ["#db8727","#945a18"], + behavior:[ + ["XX","XX","SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], + ["XX","FX%25","M2%15 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], + ["M2","M1 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15","M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], + ], + category: "life", + state: "solid", + reactions: { + "fly": {elem2: null, func:behaviors.FEEDPIXEL }, + "termite": {elem2: null, func:behaviors.FEEDPIXEL }, + "ant": {elem2: null, func:behaviors.FEEDPIXEL }, + "worm": {elem2: null, func:behaviors.FEEDPIXEL }, + "slug": {elem2: null, func:behaviors.FEEDPIXEL }, + "snail": {elem2: "limestone", func:behaviors.FEEDPIXEL }, + "pool_water": {chance: 0.70, elem1: null}, + "dirty_water": {chance: 0.70, elem1: null}, + }, + foodNeed: 10, + temp: 18, + tempHigh: 100, + stateHigh: "cooked_meat", + tempLow: -20, + stateLow: "frozen_meat", + breakInto: "slime", + density: 1200, + eggColor: "#ffeeab", +}; + +//finish the stuff +elements.axolotl= { +color: ["#ff99ff", "#ffe100", "#785705"], +behavior: [ + ["XX", "XX", "SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], + ["XX", "FX", "M2%15 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], + ["M2", "M1", "M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], +], +category: "life", +state: "solid", +reactions: { + "fly": {elem2: null, func:behaviors.FEEDPIXEL }, + "termite": {elem2: null, func:behaviors.FEEDPIXEL }, + "ant": {elem2: null, func:behaviors.FEEDPIXEL }, + "worm": {elem2: null, func:behaviors.FEEDPIXEL }, + "slug": {elem2: null, func:behaviors.FEEDPIXEL }, + "snail": {elem2: "limestone", func:behaviors.FEEDPIXEL }, + "pool_water": {chance: 0.70, elem1: null}, + "dirty_water": {chance: 0.70, elem1: null}, +}, +foodNeed: 20, +temp: 18, +tempHigh: 90, +stateHigh: "cooked_meat", +tempLow: -20, +stateLow: "frozen_meat", +breakInto: ["slime", "blood"], +density: 1000, +eggColor: ["#dcdcdc", "#a9a9a9", "#2b2b2b"], +tick: function(pixel) { + pixel.lifetime ??= 900; + +let up = pixel.y > 0 ? pixelMap[pixel.x][pixel.y - 1] : null; +let down = pixel.y < pixelMap[0].length - 1 ? pixelMap[pixel.x][pixel.y + 1] : null; +let left = pixel.x > 0 ? pixelMap[pixel.x - 1][pixel.y] : null; +let right = pixel.x < pixelMap.length - 1 ? pixelMap[pixel.x + 1][pixel.y] : null; + + if( + (up && up.element === "water") || + (down && down.element === "water") || + (left && left.element === "water") || + (right && right.element === "water")) + { + pixel.lifetime = 900; + } else { + pixel.lifetime--; + if (pixel.lifetime <= 0 && Math.random() <= 0.1) { + deletePixel(pixel.x, pixel.y); + createPixel("meat", pixel.x, pixel.y); + } + } +} +}; \ No newline at end of file From 8e558582978a82631875e7ef128c4822a2a93c8b Mon Sep 17 00:00:00 2001 From: Cube14yt Date: Sun, 25 May 2025 15:01:29 +0800 Subject: [PATCH 2/4] Delete coldblooded.js --- coldblooded.js | 226 ------------------------------------------------- 1 file changed, 226 deletions(-) delete mode 100644 coldblooded.js diff --git a/coldblooded.js b/coldblooded.js deleted file mode 100644 index e1a5d689..00000000 --- a/coldblooded.js +++ /dev/null @@ -1,226 +0,0 @@ - -function eatBee(pixel1, pixel2) { - pixel1.color = "#5c138a"; - pixel1.poisoned ??= 30; -} - - -elements.lizard = { - color: ["#00ff1a", "#038f11"], - behavior: [ - ["M2%2", "XX", "M2%2"], - ["M1%10", "XX", "M1%10"], - ["M2", "M1", "M2"], - ], - category: "life", - state: "solid", - reactions: { - "fly": { elem2: null, func:behaviors.FEEDPIXEL }, - "ant": { elem2: null, func: behaviors.FEEDPIXEL }, - "termite": { elem2: null, func: behaviors.FEEDPIXEL }, - "worm": { elem2: null, func: behaviors.FEEDPIXEL }, - "bee": { elem2: null, func: eatBee }, - "firefly": { elem2: null, func: eatBee }, - }, - foodNeed: 5, - temp: 20, - tempHigh: 120, - stateHigh: "cooked_meat", - tempLow: -20, - stateLow: "frozen_meat", - breakInto: "blood", - density: 1050, - eggColor: "#ffffff", - tick: function(pixel) { - if (pixel.poisoned !== undefined) { - pixel.poisoned--; - if (pixel.poisoned <= 0) { - deletePixel(pixel.x, pixel.y); - return; - } - } - }, -}; - - - -elements.toad = { - color: ["#693800","#945a18"], - behavior: [ - ["XX", "XX", "M2%3 AND SW:water, salt_water, dirty_water, pool_water, seltzer%5"], - ["XX", "FX%25", "M2%6 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8"], - ["M2", "M1 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8", "M2 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8"], -], - - category: "life", - state: "solid", - reactions: { - "fly": { elem2: null, func: behaviors.FEEDPIXEL }, - "ant": { elem2: null, func: behaviors.FEEDPIXEL }, - "termite": { elem2: null, func: behaviors.FEEDPIXEL }, - "worm": { elem2: null, func: behaviors.FEEDPIXEL }, - "spider": { elem2: null, func: behaviors.FEEDPIXEL }, - "bee": { elem2: null, func: eatBee }, - "firefly": { elem2: null, func: eatBee }, - "snail": { elem2: "limestone", func: behaviors.FEEDPIXEL }, - "slug": { elem2: null, func: behaviors.FEEDPIXEL }, - "pool_water": {chance: 0.70, elem1: null}, - "dirty_water": {chance: 0.70, elem1: null}, - }, - foodNeed: 10, - baby: "toad_tadpole", - temp: 18, - tempHigh: 100, - stateHigh: "cooked_meat", - tempLow: -20, - stateLow: "frozen_meat", - breakInto: "slime", - density: 1200, - tick: function(pixel) { - if (pixel.poisoned !== undefined) { - pixel.poisoned--; - if (pixel.poisoned <= 0) { - deletePixel(pixel.x, pixel.y); - return; - } - } - }, -}; - - -elements.toad_tadpole = { - color: "#87b574", - behavior: [ - "XX|XX|M2%25 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", - "XX|FX%0.5|SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", - "M2|M1|M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", - ], - reactions: { - "algae": { elem2:null, chance:0.25 }, - "kelp": { elem2:"water", chance:0.25 }, - "pool_water": {chance: 0.70, elem1: null}, - "dirty_water": {chance: 0.70, elem1: null}, - }, - tempHigh: 100, - stateHigh: "steam", - tempLow: -10, - stateLow: "ice", - breakInto: ["slime",null], - category:"life", - hidden: true, - state: "solid", - density: 1450, - conduct: 0.2, - tick: function(pixel) { - -if (pixelTicks-pixel.start > 500) { - changePixel(pixel,"toad"); - } - - pixel.lifetime ??= 30 - - let up = pixel.y > 0 ? pixelMap[pixel.x][pixel.y - 1] : null; -let down = pixel.y < pixelMap[0].length - 1 ? pixelMap[pixel.x][pixel.y + 1] : null; -let left = pixel.x > 0 ? pixelMap[pixel.x - 1][pixel.y] : null; -let right = pixel.x < pixelMap.length - 1 ? pixelMap[pixel.x + 1][pixel.y] : null; - - if( - (up && up.element === "water") || - (down && down.element === "water") || - (left && left.element === "water") || - (right && right.element === "water")) - { - pixel.lifetime = 30; - } else { - pixel.lifetime--; - if (pixel.lifetime <= 0 && Math.random() <= 0.1) { - deletePixel(pixel.x, pixel.y); - createPixel("slime", pixel.x, pixel.y); - } - } - } -}, - -elements.newt = { - color: ["#db8727","#945a18"], - behavior:[ - ["XX","XX","SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], - ["XX","FX%25","M2%15 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], - ["M2","M1 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15","M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], - ], - category: "life", - state: "solid", - reactions: { - "fly": {elem2: null, func:behaviors.FEEDPIXEL }, - "termite": {elem2: null, func:behaviors.FEEDPIXEL }, - "ant": {elem2: null, func:behaviors.FEEDPIXEL }, - "worm": {elem2: null, func:behaviors.FEEDPIXEL }, - "slug": {elem2: null, func:behaviors.FEEDPIXEL }, - "snail": {elem2: "limestone", func:behaviors.FEEDPIXEL }, - "pool_water": {chance: 0.70, elem1: null}, - "dirty_water": {chance: 0.70, elem1: null}, - }, - foodNeed: 10, - temp: 18, - tempHigh: 100, - stateHigh: "cooked_meat", - tempLow: -20, - stateLow: "frozen_meat", - breakInto: "slime", - density: 1200, - eggColor: "#ffeeab", -}; - -//finish the stuff -elements.axolotl= { -color: ["#ff99ff", "#ffe100", "#785705"], -behavior: [ - ["XX", "XX", "SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], - ["XX", "FX", "M2%15 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], - ["M2", "M1", "M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], -], -category: "life", -state: "solid", -reactions: { - "fly": {elem2: null, func:behaviors.FEEDPIXEL }, - "termite": {elem2: null, func:behaviors.FEEDPIXEL }, - "ant": {elem2: null, func:behaviors.FEEDPIXEL }, - "worm": {elem2: null, func:behaviors.FEEDPIXEL }, - "slug": {elem2: null, func:behaviors.FEEDPIXEL }, - "snail": {elem2: "limestone", func:behaviors.FEEDPIXEL }, - "pool_water": {chance: 0.70, elem1: null}, - "dirty_water": {chance: 0.70, elem1: null}, -}, -foodNeed: 20, -temp: 18, -tempHigh: 90, -stateHigh: "cooked_meat", -tempLow: -20, -stateLow: "frozen_meat", -breakInto: ["slime", "blood"], -density: 1000, -eggColor: ["#dcdcdc", "#a9a9a9", "#2b2b2b"], -tick: function(pixel) { - pixel.lifetime ??= 900; - -let up = pixel.y > 0 ? pixelMap[pixel.x][pixel.y - 1] : null; -let down = pixel.y < pixelMap[0].length - 1 ? pixelMap[pixel.x][pixel.y + 1] : null; -let left = pixel.x > 0 ? pixelMap[pixel.x - 1][pixel.y] : null; -let right = pixel.x < pixelMap.length - 1 ? pixelMap[pixel.x + 1][pixel.y] : null; - - if( - (up && up.element === "water") || - (down && down.element === "water") || - (left && left.element === "water") || - (right && right.element === "water")) - { - pixel.lifetime = 900; - } else { - pixel.lifetime--; - if (pixel.lifetime <= 0 && Math.random() <= 0.1) { - deletePixel(pixel.x, pixel.y); - createPixel("meat", pixel.x, pixel.y); - } - } -} -}; \ No newline at end of file From 8e5bb0f9f151281bca183d1753dc6120d182265b Mon Sep 17 00:00:00 2001 From: Cube14yt Date: Sun, 25 May 2025 15:04:02 +0800 Subject: [PATCH 3/4] adding mod --- mods/coldblooded.js | 226 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 mods/coldblooded.js diff --git a/mods/coldblooded.js b/mods/coldblooded.js new file mode 100644 index 00000000..e1a5d689 --- /dev/null +++ b/mods/coldblooded.js @@ -0,0 +1,226 @@ + +function eatBee(pixel1, pixel2) { + pixel1.color = "#5c138a"; + pixel1.poisoned ??= 30; +} + + +elements.lizard = { + color: ["#00ff1a", "#038f11"], + behavior: [ + ["M2%2", "XX", "M2%2"], + ["M1%10", "XX", "M1%10"], + ["M2", "M1", "M2"], + ], + category: "life", + state: "solid", + reactions: { + "fly": { elem2: null, func:behaviors.FEEDPIXEL }, + "ant": { elem2: null, func: behaviors.FEEDPIXEL }, + "termite": { elem2: null, func: behaviors.FEEDPIXEL }, + "worm": { elem2: null, func: behaviors.FEEDPIXEL }, + "bee": { elem2: null, func: eatBee }, + "firefly": { elem2: null, func: eatBee }, + }, + foodNeed: 5, + temp: 20, + tempHigh: 120, + stateHigh: "cooked_meat", + tempLow: -20, + stateLow: "frozen_meat", + breakInto: "blood", + density: 1050, + eggColor: "#ffffff", + tick: function(pixel) { + if (pixel.poisoned !== undefined) { + pixel.poisoned--; + if (pixel.poisoned <= 0) { + deletePixel(pixel.x, pixel.y); + return; + } + } + }, +}; + + + +elements.toad = { + color: ["#693800","#945a18"], + behavior: [ + ["XX", "XX", "M2%3 AND SW:water, salt_water, dirty_water, pool_water, seltzer%5"], + ["XX", "FX%25", "M2%6 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8"], + ["M2", "M1 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8", "M2 AND SW:water, salt_water, dirty_water, pool_water, seltzer%8"], +], + + category: "life", + state: "solid", + reactions: { + "fly": { elem2: null, func: behaviors.FEEDPIXEL }, + "ant": { elem2: null, func: behaviors.FEEDPIXEL }, + "termite": { elem2: null, func: behaviors.FEEDPIXEL }, + "worm": { elem2: null, func: behaviors.FEEDPIXEL }, + "spider": { elem2: null, func: behaviors.FEEDPIXEL }, + "bee": { elem2: null, func: eatBee }, + "firefly": { elem2: null, func: eatBee }, + "snail": { elem2: "limestone", func: behaviors.FEEDPIXEL }, + "slug": { elem2: null, func: behaviors.FEEDPIXEL }, + "pool_water": {chance: 0.70, elem1: null}, + "dirty_water": {chance: 0.70, elem1: null}, + }, + foodNeed: 10, + baby: "toad_tadpole", + temp: 18, + tempHigh: 100, + stateHigh: "cooked_meat", + tempLow: -20, + stateLow: "frozen_meat", + breakInto: "slime", + density: 1200, + tick: function(pixel) { + if (pixel.poisoned !== undefined) { + pixel.poisoned--; + if (pixel.poisoned <= 0) { + deletePixel(pixel.x, pixel.y); + return; + } + } + }, +}; + + +elements.toad_tadpole = { + color: "#87b574", + behavior: [ + "XX|XX|M2%25 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", + "XX|FX%0.5|SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", + "M2|M1|M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%14", + ], + reactions: { + "algae": { elem2:null, chance:0.25 }, + "kelp": { elem2:"water", chance:0.25 }, + "pool_water": {chance: 0.70, elem1: null}, + "dirty_water": {chance: 0.70, elem1: null}, + }, + tempHigh: 100, + stateHigh: "steam", + tempLow: -10, + stateLow: "ice", + breakInto: ["slime",null], + category:"life", + hidden: true, + state: "solid", + density: 1450, + conduct: 0.2, + tick: function(pixel) { + +if (pixelTicks-pixel.start > 500) { + changePixel(pixel,"toad"); + } + + pixel.lifetime ??= 30 + + let up = pixel.y > 0 ? pixelMap[pixel.x][pixel.y - 1] : null; +let down = pixel.y < pixelMap[0].length - 1 ? pixelMap[pixel.x][pixel.y + 1] : null; +let left = pixel.x > 0 ? pixelMap[pixel.x - 1][pixel.y] : null; +let right = pixel.x < pixelMap.length - 1 ? pixelMap[pixel.x + 1][pixel.y] : null; + + if( + (up && up.element === "water") || + (down && down.element === "water") || + (left && left.element === "water") || + (right && right.element === "water")) + { + pixel.lifetime = 30; + } else { + pixel.lifetime--; + if (pixel.lifetime <= 0 && Math.random() <= 0.1) { + deletePixel(pixel.x, pixel.y); + createPixel("slime", pixel.x, pixel.y); + } + } + } +}, + +elements.newt = { + color: ["#db8727","#945a18"], + behavior:[ + ["XX","XX","SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], + ["XX","FX%25","M2%15 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], + ["M2","M1 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15","M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%15"], + ], + category: "life", + state: "solid", + reactions: { + "fly": {elem2: null, func:behaviors.FEEDPIXEL }, + "termite": {elem2: null, func:behaviors.FEEDPIXEL }, + "ant": {elem2: null, func:behaviors.FEEDPIXEL }, + "worm": {elem2: null, func:behaviors.FEEDPIXEL }, + "slug": {elem2: null, func:behaviors.FEEDPIXEL }, + "snail": {elem2: "limestone", func:behaviors.FEEDPIXEL }, + "pool_water": {chance: 0.70, elem1: null}, + "dirty_water": {chance: 0.70, elem1: null}, + }, + foodNeed: 10, + temp: 18, + tempHigh: 100, + stateHigh: "cooked_meat", + tempLow: -20, + stateLow: "frozen_meat", + breakInto: "slime", + density: 1200, + eggColor: "#ffeeab", +}; + +//finish the stuff +elements.axolotl= { +color: ["#ff99ff", "#ffe100", "#785705"], +behavior: [ + ["XX", "XX", "SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], + ["XX", "FX", "M2%15 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], + ["M2", "M1", "M2 AND SW:water,salt_water,sugar_water,dirty_water,seltzer,pool_water%10"], +], +category: "life", +state: "solid", +reactions: { + "fly": {elem2: null, func:behaviors.FEEDPIXEL }, + "termite": {elem2: null, func:behaviors.FEEDPIXEL }, + "ant": {elem2: null, func:behaviors.FEEDPIXEL }, + "worm": {elem2: null, func:behaviors.FEEDPIXEL }, + "slug": {elem2: null, func:behaviors.FEEDPIXEL }, + "snail": {elem2: "limestone", func:behaviors.FEEDPIXEL }, + "pool_water": {chance: 0.70, elem1: null}, + "dirty_water": {chance: 0.70, elem1: null}, +}, +foodNeed: 20, +temp: 18, +tempHigh: 90, +stateHigh: "cooked_meat", +tempLow: -20, +stateLow: "frozen_meat", +breakInto: ["slime", "blood"], +density: 1000, +eggColor: ["#dcdcdc", "#a9a9a9", "#2b2b2b"], +tick: function(pixel) { + pixel.lifetime ??= 900; + +let up = pixel.y > 0 ? pixelMap[pixel.x][pixel.y - 1] : null; +let down = pixel.y < pixelMap[0].length - 1 ? pixelMap[pixel.x][pixel.y + 1] : null; +let left = pixel.x > 0 ? pixelMap[pixel.x - 1][pixel.y] : null; +let right = pixel.x < pixelMap.length - 1 ? pixelMap[pixel.x + 1][pixel.y] : null; + + if( + (up && up.element === "water") || + (down && down.element === "water") || + (left && left.element === "water") || + (right && right.element === "water")) + { + pixel.lifetime = 900; + } else { + pixel.lifetime--; + if (pixel.lifetime <= 0 && Math.random() <= 0.1) { + deletePixel(pixel.x, pixel.y); + createPixel("meat", pixel.x, pixel.y); + } + } +} +}; \ No newline at end of file From 3af90e833540109d741cb1e92213b8a9602d80c7 Mon Sep 17 00:00:00 2001 From: redbirdly <155550833+redbirdly@users.noreply.github.com> Date: Mon, 26 May 2025 13:05:38 +0900 Subject: [PATCH 4/4] Add better version of occlusion.js --- mods/shade.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 mods/shade.js diff --git a/mods/shade.js b/mods/shade.js new file mode 100644 index 00000000..e7bafdac --- /dev/null +++ b/mods/shade.js @@ -0,0 +1,46 @@ +"use strict"; +// Shade.ts -> Shade.js +// Constants +const SHADOW_UPDATE_INTERVAL = 4; +const SHADOW_BLUR_RADIUS = 5; +const SHADOW_INTENSITY = 128; +// Canvases +let shadowCanvas1; +let shadowCanvasCtx1; +let shadowCanvas2; +let shadowCanvasCtx2; + +function initializeShade() { + shadowCanvas1 = new OffscreenCanvas(width + 1, height + 1); + shadowCanvasCtx1 = shadowCanvas1.getContext('2d'); + shadowCanvas2 = new OffscreenCanvas(width + 1, height + 1); + shadowCanvasCtx2 = shadowCanvas2.getContext("2d"); +} + +function updateShadows() { + if (pixelTicks % SHADOW_UPDATE_INTERVAL !== 0) + return; + const shadowCanvasImageData1 = shadowCanvasCtx1.createImageData(width + 1, height + 1); + const shadowCanvasData1 = shadowCanvasImageData1.data; + for (let pixel of currentPixels) { + const exposed = getNeighbors(pixel).length !== 4; + const alphaIndex = (pixel.y * (width + 1) + pixel.x) * 4 + 3; + shadowCanvasData1[alphaIndex] = exposed ? 0 : SHADOW_INTENSITY; + } + shadowCanvasCtx1.putImageData(shadowCanvasImageData1, 0, 0); + // Blur the shadows + shadowCanvasCtx2.clearRect(0, 0, shadowCanvas2.width, shadowCanvas2.height); + shadowCanvasCtx2.filter = `blur(${SHADOW_BLUR_RADIUS}px)`; + shadowCanvasCtx2.drawImage(shadowCanvas1, 0, 0, shadowCanvas2.width, shadowCanvas2.height); + shadowCanvasCtx2.filter = "none"; +} + +function drawShadows(ctx) { + ctx.globalAlpha = 1.0; + ctx.drawImage(shadowCanvas2, 0, 0, canvas.width, canvas.height); +} + +// Hooks +runAfterReset(initializeShade); +runEveryTick(updateShadows); +renderPostPixel(drawShadows);