Update citybuilding.js

This commit is contained in:
slweeb 2024-08-04 15:15:43 -04:00
parent 03aa582e1d
commit 75ff2c8342
1 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
// created by sqec // created by sqec
// coming soon: apartments, small houses // coming soon: apartments, small houses
function building_1_segment() { function building_1_segment(pixel) {
if (pixel.foundation = true && pixel.height < pixel.limit) { if (pixel.foundation = true && pixel.height < pixel.limit) {
if (isEmpty(pixel.x+1,pixel.y-pixel.height) && if (isEmpty(pixel.x+1,pixel.y-pixel.height) &&
isEmpty(pixel.x-1,pixel.y-pixel.height) && isEmpty(pixel.x-1,pixel.y-pixel.height) &&
@ -27,7 +27,7 @@ function building_1_segment() {
} }
} }
} }
function clearbase3x5() { function clearbase3x5(pixel) {
if (pixel.clearbase = false && pixel.height < pixel.limit) { if (pixel.clearbase = false && pixel.height < pixel.limit) {
pixel.clearbase = true pixel.clearbase = true
deletePixel(pixel.x-1,pixel.y) deletePixel(pixel.x-1,pixel.y)
@ -46,7 +46,7 @@ function clearbase3x5() {
deletePixel(pixel.x+2,pixel.y-2) deletePixel(pixel.x+2,pixel.y-2)
} }
} }
function filldirt2x5() { function filldirt2x5(pixel) {
var dirtPixelElem = pixelMap[pixel.x][pixel.y+1]; var dirtPixelElem = pixelMap[pixel.x][pixel.y+1];
if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(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 dirtPixelElem = pixelMap[pixel.x][pixel.y+1].element
@ -83,7 +83,7 @@ elements.building_1 = {
color: "#ffc800", color: "#ffc800",
tick: function(pixel) { tick: function(pixel) {
if (!isEmpty(pixel.x,pixel.y+1)) { if (!isEmpty(pixel.x,pixel.y+1)) {
clearbase3x5(); clearbase3x5(pixel);
if (isEmpty(pixel.x+1,pixel.y) && if (isEmpty(pixel.x+1,pixel.y) &&
isEmpty(pixel.x-1,pixel.y) && isEmpty(pixel.x-1,pixel.y) &&
isEmpty(pixel.x+2,pixel.y) && isEmpty(pixel.x+2,pixel.y) &&
@ -98,7 +98,7 @@ elements.building_1 = {
isEmpty(pixel.x+1,pixel.y-2) && isEmpty(pixel.x+1,pixel.y-2) &&
isEmpty(pixel.x-1,pixel.y-2) && isEmpty(pixel.x-1,pixel.y-2) &&
isEmpty(pixel.x,pixel.y-2)) { isEmpty(pixel.x,pixel.y-2)) {
filldirt2x5(); filldirt2x5(pixel);
movePixel(pixel,pixel.x,pixel.y-1); 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-1,pixel.y+1); createPixel("concrete",pixel.x-1,pixel.y+1);
@ -120,7 +120,7 @@ elements.building_1 = {
} }
} }
if (pixel.foundation == true && pixel.height < pixel.limit) { if (pixel.foundation == true && pixel.height < pixel.limit) {
building_1_segment(); building_1_segment(pixel);
} }
else if (pixel.foundation == true && pixel.height >= pixel.limit) { else if (pixel.foundation == true && pixel.height >= pixel.limit) {
pixel.built = true; pixel.built = true;