From 73914fa05b0e9b8a2f3db731ce7d2006aa72d4ed Mon Sep 17 00:00:00 2001 From: SquareScreamYT <134925668+SquareScreamYT@users.noreply.github.com> Date: Sun, 17 Mar 2024 16:04:27 +0800 Subject: [PATCH 1/2] citybuilding.js 1 --- mods/citybuilding.js | 216 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 mods/citybuilding.js diff --git a/mods/citybuilding.js b/mods/citybuilding.js new file mode 100644 index 00000000..e99a655a --- /dev/null +++ b/mods/citybuilding.js @@ -0,0 +1,216 @@ +function building_1_segment() { + if (pixel.foundation = true && pixel.height < pixel.limit) { + if (isEmpty(pixel.x+1,pixel.y-pixel.height) && + isEmpty(pixel.x-1,pixel.y-pixel.height) && + isEmpty(pixel.x+2,pixel.y-pixel.height) && + isEmpty(pixel.x-2,pixel.y-pixel.height) && + isEmpty(pixel.x+2,pixel.y-1-pixel.height) && + isEmpty(pixel.x-2,pixel.y-1-pixel.height) && + isEmpty(pixel.x+1,pixel.y-1-pixel.height) && + isEmpty(pixel.x-1,pixel.y-1-pixel.height) && + isEmpty(pixel.x,pixel.y-1-pixel.height) && + isEmpty(pixel.x,pixel.y-pixel.height)) { + createPixel("glass",pixel.x+1,pixel.y-pixel.height); + createPixel("glass",pixel.x-1,pixel.y-pixel.height); + createPixel("concrete",pixel.x+2,pixel.y-pixel.height); + createPixel("concrete",pixel.x-2,pixel.y-pixel.height); + createPixel("concrete",pixel.x+1,pixel.y-1-pixel.height); + createPixel("concrete",pixel.x-1,pixel.y-1-pixel.height); + createPixel("concrete",pixel.x+2,pixel.y-1-pixel.height); + createPixel("concrete",pixel.x-2,pixel.y-1-pixel.height); + createPixel("concrete",pixel.x,pixel.y-1-pixel.height); + createPixel("concrete",pixel.x,pixel.y-pixel.height); + pixel.height = pixel.height+2 + } + } +} +function filldirt2x5() { + var dirtPixelElem = pixelMap[pixel.x][pixel.y+1]; + if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { + dirtPixelElem = pixelMap[pixel.x][pixel.y+1].element + } + if (isEmpty(pixel.x+1,pixel.y+1)) { + createPixel(dirtPixelElem,pixel.x+1,pixel.y+1); + } + if (isEmpty(pixel.x-1,pixel.y+1)) { + createPixel(dirtPixelElem,pixel.x-1,pixel.y+1); + } + if (isEmpty(pixel.x+2,pixel.y+1)) { + createPixel(dirtPixelElem,pixel.x+2,pixel.y+1); + } + if (isEmpty(pixel.x-2,pixel.y+1)) { + createPixel(dirtPixelElem,pixel.x-2,pixel.y+1); + } + if (isEmpty(pixel.x+2,pixel.y+2)) { + createPixel(dirtPixelElem,pixel.x+2,pixel.y+2); + } + if (isEmpty(pixel.x-2,pixel.y+2)) { + createPixel(dirtPixelElem,pixel.x-2,pixel.y+2); + } +} +elements.building_1 = { + color: "#a78d38", + tick: function(pixel) { + if (!isEmpty(pixel.x,pixel.y+1)) { + if (isEmpty(pixel.x+1,pixel.y) && + isEmpty(pixel.x-1,pixel.y) && + isEmpty(pixel.x+2,pixel.y) && + isEmpty(pixel.x-2,pixel.y) && + isEmpty(pixel.x+2,pixel.y-1) && + isEmpty(pixel.x-2,pixel.y-1) && + isEmpty(pixel.x+1,pixel.y-1) && + isEmpty(pixel.x-1,pixel.y-1) && + isEmpty(pixel.x,pixel.y-1) && + isEmpty(pixel.x+2,pixel.y-2) && + isEmpty(pixel.x-2,pixel.y-2) && + isEmpty(pixel.x+1,pixel.y-2) && + isEmpty(pixel.x-1,pixel.y-2) && + isEmpty(pixel.x,pixel.y-2)) { + filldirt2x5(); + movePixel(pixel,pixel.x,pixel.y-1); + createPixel("concrete",pixel.x+1,pixel.y+1); + createPixel("concrete",pixel.x-1,pixel.y+1); + createPixel("concrete",pixel.x+2,pixel.y+1); + createPixel("concrete",pixel.x-2,pixel.y+1); + createPixel("wood",pixel.x,pixel.y+1); + pixel.limit = 10 + Math.floor(Math.random() * 5)*2; + createPixel("concrete",pixel.x+1,pixel.y); + createPixel("concrete",pixel.x-1,pixel.y); + createPixel("concrete",pixel.x+2,pixel.y); + createPixel("concrete",pixel.x-2,pixel.y); + createPixel("concrete",pixel.x+1,pixel.y-1); + createPixel("concrete",pixel.x-1,pixel.y-1); + createPixel("concrete",pixel.x+2,pixel.y-1); + createPixel("concrete",pixel.x-2,pixel.y-1); + createPixel("concrete",pixel.x,pixel.y-1); + pixel.foundation = true; + pixel.height = pixel.height+2 + } + } + if (pixel.foundation == true && pixel.height < pixel.limit) { + building_1_segment(); + } + else if (pixel.foundation == true && pixel.height >= pixel.limit) { + pixel.built = true; + } + if (pixel.built == true) { + changePixel(pixel,"wood"); + } + doDefaults(pixel); + }, + properties: { + height:0, + limit:0, + foundation:false, + built:false + }, + category: "citybuilding", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, + maxSize: 1, + excludeRandom: true, + behavior: behaviors.STURDYPOWDER, +}; +elements.building_1_tall = { + color: "#d9c243", + tick: function(pixel) { + if (!isEmpty(pixel.x,pixel.y+1)) { + if (isEmpty(pixel.x+1,pixel.y) && + isEmpty(pixel.x-1,pixel.y) && + isEmpty(pixel.x+2,pixel.y) && + isEmpty(pixel.x-2,pixel.y) && + isEmpty(pixel.x+2,pixel.y-1) && + isEmpty(pixel.x-2,pixel.y-1) && + isEmpty(pixel.x+1,pixel.y-1) && + isEmpty(pixel.x-1,pixel.y-1) && + isEmpty(pixel.x,pixel.y-1) && + isEmpty(pixel.x+2,pixel.y-2) && + isEmpty(pixel.x-2,pixel.y-2) && + isEmpty(pixel.x+1,pixel.y-2) && + isEmpty(pixel.x-1,pixel.y-2) && + isEmpty(pixel.x,pixel.y-2)) { + filldirt2x5(); + movePixel(pixel,pixel.x,pixel.y-1); + createPixel("concrete",pixel.x+1,pixel.y+1); + createPixel("concrete",pixel.x-1,pixel.y+1); + createPixel("concrete",pixel.x+2,pixel.y+1); + createPixel("concrete",pixel.x-2,pixel.y+1); + createPixel("wood",pixel.x,pixel.y+1); + pixel.limit = 15 + Math.floor(Math.random() * 10)*2; + createPixel("concrete",pixel.x+1,pixel.y); + createPixel("concrete",pixel.x-1,pixel.y); + createPixel("concrete",pixel.x+2,pixel.y); + createPixel("concrete",pixel.x-2,pixel.y); + createPixel("concrete",pixel.x+1,pixel.y-1); + createPixel("concrete",pixel.x-1,pixel.y-1); + createPixel("concrete",pixel.x+2,pixel.y-1); + createPixel("concrete",pixel.x-2,pixel.y-1); + createPixel("concrete",pixel.x,pixel.y-1); + pixel.foundation = true; + pixel.height = pixel.height+2 + } + } + if (pixel.foundation == true && pixel.height < pixel.limit) { + building_1_segment(); + } + else if (pixel.foundation == true && pixel.height >= pixel.limit) { + pixel.built = true; + } + if (pixel.built == true) { + changePixel(pixel,"wood"); + } + doDefaults(pixel); + }, + properties: { + height:0, + limit:0, + foundation:false, + built:false + }, + category: "citybuilding", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, + maxSize: 1, + excludeRandom: true, + behavior: behaviors.STURDYPOWDER, +}; +elements.small_tree_1 = { + color: "#4bd943", + tick: function(pixel) { + if (!isEmpty(pixel.x,pixel.y+1)) { + if (isEmpty(pixel.x+1,pixel.y-1) && + isEmpty(pixel.x-1,pixel.y-1) && + isEmpty(pixel.x,pixel.y-1) && + isEmpty(pixel.x+1,pixel.y-2) && + isEmpty(pixel.x-1,pixel.y-2) && + isEmpty(pixel.x,pixel.y-2) && + isEmpty(pixel.x+1,pixel.y-3) && + isEmpty(pixel.x-1,pixel.y-3) && + isEmpty(pixel.x,pixel.y-3)) { + createPixel("wood",pixel.x,pixel.y-1); + createPixel("wood",pixel.x,pixel.y-2); + createPixel("plant",pixel.x,pixel.y-3); + createPixel("plant",pixel.x-1,pixel.y-1); + createPixel("plant",pixel.x-1,pixel.y-2); + createPixel("plant",pixel.x-1,pixel.y-3); + createPixel("plant",pixel.x+1,pixel.y-1); + createPixel("plant",pixel.x+1,pixel.y-2); + createPixel("plant",pixel.x+1,pixel.y-3); + changePixel(pixel,"wood"); + } + } + doDefaults(pixel); + }, + category: "citybuilding", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, + maxSize: 1, + excludeRandom: true, + behavior: behaviors.STURDYPOWDER, +}; From be82d4ee7a481ba93dc8d924ab03c7fd2e936c9a Mon Sep 17 00:00:00 2001 From: SquareScreamYT <134925668+SquareScreamYT@users.noreply.github.com> Date: Sun, 17 Mar 2024 16:07:32 +0800 Subject: [PATCH 2/2] mod list --- mod-list.html | 1 + 1 file changed, 1 insertion(+) diff --git a/mod-list.html b/mod-list.html index e4121d69..f5b2b470 100644 --- a/mod-list.html +++ b/mod-list.html @@ -249,6 +249,7 @@