diff --git a/House.py b/House.py index 58b1da9..122ec00 100644 --- a/House.py +++ b/House.py @@ -89,7 +89,7 @@ class House: for _ in range(3): print("Rectangle n°", _ + 1, "en cours de création") - for a in range(100000): + for a in range(10000): if depth > 7: new_depth = np.random.randint(5, depth - 2) elif depth == 7: @@ -146,7 +146,7 @@ class House: self.skeleton.append((new_x, new_z, new_width, new_depth, height)) break else: - print("Failed to place rectangle after 1000 attempts.") + print("Failed to place rectangle after 100000 attempts.") def delete(self): for x in range(self.coordinates_min[0], self.coordinates_max[0]): @@ -260,7 +260,7 @@ class House: n = 3 else: - if width < depth: + if width > depth: n = width // 4 else: n = depth // 4 @@ -269,37 +269,39 @@ class House: z_plan3d = z - self.coordinates_min[2] print(width, depth, n) - + if width < depth: - if n > 1: - for k in range(n - 1): + if n > 1 : + for k in range(n): for i in range(-1, depth + 1): - for y in range(-1, width // 2 + 1): - self.editor.placeBlock((x + i, self.coordinates_max[1] + k, z + y + k + 3), self.roof) - self.editor.placeBlock((x + i, self.coordinates_max[1] + k, z + depth - y - 4 - k), - self.roof) + for y in range(-1, width // 2 + 1 - k): + self.editor.placeBlock((x + y + k + 2, self.coordinates_max[1] + k , z + i), self.roof) + self.editor.placeBlock((x + width - y - 1 - k - 2, self.coordinates_max[1] + k, z + i), self.roof) + else: if width % 2 == 0: for i in range(-1, depth + 1): - self.editor.placeBlock((x + width // 2 + 1, self.coordinates_max[1] + n - 1, z + i), - self.roof) - for i in range(-1, depth + 1): - self.editor.placeBlock((x + width // 2, self.coordinates_max[1] + n - 1, z + i), self.roof) - + for y in range(2): + self.editor.placeBlock((x+ width//2 -1 + y, self.coordinates_max[1] + n -1, z + i), self.roof) + else: + for i in range(-1, depth + 1): + self.editor.placeBlock((x + width // 2, self.coordinates_max[1] + n - 1, z + i), self.roof) else: if n > 1: - for k in range(n - 1): + for k in range(n ): for i in range(-1, width + 1): - for y in range(-1, depth // 2 + 1): - self.editor.placeBlock((x + i, self.coordinates_max[1] + k, z + y + k + 2), self.roof) - self.editor.placeBlock((x + i, self.coordinates_max[1] + k, z + depth - y - 3 - k), - self.roof) - if depth % 2 == 0: - for i in range(-1, width + 1): - self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + depth // 2 + 1), self.roof) - for i in range(-1, width + 1): - self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + depth // 2), self.roof) - + for y in range(-1, depth // 2 + 1 - k): + self.editor.placeBlock((x + i, self.coordinates_max[1] + k, z + y + k + 2 ), self.roof) + self.editor.placeBlock((x + i, self.coordinates_max[1] + k, z + depth - y -1- k - 2),self.roof) + else: + if depth % 2 == 0: + for i in range(-1, width + 1): + for y in range(2): + self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + depth // 2 -1 +y ), self.roof) + else: + for i in range(-1, width + 1): + self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + depth // 2), self.roof) + print('-----------------------------------') for i in range(-1, width + 1): @@ -363,35 +365,35 @@ class House: for j in range(-1, depth + 1): if i != -1: if h % 1 == 0: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j), Block(self.blocks["roof_slab"], {"type": "top"})) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j), + self.editor.placeBlock((x + width - 1 - i,math.ceil(self.coordinates_max[1] + h), z + j), Block(self.blocks["roof_slab"], {"type": "top"})) self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j] = True self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j] = True if j == -1: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j - 1), + self.editor.placeBlock((x + i,math.ceil(self.coordinates_max[1] + h), z + j - 1), self.celling) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j - 1), + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h), z + j - 1), self.celling) self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j - 1] = True self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j - 1] = True elif j == depth: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j + 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j + 1), self.celling) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j + 1), + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h), z + j + 1), self.celling) self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j + 1] = True self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j + 1] = True else: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j), Block(self.blocks["roof_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j), + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h), z + j), Block(self.blocks["roof_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + i, self.coordinates_max[1] + h - 0.5, z + j), self.roof) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h - 0.5, z + j), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h-0.5), z + j), self.roof) + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h-0.5), z + j), self.roof) self.grid3d[x_plan3d + i, round(height + h + 0.5), z_plan3d + j] = True @@ -400,14 +402,14 @@ class House: self.grid3d[x_plan3d + width - 1 - i, round(height + h - 0.5), z_plan3d + j] = True if j == -1: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j - 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j - 1), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j - 1), + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h), z + j - 1), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + i, self.coordinates_max[1] + h - 1, z + j - 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h-1), z + j - 1), Block(self.blocks["celling_slab"], {"type": "top"})) self.editor.placeBlock( - (x + width - 1 - i, self.coordinates_max[1] + h - 1, z + j - 1), + (x + width - 1 - i, math.ceil(self.coordinates_max[1] + h-1), z + j - 1), Block(self.blocks["celling_slab"], {"type": "top"})) self.grid3d[x_plan3d + i, round(height + h - 1), z_plan3d + j - 1] = True @@ -416,14 +418,14 @@ class House: self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j - 1] = True self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j - 1] = True elif j == depth: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j + 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j + 1), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j + 1), + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h), z + j + 1), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + i, self.coordinates_max[1] + h - 1, z + j + 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h-1), z + j + 1), Block(self.blocks["celling_slab"], {"type": "top"})) self.editor.placeBlock( - (x + width - 1 - i, self.coordinates_max[1] + h - 1, z + j + 1), + (x + width - 1 - i, math.ceil(self.coordinates_max[1] + h-1), z + j + 1), Block(self.blocks["celling_slab"], {"type": "top"})) self.grid3d[x_plan3d + i, round(height + h - 1), z_plan3d + j + 1] = True @@ -432,43 +434,43 @@ class House: self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j + 1] = True self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j + 1] = True else: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j), Block(self.blocks["roof_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j), + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h), z + j), Block(self.blocks["roof_slab"], {"type": "bottom"})) self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j] = True self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j] = True if j == -1: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j - 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j - 1), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j - 1), + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h), z + j - 1), Block(self.blocks["celling_slab"], {"type": "bottom"})) if not self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j - 1]: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h - 1, z + j - 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h-1), z + j - 1), Block(self.blocks["celling_slab"], {"type": "top"})) self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j - 1] = True if not self.grid3d[x_plan3d + width - 1 - i, height + h - 1, z_plan3d + j - 1]: self.editor.placeBlock( - (x + width - 1 - i, self.coordinates_max[1] + h - 1, z + j - 1), + (x + width - 1 - i, math.ceil(self.coordinates_max[1] + h-1), z + j - 1), Block(self.blocks["celling_slab"], {"type": "top"})) self.grid3d[x_plan3d + width - 1 - i, height + h - 1, z_plan3d + j - 1] = True self.grid3d[x_plan3d + i, round(height + h - 1), z_plan3d + j - 1] = True self.grid3d[x_plan3d + width - 1 - i, round(height + h - 1), z_plan3d + j - 1] = True elif j == depth: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h, z + j + 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j + 1), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + width - 1 - i, self.coordinates_max[1] + h, z + j + 1), + self.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h), z + j + 1), Block(self.blocks["celling_slab"], {"type": "bottom"})) if not self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j + 1]: - self.editor.placeBlock((x + i, self.coordinates_max[1] + h - 1, z + j + 1), + self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h-1), z + j + 1), Block(self.blocks["celling_slab"], {"type": "top"})) self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j + 1] = True if not self.grid3d[x_plan3d + width - 1 - i, height + h - 1, z_plan3d + j + 1]: self.editor.placeBlock( - (x + width - 1 - i, self.coordinates_max[1] + h - 1, z + j + 1), + (x + width - 1 - i, math.ceil(self.coordinates_max[1] + h-1), z + j + 1), Block(self.blocks["celling_slab"], {"type": "top"})) self.grid3d[x_plan3d + width - 1 - i, height + h - 1, z_plan3d + j + 1] = True @@ -483,125 +485,125 @@ class House: for j in range(-1, width + 1): if i != -1: if h % 1 == 0: - self.editor.placeBlock((x + j, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j, math.ceil(self.coordinates_max[1] + h), z + i), Block(self.blocks["roof_slab"], {"type": "top"})) - self.editor.placeBlock((x + j, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), Block(self.blocks["roof_slab"], {"type": "top"})) self.grid3d[x_plan3d + j, round(height + h), z_plan3d + i] = True self.grid3d[x_plan3d + j, round(height + h), z_plan3d + depth - 1 - i] = True if j == -1: - self.editor.placeBlock((x + j - 1, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i), self.celling) - self.editor.placeBlock((x + j - 1, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), self.celling) self.grid3d[x_plan3d + j - 1, round(height + h), z_plan3d + i] = True self.grid3d[x_plan3d + j - 1, round(height + h), z_plan3d + depth - 1 - i] = True elif j == width: - self.editor.placeBlock((x + j + 1, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h), z + i), self.celling) - self.editor.placeBlock((x + j + 1, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), self.celling) self.grid3d[x_plan3d + j + 1, round(height + h), z_plan3d + i] = True self.grid3d[x_plan3d + j + 1, round(height + h), z_plan3d + depth - 1 - i] = True else: - self.editor.placeBlock((x + j, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j, math.ceil(self.coordinates_max[1] + h), z + i), Block(self.blocks["roof_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), Block(self.blocks["roof_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j, self.coordinates_max[1] + h - 0.5, z + i), self.roof) - self.editor.placeBlock((x + j, self.coordinates_max[1] + h - 0.5, z + depth - 1 - i), + self.editor.placeBlock((x + j, math.ceil(self.coordinates_max[1] + h - 0.5), z + i), self.roof) + self.editor.placeBlock((x + j, math.ceil(self.coordinates_max[1] + h - 0.5), z + depth - 1 - i), self.roof) - self.grid3d[j, round(height + h + 0.5), i] = True - self.grid3d[j, round(height + h + 0.5), depth - 1 - i] = True - self.grid3d[j, round(height + h - 0.5), i] = True - self.grid3d[j, round(height + h - 0.5), depth - 1 - i] = True + self.grid3d[x_plan3d+j, round(height + h + 0.5),z_plan3d+ i] = True + self.grid3d[x_plan3d+j, round(height + h + 0.5),z_plan3d+ depth - 1 - i] = True + self.grid3d[x_plan3d+j, round(height + h - 0.5),z_plan3d+ i] = True + self.grid3d[x_plan3d+j, round(height + h - 0.5), z_plan3d+depth - 1 - i] = True if j == -1: - self.editor.placeBlock((x + j - 1, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j - 1, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j - 1, self.coordinates_max[1] + h - 1, z + i), + self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h - 1), z + i), Block(self.blocks["celling_slab"], {"type": "top"})) self.editor.placeBlock( - (x + j - 1, self.coordinates_max[1] + h - 1, z + depth - 1 - i), + (x + j - 1, math.ceil(self.coordinates_max[1] + h-1), z + depth - 1 - i), Block(self.blocks["celling_slab"], {"type": "top"})) - self.grid3d[j, round(height + h), i] = True - self.grid3d[j, round(height + h), depth - 1 - i] = True - self.grid3d[j, round(height + h - 1), i] = True - self.grid3d[j, round(height + h - 1), depth - 1 - i] = True + self.grid3d[x_plan3d+j-1, round(height + h),z_plan3d+ i] = True + self.grid3d[x_plan3d+j-1, round(height + h), z_plan3d+depth - 1 - i] = True + self.grid3d[x_plan3d+j-1, round(height + h - 1),z_plan3d+ i] = True + self.grid3d[x_plan3d+j-1, round(height + h - 1), z_plan3d+depth - 1 - i] = True elif j == width: - self.editor.placeBlock((x + j + 1, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h), z + i), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j + 1, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j + 1, self.coordinates_max[1] + h - 1, z + i), + self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h-1), z + i), Block(self.blocks["celling_slab"], {"type": "top"})) self.editor.placeBlock( - (x + j + 1, self.coordinates_max[1] + h - 1, z + depth - 1 - i), + (x + j + 1, math.ceil(self.coordinates_max[1] + h-1), z + depth - 1 - i), Block(self.blocks["celling_slab"], {"type": "top"})) - self.grid3d[j, round(height + h), i] = True - self.grid3d[j, round(height + h), depth - 1 - i] = True - self.grid3d[j, round(height + h - 1), i] = True - self.grid3d[j, round(height + h - 1), depth - 1 - i] = True + self.grid3d[x_plan3d+j+1, round(height + h),z_plan3d+ i] = True + self.grid3d[x_plan3d+j+1, round(height + h),z_plan3d+ depth - 1 - i] = True + self.grid3d[x_plan3d+j+1, round(height + h - 1), z_plan3d+i] = True + self.grid3d[x_plan3d+j+1, round(height + h - 1),z_plan3d+ depth - 1 - i] = True else: - self.editor.placeBlock((x + j, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j, math.ceil(self.coordinates_max[1] + h), z + i), Block(self.blocks["roof_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), Block(self.blocks["roof_slab"], {"type": "bottom"})) - self.grid3d[j, round(height + h), i] = True - self.grid3d[j, round(height + h), depth - 1 - i] = True + self.grid3d[x_plan3d+j, round(height + h), z_plan3d+i] = True + self.grid3d[x_plan3d+j, round(height + h), z_plan3d+depth - 1 - i] = True if j == -1: - self.editor.placeBlock((x + j - 1, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j - 1, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), Block(self.blocks["celling_slab"], {"type": "bottom"})) - if not self.grid3d[j, height + h - 1, i]: - self.editor.placeBlock((x + j - 1, self.coordinates_max[1] + h - 1, z + i), + if not self.grid3d[x_plan3d+j-1, height + h - 1, z_plan3d+i]: + self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h-1) , z + i), Block(self.blocks["celling_slab"], {"type": "top"})) - self.grid3d[j, height + h - 1, i] = True - if not self.grid3d[j, height + h - 1, depth - 1 - i]: + self.grid3d[x_plan3d+j-1, height + h - 1, z_plan3d+i] = True + if not self.grid3d[x_plan3d+j-1, height + h - 1, z_plan3d+depth - 1 - i]: self.editor.placeBlock( - (x + j - 1, self.coordinates_max[1] + h - 1, z + depth - 1 - i), + (x + j - 1, math.ceil(self.coordinates_max[1] + h-1) , z + depth - 1 - i), Block(self.blocks["celling_slab"], {"type": "top"})) - self.grid3d[j, height + h - 1, depth - 1 - i] = True + self.grid3d[x_plan3d+j-1, height + h - 1, z_plan3d+depth - 1 - i] = True - self.grid3d[j, round(height + h), i] = True - self.grid3d[j, round(height + h), depth - 1 - i] = True + self.grid3d[x_plan3d+j-1, round(height + h), z_plan3d+i] = True + self.grid3d[x_plan3d+j-1, round(height + h),z_plan3d+ depth - 1 - i] = True elif j == width: - self.editor.placeBlock((x + j + 1, self.coordinates_max[1] + h, z + i), + self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h), z + i), Block(self.blocks["celling_slab"], {"type": "bottom"})) - self.editor.placeBlock((x + j + 1, self.coordinates_max[1] + h, z + depth - 1 - i), + self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h), z + depth - 1 - i), Block(self.blocks["celling_slab"], {"type": "bottom"})) - if not self.grid3d[j, height + h - 1, i]: - self.editor.placeBlock((x + j + 1, self.coordinates_max[1] + h - 1, z + i), + if not self.grid3d[x_plan3d+j+1, height + h - 1,z_plan3d+ i]: + self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h-1), z + i), Block(self.blocks["celling_slab"], {"type": "top"})) - self.grid3d[j, height + h - 1, i] = True - if not self.grid3d[j, height + h - 1, depth - 1 - i]: + self.grid3d[x_plan3d+j+1, height + h - 1, z_plan3d+i] = True + if not self.grid3d[x_plan3d+j+1, height + h - 1,z_plan3d+ depth - 1 - i]: self.editor.placeBlock( - (x + j + 1, self.coordinates_max[1] + h - 1, z + depth - 1 - i), + (x + j + 1, math.ceil(self.coordinates_max[1] + h-1), z + depth - 1 - i), Block(self.blocks["celling_slab"], {"type": "top"})) - self.grid3d[j, height + h - 1, depth - 1 - i] = True + self.grid3d[x_plan3d+j+1, height + h - 1,z_plan3d+ depth - 1 - i] = True - self.grid3d[j, round(height + h), i] = True - self.grid3d[j, round(height + h), depth - 1 - i] = True + self.grid3d[x_plan3d+j+1, round(height + h), z_plan3d+i] = True + self.grid3d[x_plan3d+j+1, round(height + h), z_plan3d+depth - 1 - i] = True - self.grid3d[j, round(height + h), i] = True - self.grid3d[j, round(height + h), depth - 1 - i] = True + self.grid3d[x_plan3d+j, round(height + h), z_plan3d+i] = True + self.grid3d[x_plan3d+j, round(height + h),z_plan3d+ depth - 1 - i] = True if i != -1: h += 0.5 - + QUARTZ_SLAB = Block(self.blocks["celling_slab"], {"type": "top"}) for i in range(-2, width + 2): @@ -615,7 +617,7 @@ class House: else: if j == -2 or j == depth + 1: self.editor.placeBlock((x + i, self.coordinates_max[1] - 1, z + j), QUARTZ_SLAB) - + def putCelling(self): for k in range(0, len(self.skeleton)): x, z, width, depth, height = self.skeleton[k] @@ -790,7 +792,7 @@ class House: def placeEntrance(self): wall = self.WallFacingDirection() - print(wall) + self.entranceWall = wall match self.direction: case "W": @@ -1069,8 +1071,7 @@ class House: self.editor.placeBlock((i, y_min, y), self.gardenOutline) self.editor.placeBlock((i, y_min + 1, y), self.gardenOutline) self.editor.placeBlock((i, y_min + 2, y), self.gardenOutline) - else: - print(i, y) + case _: self.editor.placeBlock((i, y_min - 1, y), self.garden_floor) @@ -1118,8 +1119,8 @@ if __name__ == "__main__": house.build() - new_coordinates_min = (coordinates_max[0] + 10, coordinates_min[1], coordinates_min[2]) - new_coordinates_max = (coordinates_max[0] + 10 + 24, coordinates_max[1], coordinates_max[2]) + new_coordinates_min = (coordinates_max[0] + 20, coordinates_min[1], coordinates_min[2]) + new_coordinates_max = (coordinates_max[0] + 10 + 40, coordinates_max[1], coordinates_max[2]) coordinates_min = new_coordinates_min coordinates_max = new_coordinates_max diff --git a/main.py b/main.py index 4ae2e10..1d66450 100644 --- a/main.py +++ b/main.py @@ -20,7 +20,7 @@ def main(): origin = ((buildArea.begin).x, (buildArea.begin).z) remove_trees('./world_maker/data/heightmap.png', './world_maker/data/treemap.png', - './world_maker/data/smooth_sobel_watermap.png') + './world_maker/data/smooth_sobel_watermap.png') smooth_terrain('./world_maker/data/heightmap.png', './world_maker/data/heightmap_smooth.png', './world_maker/data/smooth_sobel_watermap.png') diff --git a/world_maker/data/building.png b/world_maker/data/building.png index 6616794..b79335c 100644 Binary files a/world_maker/data/building.png and b/world_maker/data/building.png differ diff --git a/world_maker/data/building_moutain.png b/world_maker/data/building_moutain.png index fd47f44..e616392 100644 Binary files a/world_maker/data/building_moutain.png and b/world_maker/data/building_moutain.png differ diff --git a/world_maker/data/city_map.png b/world_maker/data/city_map.png index b8cf5d9..b79335c 100644 Binary files a/world_maker/data/city_map.png and b/world_maker/data/city_map.png differ diff --git a/world_maker/data/district.png b/world_maker/data/district.png index 8ee6ca2..fdd0103 100644 Binary files a/world_maker/data/district.png and b/world_maker/data/district.png differ diff --git a/world_maker/data/heightmap.png b/world_maker/data/heightmap.png index 257bcc1..7d3efaf 100644 Binary files a/world_maker/data/heightmap.png and b/world_maker/data/heightmap.png differ diff --git a/world_maker/data/heightmap_smooth.png b/world_maker/data/heightmap_smooth.png index 19283fe..44cf7d8 100644 Binary files a/world_maker/data/heightmap_smooth.png and b/world_maker/data/heightmap_smooth.png differ diff --git a/world_maker/data/heightmap_with_building.png b/world_maker/data/heightmap_with_building.png index 246d2dc..79a1d1a 100644 Binary files a/world_maker/data/heightmap_with_building.png and b/world_maker/data/heightmap_with_building.png differ diff --git a/world_maker/data/highwaymap.png b/world_maker/data/highwaymap.png index eb85922..dd04588 100644 Binary files a/world_maker/data/highwaymap.png and b/world_maker/data/highwaymap.png differ diff --git a/world_maker/data/mountain_map.png b/world_maker/data/mountain_map.png index 9089607..b64e7b5 100644 Binary files a/world_maker/data/mountain_map.png and b/world_maker/data/mountain_map.png differ diff --git a/world_maker/data/removed_treesmap.png b/world_maker/data/removed_treesmap.png index e05cb90..b79335c 100644 Binary files a/world_maker/data/removed_treesmap.png and b/world_maker/data/removed_treesmap.png differ diff --git a/world_maker/data/roadmap.png b/world_maker/data/roadmap.png index 20938aa..a7991e3 100644 Binary files a/world_maker/data/roadmap.png and b/world_maker/data/roadmap.png differ diff --git a/world_maker/data/skeleton_highway.png b/world_maker/data/skeleton_highway.png index 66aaf17..db79877 100644 Binary files a/world_maker/data/skeleton_highway.png and b/world_maker/data/skeleton_highway.png differ diff --git a/world_maker/data/skeleton_highway_area.png b/world_maker/data/skeleton_highway_area.png index 6a84a6e..b79335c 100644 Binary files a/world_maker/data/skeleton_highway_area.png and b/world_maker/data/skeleton_highway_area.png differ diff --git a/world_maker/data/skeleton_mountain.png b/world_maker/data/skeleton_mountain.png index 32f14b5..db79877 100644 Binary files a/world_maker/data/skeleton_mountain.png and b/world_maker/data/skeleton_mountain.png differ diff --git a/world_maker/data/skeleton_mountain_area.png b/world_maker/data/skeleton_mountain_area.png index 2db1e91..b79335c 100644 Binary files a/world_maker/data/skeleton_mountain_area.png and b/world_maker/data/skeleton_mountain_area.png differ diff --git a/world_maker/data/smooth_sobel_watermap.png b/world_maker/data/smooth_sobel_watermap.png index 6db72aa..b64e7b5 100644 Binary files a/world_maker/data/smooth_sobel_watermap.png and b/world_maker/data/smooth_sobel_watermap.png differ diff --git a/world_maker/data/smooth_terrain_delta.png b/world_maker/data/smooth_terrain_delta.png index 44423f8..87fbab4 100644 Binary files a/world_maker/data/smooth_terrain_delta.png and b/world_maker/data/smooth_terrain_delta.png differ diff --git a/world_maker/data/sobelmap.png b/world_maker/data/sobelmap.png index f29c052..c157dea 100644 Binary files a/world_maker/data/sobelmap.png and b/world_maker/data/sobelmap.png differ diff --git a/world_maker/data/treemap.png b/world_maker/data/treemap.png index 255bf88..4190e96 100644 Binary files a/world_maker/data/treemap.png and b/world_maker/data/treemap.png differ