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 @@ all_around_fillers.jsAdds directional Filler variantsidk73248 allliquids.jsMade all elements liquidsAdora amogus.jsAdds a small amogus structureAlice +citybuilding.jsAdds seeds that create miniature buildings and other city-related itemsSquareScreamYT collab_mod.jsCreated by multiple people, adds random thingsmrapple, ilikepizza, stefanblox elem3.jsAdds all elements and combinations from Elemental 3 [Very Large]Sophie funny elements 2022-11-15.jsAdds a few curated randomly-generated elementsAlice 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, +};