Fix reverse coordinates
499
House.py
@@ -105,14 +105,18 @@ class House:
|
|||||||
new_width = np.random.randint(width - 2, 5)
|
new_width = np.random.randint(width - 2, 5)
|
||||||
|
|
||||||
if max(x_min+1, x-new_width) > min(x_max-new_width-1, x+width):
|
if max(x_min+1, x-new_width) > min(x_max-new_width-1, x+width):
|
||||||
new_x = np.random.randint(min(x_max - new_width - 1, x + width), max(x_min + 1, x - new_width))
|
new_x = np.random.randint(
|
||||||
|
min(x_max - new_width - 1, x + width), max(x_min + 1, x - new_width))
|
||||||
else:
|
else:
|
||||||
new_x = np.random.randint(max(x_min + 1, x - new_width), min(x_max - new_width - 1, x + width))
|
new_x = np.random.randint(
|
||||||
|
max(x_min + 1, x - new_width), min(x_max - new_width - 1, x + width))
|
||||||
|
|
||||||
if max(z_min+1, z-new_depth) > min(z_max-new_depth-1, z+depth):
|
if max(z_min+1, z-new_depth) > min(z_max-new_depth-1, z+depth):
|
||||||
new_z = np.random.randint(min(z_max - new_depth - 1, z + depth), max(z_min + 1, z - new_depth))
|
new_z = np.random.randint(
|
||||||
|
min(z_max - new_depth - 1, z + depth), max(z_min + 1, z - new_depth))
|
||||||
else:
|
else:
|
||||||
new_z = np.random.randint(max(z_min + 1, z - new_depth), min(z_max - new_depth - 1, z + depth))
|
new_z = np.random.randint(
|
||||||
|
max(z_min + 1, z - new_depth), min(z_max - new_depth - 1, z + depth))
|
||||||
|
|
||||||
new_x_plan3d = new_x - x_min - 1
|
new_x_plan3d = new_x - x_min - 1
|
||||||
new_z_plan3d = new_z - z_min + 1
|
new_z_plan3d = new_z - z_min + 1
|
||||||
@@ -136,23 +140,24 @@ class House:
|
|||||||
new_z_plan3d = new_z - z_min
|
new_z_plan3d = new_z - z_min
|
||||||
for i in range(0, new_width):
|
for i in range(0, new_width):
|
||||||
for j in range(0, new_depth):
|
for j in range(0, new_depth):
|
||||||
self.grid3d[new_x_plan3d + i, 0, new_z_plan3d + j] = True, 2
|
self.grid3d[new_x_plan3d + i, 0,
|
||||||
|
new_z_plan3d + j] = True, 2
|
||||||
|
|
||||||
if i == 0 or i == new_width - 1 or j == 0 or j == new_depth - 1:
|
if i == 0 or i == new_width - 1 or j == 0 or j == new_depth - 1:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((new_x + i, y_min, new_z + j), self.floor)
|
self.editor.placeBlock(
|
||||||
|
(new_x + i, y_min, new_z + j), self.floor)
|
||||||
|
|
||||||
self.skeleton.append((new_x, new_z, new_width, new_depth, height))
|
self.skeleton.append(
|
||||||
|
(new_x, new_z, new_width, new_depth, height))
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("Failed to place rectangle after 100000 attempts.")
|
print("Failed to place rectangle after 100000 attempts.")
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
for x in range(self.coordinates_min[0], self.coordinates_max[0]):
|
geometry.placeCuboid(self.editor, self.coordinates_min,
|
||||||
for y in range(self.coordinates_min[1], self.coordinates_max[1] + 10):
|
self.coordinates_max, Block("air"))
|
||||||
for z in range(self.coordinates_min[2], self.coordinates_max[2]):
|
|
||||||
self.editor.placeBlock((x, y, z), Block("air"))
|
|
||||||
|
|
||||||
def putWallOnSkeleton(self):
|
def putWallOnSkeleton(self):
|
||||||
for k in range(len(self.skeleton)):
|
for k in range(len(self.skeleton)):
|
||||||
@@ -173,8 +178,10 @@ class House:
|
|||||||
self.grid3d[x_plan3d + i, y, z_plan3d + j]['int'] == 1) or (
|
self.grid3d[x_plan3d + i, y, z_plan3d + j]['int'] == 1) or (
|
||||||
self.grid3d[x_plan3d + i, y, z_plan3d + j]['bool'] and
|
self.grid3d[x_plan3d + i, y, z_plan3d + j]['bool'] and
|
||||||
self.grid3d[x_plan3d + i, y, z_plan3d + j]['int'] == 2) or y == 0:
|
self.grid3d[x_plan3d + i, y, z_plan3d + j]['int'] == 2) or y == 0:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_min[1] + y, z + j), self.wall)
|
self.editor.placeBlock(
|
||||||
self.grid3d[x_plan3d + i, y, z_plan3d + j] = True
|
(x + i, self.coordinates_min[1] + y, z + j), self.wall)
|
||||||
|
self.grid3d[x_plan3d + i,
|
||||||
|
y, z_plan3d + j] = True
|
||||||
|
|
||||||
def getAdjacentWalls(self):
|
def getAdjacentWalls(self):
|
||||||
|
|
||||||
@@ -216,24 +223,30 @@ class House:
|
|||||||
if width % 2 != 0:
|
if width % 2 != 0:
|
||||||
door_pos = width // 2
|
door_pos = width // 2
|
||||||
for y in range(self.coordinates_min[1] + 1 + i * 4, self.coordinates_min[1] + 3 + i * 4):
|
for y in range(self.coordinates_min[1] + 1 + i * 4, self.coordinates_min[1] + 3 + i * 4):
|
||||||
self.editor.placeBlock((x_min, y, z_min + door_pos), Block("air"))
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((x_min, y, z_min + door_pos + 1), Block("air"))
|
(x_min, y, z_min + door_pos), Block("air"))
|
||||||
|
self.editor.placeBlock(
|
||||||
|
(x_min, y, z_min + door_pos + 1), Block("air"))
|
||||||
else:
|
else:
|
||||||
door_pos = width // 2
|
door_pos = width // 2
|
||||||
for y in range(self.coordinates_min[1] + 1 + i * 4, self.coordinates_min[1] + 3 + i * 4):
|
for y in range(self.coordinates_min[1] + 1 + i * 4, self.coordinates_min[1] + 3 + i * 4):
|
||||||
self.editor.placeBlock((x_min, y, z_min + door_pos), Block("air"))
|
self.editor.placeBlock(
|
||||||
|
(x_min, y, z_min + door_pos), Block("air"))
|
||||||
else:
|
else:
|
||||||
width = x_max - x_min
|
width = x_max - x_min
|
||||||
if width % 2 != 0:
|
if width % 2 != 0:
|
||||||
door_pos = width // 2
|
door_pos = width // 2
|
||||||
for y in range(self.coordinates_min[1] + 1 + i * 4, self.coordinates_min[1] + 3 + i * 4):
|
for y in range(self.coordinates_min[1] + 1 + i * 4, self.coordinates_min[1] + 3 + i * 4):
|
||||||
self.editor.placeBlock((x_min + door_pos, y, z_min), Block("air"))
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((x_min + door_pos + 1, y, z_min), Block("air"))
|
(x_min + door_pos, y, z_min), Block("air"))
|
||||||
|
self.editor.placeBlock(
|
||||||
|
(x_min + door_pos + 1, y, z_min), Block("air"))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
door_pos = width // 2
|
door_pos = width // 2
|
||||||
for y in range(self.coordinates_min[1] + 1 + i * 4, self.coordinates_min[1] + 3 + i * 4):
|
for y in range(self.coordinates_min[1] + 1 + i * 4, self.coordinates_min[1] + 3 + i * 4):
|
||||||
self.editor.placeBlock((x_min + door_pos, y, z_min), Block("air"))
|
self.editor.placeBlock(
|
||||||
|
(x_min + door_pos, y, z_min), Block("air"))
|
||||||
|
|
||||||
def placeRoof(self):
|
def placeRoof(self):
|
||||||
for k in range(len(self.skeleton) - 1, -1, -1):
|
for k in range(len(self.skeleton) - 1, -1, -1):
|
||||||
@@ -276,31 +289,39 @@ class House:
|
|||||||
for k in range(n):
|
for k in range(n):
|
||||||
for i in range(-1, depth + 1):
|
for i in range(-1, depth + 1):
|
||||||
for y in range(-1, width // 2 + 1 - k):
|
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(
|
||||||
self.editor.placeBlock((x + width - y - 1 - k - 2, self.coordinates_max[1] + k, z + i), self.roof)
|
(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:
|
else:
|
||||||
if width % 2 == 0:
|
if width % 2 == 0:
|
||||||
for i in range(-1, depth + 1):
|
for i in range(-1, depth + 1):
|
||||||
for y in range(2):
|
for y in range(2):
|
||||||
self.editor.placeBlock((x+ width//2 -1 + y, self.coordinates_max[1] + n -1, z + i), self.roof)
|
self.editor.placeBlock(
|
||||||
|
(x + width//2 - 1 + y, self.coordinates_max[1] + n - 1, z + i), self.roof)
|
||||||
else:
|
else:
|
||||||
for i in range(-1, depth + 1):
|
for i in range(-1, depth + 1):
|
||||||
self.editor.placeBlock((x + width // 2, self.coordinates_max[1] + n - 1, z + i), self.roof)
|
self.editor.placeBlock(
|
||||||
|
(x + width // 2, self.coordinates_max[1] + n - 1, z + i), self.roof)
|
||||||
else:
|
else:
|
||||||
if n > 1:
|
if n > 1:
|
||||||
for k in range(n):
|
for k in range(n):
|
||||||
for i in range(-1, width + 1):
|
for i in range(-1, width + 1):
|
||||||
for y in range(-1, depth // 2 + 1 - k):
|
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(
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + k, z + depth - y -1- k - 2),self.roof)
|
(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:
|
else:
|
||||||
if depth % 2 == 0:
|
if depth % 2 == 0:
|
||||||
for i in range(-1, width + 1):
|
for i in range(-1, width + 1):
|
||||||
for y in range(2):
|
for y in range(2):
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + depth // 2 -1 +y ), self.roof)
|
self.editor.placeBlock(
|
||||||
|
(x + i, self.coordinates_max[1] + n - 1, z + depth // 2 - 1 + y), self.roof)
|
||||||
else:
|
else:
|
||||||
for i in range(-1, width + 1):
|
for i in range(-1, width + 1):
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + depth // 2), self.roof)
|
self.editor.placeBlock(
|
||||||
|
(x + i, self.coordinates_max[1] + n - 1, z + depth // 2), self.roof)
|
||||||
|
|
||||||
print('-----------------------------------')
|
print('-----------------------------------')
|
||||||
|
|
||||||
@@ -311,52 +332,62 @@ class House:
|
|||||||
if (i == width // 2):
|
if (i == width // 2):
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + n, z + j),
|
self.editor.placeBlock((x + i, self.coordinates_max[1] + n, z + j),
|
||||||
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
self.grid3d[x_plan3d + i, height + n, z_plan3d + j] = True
|
self.grid3d[x_plan3d + i,
|
||||||
|
height + n, z_plan3d + j] = True
|
||||||
if j == -1:
|
if j == -1:
|
||||||
if not self.grid3d[x_plan3d + i, height + n, z_plan3d + j - 1]:
|
if not self.grid3d[x_plan3d + i, height + n, z_plan3d + j - 1]:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + n, z + j - 1),
|
self.editor.placeBlock((x + i, self.coordinates_max[1] + n, z + j - 1),
|
||||||
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
||||||
self.grid3d[x_plan3d + i, height + n, z_plan3d + j - 1] = True
|
self.grid3d[x_plan3d + i, height +
|
||||||
|
n, z_plan3d + j - 1] = True
|
||||||
if not self.grid3d[x_plan3d + i, height + n - 1, z_plan3d + j - 1]:
|
if not self.grid3d[x_plan3d + i, height + n - 1, z_plan3d + j - 1]:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + j - 1),
|
self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + j - 1),
|
||||||
Block(self.blocks["celling_slab"], {"type": "top"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d + i, height + n - 1, z_plan3d + j - 1] = True
|
self.grid3d[x_plan3d + i, height +
|
||||||
|
n - 1, z_plan3d + j - 1] = True
|
||||||
|
|
||||||
elif j == depth:
|
elif j == depth:
|
||||||
if not self.grid3d[x_plan3d + i, height + n, z_plan3d + j + 1]:
|
if not self.grid3d[x_plan3d + i, height + n, z_plan3d + j + 1]:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + n, z + j + 1),
|
self.editor.placeBlock((x + i, self.coordinates_max[1] + n, z + j + 1),
|
||||||
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
||||||
self.grid3d[x_plan3d + i, height + n, z_plan3d + j + 1] = True
|
self.grid3d[x_plan3d + i, height +
|
||||||
|
n, z_plan3d + j + 1] = True
|
||||||
if not self.grid3d[x_plan3d + i, height + n - 1, z_plan3d + j + 1]:
|
if not self.grid3d[x_plan3d + i, height + n - 1, z_plan3d + j + 1]:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + j + 1),
|
self.editor.placeBlock((x + i, self.coordinates_max[1] + n - 1, z + j + 1),
|
||||||
Block(self.blocks["celling_slab"], {"type": "top"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d + i, height + n - 1, z_plan3d + j + 1] = True
|
self.grid3d[x_plan3d + i, height +
|
||||||
|
n - 1, z_plan3d + j + 1] = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if depth % 2 != 0:
|
if depth % 2 != 0:
|
||||||
if (j == depth // 2):
|
if (j == depth // 2):
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] + n, z + j),
|
self.editor.placeBlock((x + i, self.coordinates_max[1] + n, z + j),
|
||||||
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
self.grid3d[x_plan3d + i, height + n, z_plan3d + j] = True
|
self.grid3d[x_plan3d + i,
|
||||||
|
height + n, z_plan3d + j] = True
|
||||||
if i == -1:
|
if i == -1:
|
||||||
if not self.grid3d[x_plan3d + i - 1, height + n, z_plan3d + j]:
|
if not self.grid3d[x_plan3d + i - 1, height + n, z_plan3d + j]:
|
||||||
self.editor.placeBlock((x + i - 1, self.coordinates_max[1] + n, z + j),
|
self.editor.placeBlock((x + i - 1, self.coordinates_max[1] + n, z + j),
|
||||||
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
||||||
self.grid3d[x_plan3d + i - 1, height + n, z_plan3d + j] = True
|
self.grid3d[x_plan3d + i - 1,
|
||||||
|
height + n, z_plan3d + j] = True
|
||||||
if not self.grid3d[x_plan3d + i - 1, height + n - 1, z_plan3d + j]:
|
if not self.grid3d[x_plan3d + i - 1, height + n - 1, z_plan3d + j]:
|
||||||
self.editor.placeBlock((x + i - 1, self.coordinates_max[1] + n - 1, z + j),
|
self.editor.placeBlock((x + i - 1, self.coordinates_max[1] + n - 1, z + j),
|
||||||
Block(self.blocks["celling_slab"], {"type": "top"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d + i - 1, height + n - 1, z_plan3d + j] = True
|
self.grid3d[x_plan3d + i - 1,
|
||||||
|
height + n - 1, z_plan3d + j] = True
|
||||||
|
|
||||||
elif i == width:
|
elif i == width:
|
||||||
if not self.grid3d[x_plan3d + i + 1, height + n, z_plan3d + j]:
|
if not self.grid3d[x_plan3d + i + 1, height + n, z_plan3d + j]:
|
||||||
self.editor.placeBlock((x + i + 1, self.coordinates_max[1] + n, z + j),
|
self.editor.placeBlock((x + i + 1, self.coordinates_max[1] + n, z + j),
|
||||||
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
||||||
self.grid3d[x_plan3d + i + 1, height + n, z_plan3d + j] = True
|
self.grid3d[x_plan3d + i + 1,
|
||||||
|
height + n, z_plan3d + j] = True
|
||||||
if not self.grid3d[x_plan3d + i + 1, height + n - 1, z_plan3d + j]:
|
if not self.grid3d[x_plan3d + i + 1, height + n - 1, z_plan3d + j]:
|
||||||
self.editor.placeBlock((x + i + 1, self.coordinates_max[1] + n - 1, z + j),
|
self.editor.placeBlock((x + i + 1, self.coordinates_max[1] + n - 1, z + j),
|
||||||
Block(self.blocks["celling_slab"], {"type": "top"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d + i + 1, height + n - 1, z_plan3d + j] = True
|
self.grid3d[x_plan3d + i + 1,
|
||||||
|
height + n - 1, z_plan3d + j] = True
|
||||||
|
|
||||||
if width < depth:
|
if width < depth:
|
||||||
|
|
||||||
@@ -369,8 +400,10 @@ class House:
|
|||||||
Block(self.blocks["roof_slab"], {"type": "top"}))
|
Block(self.blocks["roof_slab"], {"type": "top"}))
|
||||||
self.editor.placeBlock((x + width - 1 - i, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j] = True
|
self.grid3d[x_plan3d + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j] = True
|
round(height + h), z_plan3d + j] = True
|
||||||
|
self.grid3d[x_plan3d + width - 1 - i,
|
||||||
|
round(height + h), z_plan3d + j] = True
|
||||||
|
|
||||||
if j == -1:
|
if j == -1:
|
||||||
|
|
||||||
@@ -378,28 +411,37 @@ class House:
|
|||||||
self.celling)
|
self.celling)
|
||||||
self.editor.placeBlock((x + width - 1 - i, math.ceil(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.celling)
|
||||||
self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j - 1] = True
|
self.grid3d[x_plan3d + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j - 1] = True
|
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:
|
elif j == depth:
|
||||||
self.editor.placeBlock((x + i, math.ceil(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.celling)
|
||||||
self.editor.placeBlock((x + width - 1 - i, math.ceil(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.celling)
|
||||||
self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j + 1] = True
|
self.grid3d[x_plan3d + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j + 1] = True
|
round(height + h), z_plan3d + j + 1] = True
|
||||||
|
self.grid3d[x_plan3d + width - 1 - i,
|
||||||
|
round(height + h), z_plan3d + j + 1] = True
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((x + i, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
self.editor.placeBlock((x + width - 1 - i, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h-0.5), z + j), self.roof)
|
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.editor.placeBlock((x + width - 1 - i, math.ceil(self.coordinates_max[1] + h-0.5), z + j),
|
||||||
self.roof)
|
self.roof)
|
||||||
|
|
||||||
self.grid3d[x_plan3d + i, round(height + h + 0.5), z_plan3d + j] = True
|
self.grid3d[x_plan3d + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h + 0.5), z_plan3d + j] = True
|
round(height + h + 0.5), z_plan3d + j] = True
|
||||||
self.grid3d[x_plan3d + i, round(height + h - 0.5), z_plan3d + j] = True
|
self.grid3d[x_plan3d + width - 1 - i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h - 0.5), z_plan3d + j] = True
|
round(height + h + 0.5), z_plan3d + j] = True
|
||||||
|
self.grid3d[x_plan3d + i,
|
||||||
|
round(height + h - 0.5), z_plan3d + j] = True
|
||||||
|
self.grid3d[x_plan3d + width - 1 - i,
|
||||||
|
round(height + h - 0.5), z_plan3d + j] = True
|
||||||
|
|
||||||
if j == -1:
|
if j == -1:
|
||||||
self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j - 1),
|
self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j - 1),
|
||||||
@@ -409,14 +451,18 @@ class House:
|
|||||||
self.editor.placeBlock((x + i, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(x + width - 1 - i, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
|
|
||||||
self.grid3d[x_plan3d + i, round(height + h - 1), z_plan3d + j - 1] = True
|
self.grid3d[x_plan3d + i,
|
||||||
|
round(height + h - 1), z_plan3d + j - 1] = True
|
||||||
self.grid3d[
|
self.grid3d[
|
||||||
x_plan3d + width - 1 - i, round(height + h - 1), z_plan3d + j - 1] = True
|
x_plan3d + width - 1 - i, round(height + h - 1), z_plan3d + j - 1] = True
|
||||||
self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j - 1] = True
|
self.grid3d[x_plan3d + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j - 1] = True
|
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:
|
elif j == depth:
|
||||||
self.editor.placeBlock((x + i, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
||||||
@@ -425,22 +471,28 @@ class House:
|
|||||||
self.editor.placeBlock((x + i, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(x + width - 1 - i, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
|
|
||||||
self.grid3d[x_plan3d + i, round(height + h - 1), z_plan3d + j + 1] = True
|
self.grid3d[x_plan3d + i,
|
||||||
|
round(height + h - 1), z_plan3d + j + 1] = True
|
||||||
self.grid3d[
|
self.grid3d[
|
||||||
x_plan3d + width - 1 - i, round(height + h - 1), z_plan3d + j + 1] = True
|
x_plan3d + width - 1 - i, round(height + h - 1), z_plan3d + j + 1] = True
|
||||||
self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j + 1] = True
|
self.grid3d[x_plan3d + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j + 1] = True
|
round(height + h), z_plan3d + j + 1] = True
|
||||||
|
self.grid3d[x_plan3d + width - 1 - i,
|
||||||
|
round(height + h), z_plan3d + j + 1] = True
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((x + i, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
self.editor.placeBlock((x + width - 1 - i, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
|
|
||||||
self.grid3d[x_plan3d + i, round(height + h), z_plan3d + j] = True
|
self.grid3d[x_plan3d + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h), z_plan3d + j] = True
|
round(height + h), z_plan3d + j] = True
|
||||||
|
self.grid3d[x_plan3d + width - 1 - i,
|
||||||
|
round(height + h), z_plan3d + j] = True
|
||||||
|
|
||||||
if j == -1:
|
if j == -1:
|
||||||
self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j - 1),
|
self.editor.placeBlock((x + i, math.ceil(self.coordinates_max[1] + h), z + j - 1),
|
||||||
@@ -450,15 +502,20 @@ class House:
|
|||||||
if not self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j - 1]:
|
if not self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j - 1]:
|
||||||
self.editor.placeBlock((x + i, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j - 1] = True
|
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]:
|
if not self.grid3d[x_plan3d + width - 1 - i, height + h - 1, z_plan3d + j - 1]:
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(x + width - 1 - i, math.ceil(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"}))
|
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 + 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 + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h - 1), z_plan3d + j - 1] = True
|
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:
|
elif j == depth:
|
||||||
self.editor.placeBlock((x + i, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
||||||
@@ -467,15 +524,20 @@ class House:
|
|||||||
if not self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j + 1]:
|
if not self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j + 1]:
|
||||||
self.editor.placeBlock((x + i, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d + i, height + h - 1, z_plan3d + j + 1] = True
|
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]:
|
if not self.grid3d[x_plan3d + width - 1 - i, height + h - 1, z_plan3d + j + 1]:
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(x + width - 1 - i, math.ceil(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"}))
|
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 + 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 + i,
|
||||||
self.grid3d[x_plan3d + width - 1 - i, round(height + h - 1), z_plan3d + j + 1] = True
|
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
|
||||||
if i != -1:
|
if i != -1:
|
||||||
h += 0.5
|
h += 0.5
|
||||||
else:
|
else:
|
||||||
@@ -490,8 +552,10 @@ class House:
|
|||||||
self.editor.placeBlock((x + j, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "top"}))
|
||||||
|
|
||||||
self.grid3d[x_plan3d + j, round(height + h), z_plan3d + i] = True
|
self.grid3d[x_plan3d + j,
|
||||||
self.grid3d[x_plan3d + j, round(height + h), z_plan3d + depth - 1 - i] = True
|
round(height + h), z_plan3d + i] = True
|
||||||
|
self.grid3d[x_plan3d + j,
|
||||||
|
round(height + h), z_plan3d + depth - 1 - i] = True
|
||||||
|
|
||||||
if j == -1:
|
if j == -1:
|
||||||
self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i),
|
self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i),
|
||||||
@@ -499,30 +563,39 @@ class House:
|
|||||||
self.editor.placeBlock((x + j - 1, math.ceil(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.celling)
|
||||||
|
|
||||||
self.grid3d[x_plan3d + j - 1, round(height + h), z_plan3d + i] = True
|
self.grid3d[x_plan3d + j - 1,
|
||||||
self.grid3d[x_plan3d + j - 1, round(height + h), z_plan3d + depth - 1 - i] = True
|
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:
|
elif j == width:
|
||||||
self.editor.placeBlock((x + j + 1, math.ceil(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.celling)
|
||||||
self.editor.placeBlock((x + j + 1, math.ceil(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.celling)
|
||||||
|
|
||||||
self.grid3d[x_plan3d + j + 1, round(height + h), z_plan3d + i] = True
|
self.grid3d[x_plan3d + j + 1,
|
||||||
self.grid3d[x_plan3d + j + 1, round(height + h), z_plan3d + depth - 1 - i] = True
|
round(height + h), z_plan3d + i] = True
|
||||||
|
self.grid3d[x_plan3d + j + 1,
|
||||||
|
round(height + h), z_plan3d + depth - 1 - i] = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((x + j, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
self.editor.placeBlock((x + j, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
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 + i), self.roof)
|
||||||
self.editor.placeBlock((x + j, math.ceil(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 + depth - 1 - i),
|
||||||
self.roof)
|
self.roof)
|
||||||
|
|
||||||
self.grid3d[x_plan3d+j, round(height + h + 0.5),z_plan3d+ i] = True
|
self.grid3d[x_plan3d+j,
|
||||||
self.grid3d[x_plan3d+j, round(height + h + 0.5),z_plan3d+ depth - 1 - i] = True
|
round(height + h + 0.5), z_plan3d + i] = True
|
||||||
self.grid3d[x_plan3d+j, round(height + h - 0.5),z_plan3d+ i] = True
|
self.grid3d[x_plan3d+j, round(
|
||||||
self.grid3d[x_plan3d+j, round(height + h - 0.5), z_plan3d+depth - 1 - i] = True
|
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:
|
if j == -1:
|
||||||
self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i),
|
self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i),
|
||||||
@@ -532,13 +605,18 @@ class House:
|
|||||||
self.editor.placeBlock((x + j - 1, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(x + j - 1, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
|
|
||||||
self.grid3d[x_plan3d+j-1, round(height + h),z_plan3d+ i] = True
|
self.grid3d[x_plan3d+j-1,
|
||||||
self.grid3d[x_plan3d+j-1, round(height + h), z_plan3d+depth - 1 - i] = True
|
round(height + h), z_plan3d + i] = True
|
||||||
self.grid3d[x_plan3d+j-1, round(height + h - 1),z_plan3d+ i] = True
|
self.grid3d[x_plan3d+j-1,
|
||||||
self.grid3d[x_plan3d+j-1, round(height + h - 1), z_plan3d+depth - 1 - i] = True
|
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:
|
elif j == width:
|
||||||
self.editor.placeBlock((x + j + 1, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
||||||
@@ -547,21 +625,28 @@ class House:
|
|||||||
self.editor.placeBlock((x + j + 1, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(x + j + 1, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
|
|
||||||
self.grid3d[x_plan3d+j+1, round(height + h),z_plan3d+ i] = True
|
self.grid3d[x_plan3d+j+1,
|
||||||
self.grid3d[x_plan3d+j+1, round(height + h),z_plan3d+ depth - 1 - i] = True
|
round(height + h), z_plan3d + i] = True
|
||||||
self.grid3d[x_plan3d+j+1, round(height + h - 1), z_plan3d+i] = True
|
self.grid3d[x_plan3d+j+1,
|
||||||
self.grid3d[x_plan3d+j+1, round(height + h - 1),z_plan3d+ depth - 1 - i] = True
|
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:
|
else:
|
||||||
self.editor.placeBlock((x + j, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
self.editor.placeBlock((x + j, math.ceil(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"}))
|
Block(self.blocks["roof_slab"], {"type": "bottom"}))
|
||||||
|
|
||||||
self.grid3d[x_plan3d+j, round(height + h), z_plan3d+i] = True
|
self.grid3d[x_plan3d+j,
|
||||||
self.grid3d[x_plan3d+j, round(height + h), z_plan3d+depth - 1 - i] = True
|
round(height + h), z_plan3d+i] = True
|
||||||
|
self.grid3d[x_plan3d+j,
|
||||||
|
round(height + h), z_plan3d+depth - 1 - i] = True
|
||||||
|
|
||||||
if j == -1:
|
if j == -1:
|
||||||
self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i),
|
self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h), z + i),
|
||||||
@@ -571,15 +656,20 @@ class House:
|
|||||||
if not self.grid3d[x_plan3d+j-1, height + h - 1, z_plan3d+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),
|
self.editor.placeBlock((x + j - 1, math.ceil(self.coordinates_max[1] + h-1), z + i),
|
||||||
Block(self.blocks["celling_slab"], {"type": "top"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d+j-1, height + h - 1, z_plan3d+i] = True
|
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]:
|
if not self.grid3d[x_plan3d+j-1, height + h - 1, z_plan3d+depth - 1 - i]:
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(x + j - 1, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d+j-1, height + h - 1, z_plan3d+depth - 1 - i] = True
|
self.grid3d[x_plan3d+j-1, height +
|
||||||
|
h - 1, z_plan3d+depth - 1 - i] = True
|
||||||
|
|
||||||
self.grid3d[x_plan3d+j-1, round(height + h), z_plan3d+i] = True
|
self.grid3d[x_plan3d+j-1,
|
||||||
self.grid3d[x_plan3d+j-1, round(height + h),z_plan3d+ depth - 1 - i] = True
|
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:
|
elif j == width:
|
||||||
self.editor.placeBlock((x + j + 1, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "bottom"}))
|
||||||
@@ -588,18 +678,25 @@ class House:
|
|||||||
if not self.grid3d[x_plan3d+j+1, height + h - 1, z_plan3d + 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),
|
self.editor.placeBlock((x + j + 1, math.ceil(self.coordinates_max[1] + h-1), z + i),
|
||||||
Block(self.blocks["celling_slab"], {"type": "top"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d+j+1, height + h - 1, z_plan3d+i] = True
|
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]:
|
if not self.grid3d[x_plan3d+j+1, height + h - 1, z_plan3d + depth - 1 - i]:
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(x + j + 1, math.ceil(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"}))
|
Block(self.blocks["celling_slab"], {"type": "top"}))
|
||||||
self.grid3d[x_plan3d+j+1, height + h - 1,z_plan3d+ depth - 1 - i] = True
|
self.grid3d[x_plan3d+j+1, height + h -
|
||||||
|
1, z_plan3d + depth - 1 - i] = True
|
||||||
|
|
||||||
self.grid3d[x_plan3d+j+1, round(height + h), z_plan3d+i] = True
|
self.grid3d[x_plan3d+j+1,
|
||||||
self.grid3d[x_plan3d+j+1, round(height + h), z_plan3d+depth - 1 - i] = True
|
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, round(height + h), z_plan3d+i] = True
|
self.grid3d[x_plan3d+j,
|
||||||
self.grid3d[x_plan3d+j, round(height + h),z_plan3d+ depth - 1 - i] = True
|
round(height + h), z_plan3d+i] = True
|
||||||
|
self.grid3d[x_plan3d+j,
|
||||||
|
round(height + h), z_plan3d + depth - 1 - i] = True
|
||||||
|
|
||||||
if i != -1:
|
if i != -1:
|
||||||
h += 0.5
|
h += 0.5
|
||||||
@@ -612,11 +709,13 @@ class House:
|
|||||||
if not self.grid3d[x_plan3d + i, height - 1, z_plan3d + j]['bool']:
|
if not self.grid3d[x_plan3d + i, height - 1, z_plan3d + j]['bool']:
|
||||||
if width < depth:
|
if width < depth:
|
||||||
if i == -2 or i == width + 1:
|
if i == -2 or i == width + 1:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] - 1, z + j), QUARTZ_SLAB)
|
self.editor.placeBlock(
|
||||||
|
(x + i, self.coordinates_max[1] - 1, z + j), QUARTZ_SLAB)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if j == -2 or j == depth + 1:
|
if j == -2 or j == depth + 1:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1] - 1, z + j), QUARTZ_SLAB)
|
self.editor.placeBlock(
|
||||||
|
(x + i, self.coordinates_max[1] - 1, z + j), QUARTZ_SLAB)
|
||||||
|
|
||||||
def putCelling(self):
|
def putCelling(self):
|
||||||
for k in range(0, len(self.skeleton)):
|
for k in range(0, len(self.skeleton)):
|
||||||
@@ -632,7 +731,8 @@ class House:
|
|||||||
for y in range(1, self.nbEtage + 1):
|
for y in range(1, self.nbEtage + 1):
|
||||||
for i in range(0, width):
|
for i in range(0, width):
|
||||||
for j in range(0, depth):
|
for j in range(0, depth):
|
||||||
self.editor.placeBlock((x + i, self.coordinates_min[1] + 4 * y, z + j), self.celling)
|
self.editor.placeBlock(
|
||||||
|
(x + i, self.coordinates_min[1] + 4 * y, z + j), self.celling)
|
||||||
self.grid3d[x_plan3d + i, 4 * y, z_plan3d + j] = True
|
self.grid3d[x_plan3d + i, 4 * y, z_plan3d + j] = True
|
||||||
|
|
||||||
def getAllExterneWalls(self):
|
def getAllExterneWalls(self):
|
||||||
@@ -676,11 +776,15 @@ class House:
|
|||||||
if axis % 2 == 0:
|
if axis % 2 == 0:
|
||||||
if axis == 4:
|
if axis == 4:
|
||||||
if is_x:
|
if is_x:
|
||||||
self.editor.placeBlock((wall[0] + 2, self.coordinates_min[1] + 2 + l * 4, wall[1]), self.window)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((wall[0] + 3, self.coordinates_min[1] + 2 + l * 4, wall[1]), self.window)
|
(wall[0] + 2, self.coordinates_min[1] + 2 + l * 4, wall[1]), self.window)
|
||||||
|
self.editor.placeBlock(
|
||||||
|
(wall[0] + 3, self.coordinates_min[1] + 2 + l * 4, wall[1]), self.window)
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((wall[0], self.coordinates_min[1] + 2 + l * 4, wall[1] + 3), self.window)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((wall[0], self.coordinates_min[1] + 2 + l * 4, wall[1] + 2), self.window)
|
(wall[0], self.coordinates_min[1] + 2 + l * 4, wall[1] + 3), self.window)
|
||||||
|
self.editor.placeBlock(
|
||||||
|
(wall[0], self.coordinates_min[1] + 2 + l * 4, wall[1] + 2), self.window)
|
||||||
else:
|
else:
|
||||||
for i in range(0, math.ceil(axis / 4)):
|
for i in range(0, math.ceil(axis / 4)):
|
||||||
if is_x:
|
if is_x:
|
||||||
@@ -736,34 +840,47 @@ class House:
|
|||||||
Block("air"))
|
Block("air"))
|
||||||
|
|
||||||
for j in range(1, 5):
|
for j in range(1, 5):
|
||||||
self.editor.placeBlock((x_moy, self.coordinates_min[1] + 4 * i + j, z_moy), self.floor)
|
self.editor.placeBlock(
|
||||||
|
(x_moy, self.coordinates_min[1] + 4 * i + j, z_moy), self.floor)
|
||||||
|
|
||||||
self.editor.placeBlock((x_moy - 1, self.coordinates_min[1] + 1 + 4 * i, z_moy - 1), slab_down)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((x_moy, self.coordinates_min[1] + 1 + 4 * i, z_moy - 1), slab_up)
|
(x_moy - 1, self.coordinates_min[1] + 1 + 4 * i, z_moy - 1), slab_down)
|
||||||
self.editor.placeBlock((x_moy + 1, self.coordinates_min[1] + 2 + 4 * i, z_moy - 1), slab_down)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((x_moy + 1, self.coordinates_min[1] + 2 + 4 * i, z_moy), slab_up)
|
(x_moy, self.coordinates_min[1] + 1 + 4 * i, z_moy - 1), slab_up)
|
||||||
self.editor.placeBlock((x_moy + 1, self.coordinates_min[1] + 3 + 4 * i, z_moy + 1), slab_down)
|
self.editor.placeBlock(
|
||||||
|
(x_moy + 1, self.coordinates_min[1] + 2 + 4 * i, z_moy - 1), slab_down)
|
||||||
|
self.editor.placeBlock(
|
||||||
|
(x_moy + 1, self.coordinates_min[1] + 2 + 4 * i, z_moy), slab_up)
|
||||||
|
self.editor.placeBlock(
|
||||||
|
(x_moy + 1, self.coordinates_min[1] + 3 + 4 * i, z_moy + 1), slab_down)
|
||||||
|
|
||||||
self.editor.placeBlock((x_moy, self.coordinates_min[1] + 3 + 4 * i, z_moy + 1), slab_up)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((x_moy - 1, self.coordinates_min[1] + 4 + 4 * i, z_moy + 1), slab_down)
|
(x_moy, self.coordinates_min[1] + 3 + 4 * i, z_moy + 1), slab_up)
|
||||||
self.editor.placeBlock((x_moy - 1, self.coordinates_min[1] + 4 + 4 * i, z_moy), slab_up)
|
self.editor.placeBlock(
|
||||||
|
(x_moy - 1, self.coordinates_min[1] + 4 + 4 * i, z_moy + 1), slab_down)
|
||||||
|
self.editor.placeBlock(
|
||||||
|
(x_moy - 1, self.coordinates_min[1] + 4 + 4 * i, z_moy), slab_up)
|
||||||
|
|
||||||
def WallFacingDirection(self):
|
def WallFacingDirection(self):
|
||||||
|
|
||||||
if self.direction == "N":
|
if self.direction == "N":
|
||||||
closest_wall = min(self.skeleton, key=lambda wall: wall[1])
|
closest_wall = min(self.skeleton, key=lambda wall: wall[1])
|
||||||
wall = (closest_wall[0], closest_wall[1], closest_wall[0] + closest_wall[2], closest_wall[1])
|
wall = (closest_wall[0], closest_wall[1],
|
||||||
|
closest_wall[0] + closest_wall[2], closest_wall[1])
|
||||||
elif self.direction == "S":
|
elif self.direction == "S":
|
||||||
closest_wall = max(self.skeleton, key=lambda wall: wall[1] + wall[3])
|
closest_wall = max(
|
||||||
|
self.skeleton, key=lambda wall: wall[1] + wall[3])
|
||||||
wall = (closest_wall[0], closest_wall[1] + closest_wall[3], closest_wall[0] + closest_wall[2],
|
wall = (closest_wall[0], closest_wall[1] + closest_wall[3], closest_wall[0] + closest_wall[2],
|
||||||
closest_wall[1] + closest_wall[3])
|
closest_wall[1] + closest_wall[3])
|
||||||
elif self.direction == "E":
|
elif self.direction == "E":
|
||||||
closest_wall = max(self.skeleton, key=lambda wall: wall[0] + wall[2])
|
closest_wall = max(
|
||||||
|
self.skeleton, key=lambda wall: wall[0] + wall[2])
|
||||||
wall = (closest_wall[0] + closest_wall[2], closest_wall[1], closest_wall[0] + closest_wall[2],
|
wall = (closest_wall[0] + closest_wall[2], closest_wall[1], closest_wall[0] + closest_wall[2],
|
||||||
closest_wall[1] + closest_wall[3])
|
closest_wall[1] + closest_wall[3])
|
||||||
elif self.direction == "W":
|
elif self.direction == "W":
|
||||||
closest_wall = min(self.skeleton, key=lambda wall: wall[0])
|
closest_wall = min(self.skeleton, key=lambda wall: wall[0])
|
||||||
wall = (closest_wall[0], closest_wall[1], closest_wall[0], closest_wall[1] + closest_wall[3])
|
wall = (closest_wall[0], closest_wall[1],
|
||||||
|
closest_wall[0], closest_wall[1] + closest_wall[3])
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@@ -825,7 +942,8 @@ class House:
|
|||||||
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
||||||
|
|
||||||
self.entranceCo = (
|
self.entranceCo = (
|
||||||
(wall[1] + wall[3]) // 2, (wall[1] + wall[3]) // 2 + 2, (wall[1] + wall[3]) // 2 + 1,
|
(wall[1] + wall[3]) // 2, (wall[1] + wall[3]
|
||||||
|
) // 2 + 2, (wall[1] + wall[3]) // 2 + 1,
|
||||||
(wall[1] + wall[3]) // 2 - 1)
|
(wall[1] + wall[3]) // 2 - 1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -849,16 +967,19 @@ class House:
|
|||||||
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
||||||
|
|
||||||
self.entranceCo = (
|
self.entranceCo = (
|
||||||
(wall[1] + wall[3]) // 2, (wall[1] + wall[3]) // 2 + 1, (wall[1] + wall[3]) // 2 + 1,
|
(wall[1] + wall[3]) // 2, (wall[1] + wall[3]
|
||||||
|
) // 2 + 1, (wall[1] + wall[3]) // 2 + 1,
|
||||||
(wall[1] + wall[3]) // 2 - 1)
|
(wall[1] + wall[3]) // 2 - 1)
|
||||||
|
|
||||||
case "N":
|
case "N":
|
||||||
if (wall[2] - wall[0]) % 2 != 0:
|
if (wall[2] - wall[0]) % 2 != 0:
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 1, self.coordinates_min[1] + 1, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
|
self.coordinates_min[1] + 1, wall[1] + 1),
|
||||||
Block("air"))
|
Block("air"))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 1, self.coordinates_min[1] + 2, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
|
self.coordinates_min[1] + 2, wall[1] + 1),
|
||||||
Block("air"))
|
Block("air"))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1] + 1, wall[1] + 1), Block("air"))
|
(wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1] + 1, wall[1] + 1), Block("air"))
|
||||||
@@ -877,13 +998,16 @@ class House:
|
|||||||
self.editor.placeBlock((wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1] + 3, wall[1]),
|
self.editor.placeBlock((wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1] + 3, wall[1]),
|
||||||
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 1, self.coordinates_min[1] + 3, wall[1]),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
|
self.coordinates_min[1] + 3, wall[1]),
|
||||||
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 - 1, self.coordinates_min[1] + 3, wall[1]),
|
(wall[0] + (wall[2] - wall[0]) // 2 - 1,
|
||||||
|
self.coordinates_min[1] + 3, wall[1]),
|
||||||
Block(self.blocks["stairs"], {"facing": "east", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "east", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 2, self.coordinates_min[1] + 3, wall[1]),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 2,
|
||||||
|
self.coordinates_min[1] + 3, wall[1]),
|
||||||
Block(self.blocks["stairs"], {"facing": "west", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "west", "half": "top"}))
|
||||||
|
|
||||||
self.entranceCo = (wall[0] + (wall[2] - wall[0]) // 2, wall[0] + (wall[2] - wall[0]) // 2 + 2,
|
self.entranceCo = (wall[0] + (wall[2] - wall[0]) // 2, wall[0] + (wall[2] - wall[0]) // 2 + 2,
|
||||||
@@ -905,10 +1029,12 @@ class House:
|
|||||||
self.editor.placeBlock((wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1] + 3, wall[1]),
|
self.editor.placeBlock((wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1] + 3, wall[1]),
|
||||||
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 1, self.coordinates_min[1] + 3, wall[1]),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
|
self.coordinates_min[1] + 3, wall[1]),
|
||||||
Block(self.blocks["stairs"], {"facing": "west", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "west", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 - 1, self.coordinates_min[1] + 3, wall[1]),
|
(wall[0] + (wall[2] - wall[0]) // 2 - 1,
|
||||||
|
self.coordinates_min[1] + 3, wall[1]),
|
||||||
Block(self.blocks["stairs"], {"facing": "east", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "east", "half": "top"}))
|
||||||
|
|
||||||
self.entranceCo = (wall[0] + (wall[2] - wall[0]) // 2, wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
self.entranceCo = (wall[0] + (wall[2] - wall[0]) // 2, wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
@@ -944,7 +1070,8 @@ class House:
|
|||||||
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
||||||
|
|
||||||
self.entranceCo = (
|
self.entranceCo = (
|
||||||
(wall[1] + wall[3]) // 2, (wall[1] + wall[3]) // 2 + 2, (wall[1] + wall[3]) // 2 + 1,
|
(wall[1] + wall[3]) // 2, (wall[1] + wall[3]
|
||||||
|
) // 2 + 2, (wall[1] + wall[3]) // 2 + 1,
|
||||||
(wall[1] + wall[3]) // 2 - 1)
|
(wall[1] + wall[3]) // 2 - 1)
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((wall[0], self.coordinates_min[1] + 1, (wall[1] + wall[3]) // 2),
|
self.editor.placeBlock((wall[0], self.coordinates_min[1] + 1, (wall[1] + wall[3]) // 2),
|
||||||
@@ -967,7 +1094,8 @@ class House:
|
|||||||
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "south", "half": "top"}))
|
||||||
|
|
||||||
self.entranceCo = (
|
self.entranceCo = (
|
||||||
(wall[1] + wall[3]) // 2, (wall[1] + wall[3]) // 2 + 1, (wall[1] + wall[3]) // 2 + 1,
|
(wall[1] + wall[3]) // 2, (wall[1] + wall[3]
|
||||||
|
) // 2 + 1, (wall[1] + wall[3]) // 2 + 1,
|
||||||
(wall[1] + wall[3]) // 2 - 1)
|
(wall[1] + wall[3]) // 2 - 1)
|
||||||
|
|
||||||
case "S":
|
case "S":
|
||||||
@@ -985,26 +1113,33 @@ class House:
|
|||||||
self.editor.placeBlock((wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1], wall[1] + 1),
|
self.editor.placeBlock((wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1], wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "north"}))
|
Block(self.blocks["stairs"], {"facing": "north"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 1, self.coordinates_min[1], wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
|
self.coordinates_min[1], wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "north"}))
|
Block(self.blocks["stairs"], {"facing": "north"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 - 1, self.coordinates_min[1], wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 - 1,
|
||||||
|
self.coordinates_min[1], wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "east"}))
|
Block(self.blocks["stairs"], {"facing": "east"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 2, self.coordinates_min[1], wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 2,
|
||||||
|
self.coordinates_min[1], wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "west"}))
|
Block(self.blocks["stairs"], {"facing": "west"}))
|
||||||
|
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1] + 3, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2,
|
||||||
|
self.coordinates_min[1] + 3, wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 1, self.coordinates_min[1] + 3, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
|
self.coordinates_min[1] + 3, wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 - 1, self.coordinates_min[1] + 3, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 - 1,
|
||||||
|
self.coordinates_min[1] + 3, wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "east", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "east", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 2, self.coordinates_min[1] + 3, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 2,
|
||||||
|
self.coordinates_min[1] + 3, wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "west", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "west", "half": "top"}))
|
||||||
|
|
||||||
self.entranceCo = (wall[0] + (wall[2] - wall[0]) // 2, wall[0] + (wall[2] - wall[0]) // 2 + 2,
|
self.entranceCo = (wall[0] + (wall[2] - wall[0]) // 2, wall[0] + (wall[2] - wall[0]) // 2 + 2,
|
||||||
@@ -1018,20 +1153,25 @@ class House:
|
|||||||
self.editor.placeBlock((wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1], wall[1] + 1),
|
self.editor.placeBlock((wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1], wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "north"}))
|
Block(self.blocks["stairs"], {"facing": "north"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 1, self.coordinates_min[1], wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
|
self.coordinates_min[1], wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "west"}))
|
Block(self.blocks["stairs"], {"facing": "west"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 - 1, self.coordinates_min[1], wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 - 1,
|
||||||
|
self.coordinates_min[1], wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "east"}))
|
Block(self.blocks["stairs"], {"facing": "east"}))
|
||||||
|
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2, self.coordinates_min[1] + 3, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2,
|
||||||
|
self.coordinates_min[1] + 3, wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "north", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 + 1, self.coordinates_min[1] + 3, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
|
self.coordinates_min[1] + 3, wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "west", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "west", "half": "top"}))
|
||||||
self.editor.placeBlock(
|
self.editor.placeBlock(
|
||||||
(wall[0] + (wall[2] - wall[0]) // 2 - 1, self.coordinates_min[1] + 3, wall[1] + 1),
|
(wall[0] + (wall[2] - wall[0]) // 2 - 1,
|
||||||
|
self.coordinates_min[1] + 3, wall[1] + 1),
|
||||||
Block(self.blocks["stairs"], {"facing": "east", "half": "top"}))
|
Block(self.blocks["stairs"], {"facing": "east", "half": "top"}))
|
||||||
|
|
||||||
self.entranceCo = (wall[0] + (wall[2] - wall[0]) // 2, wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
self.entranceCo = (wall[0] + (wall[2] - wall[0]) // 2, wall[0] + (wall[2] - wall[0]) // 2 + 1,
|
||||||
@@ -1048,36 +1188,53 @@ class House:
|
|||||||
match self.direction:
|
match self.direction:
|
||||||
case "N":
|
case "N":
|
||||||
if not (i in self.entranceCo and y == z_min):
|
if not (i in self.entranceCo and y == z_min):
|
||||||
self.editor.placeBlock((i, y_min - 1, y), Block("oak_log"))
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((i, y_min, y), self.gardenOutline)
|
(i, y_min - 1, y), Block("oak_log"))
|
||||||
self.editor.placeBlock((i, y_min + 1, y), self.gardenOutline)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((i, y_min + 2, y), self.gardenOutline)
|
(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)
|
||||||
case "S":
|
case "S":
|
||||||
if not (i in self.entranceCo and y == z_max - 1):
|
if not (i in self.entranceCo and y == z_max - 1):
|
||||||
self.editor.placeBlock((i, y_min - 1, y), Block("oak_log"))
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((i, y_min, y), self.gardenOutline)
|
(i, y_min - 1, y), Block("oak_log"))
|
||||||
self.editor.placeBlock((i, y_min + 1, y), self.gardenOutline)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((i, y_min + 2, y), self.gardenOutline)
|
(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)
|
||||||
case "E":
|
case "E":
|
||||||
if not (i == x_max - 1 and y in self.entranceCo):
|
if not (i == x_max - 1 and y in self.entranceCo):
|
||||||
self.editor.placeBlock((i, y_min - 1, y), Block("oak_log"))
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((i, y_min, y), self.gardenOutline)
|
(i, y_min - 1, y), Block("oak_log"))
|
||||||
self.editor.placeBlock((i, y_min + 1, y), self.gardenOutline)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((i, y_min + 2, y), self.gardenOutline)
|
(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)
|
||||||
|
|
||||||
case "W":
|
case "W":
|
||||||
if not (i == x_min and y in self.entranceCo):
|
if not (i == x_min and y in self.entranceCo):
|
||||||
self.editor.placeBlock((i, y_min - 1, y), Block("oak_log"))
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((i, y_min, y), self.gardenOutline)
|
(i, y_min - 1, y), Block("oak_log"))
|
||||||
self.editor.placeBlock((i, y_min + 1, y), self.gardenOutline)
|
self.editor.placeBlock(
|
||||||
self.editor.placeBlock((i, y_min + 2, y), self.gardenOutline)
|
(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)
|
||||||
|
|
||||||
case _:
|
case _:
|
||||||
self.editor.placeBlock((i, y_min - 1, y), self.garden_floor)
|
self.editor.placeBlock(
|
||||||
|
(i, y_min - 1, y), self.garden_floor)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((i, y_min - 1, y), self.garden_floor)
|
self.editor.placeBlock(
|
||||||
|
(i, y_min - 1, y), self.garden_floor)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
self.createHouseSkeleton()
|
self.createHouseSkeleton()
|
||||||
@@ -1095,8 +1252,10 @@ class House:
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
editor = Editor(buffering=True)
|
editor = Editor(buffering=True)
|
||||||
buildArea = editor.getBuildArea()
|
buildArea = editor.getBuildArea()
|
||||||
coordinates_min = [min(buildArea.begin[i], buildArea.last[i]) for i in range(3)]
|
coordinates_min = [min(buildArea.begin[i], buildArea.last[i])
|
||||||
coordinates_max = [max(buildArea.begin[i], buildArea.last[i]) for i in range(3)]
|
for i in range(3)]
|
||||||
|
coordinates_max = [max(buildArea.begin[i], buildArea.last[i])
|
||||||
|
for i in range(3)]
|
||||||
|
|
||||||
blocks = {
|
blocks = {
|
||||||
"wall": "blackstone",
|
"wall": "blackstone",
|
||||||
@@ -1119,8 +1278,10 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
house.build()
|
house.build()
|
||||||
|
|
||||||
new_coordinates_min = (coordinates_max[0] + 20, coordinates_min[1], coordinates_min[2])
|
new_coordinates_min = (
|
||||||
new_coordinates_max = (coordinates_max[0] + 10 + 40, coordinates_max[1], coordinates_max[2])
|
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_min = new_coordinates_min
|
||||||
coordinates_max = new_coordinates_max
|
coordinates_max = new_coordinates_max
|
||||||
|
|
||||||
|
|||||||
3
main.py
@@ -10,6 +10,7 @@ from world_maker.District import Road as Road_grid
|
|||||||
from world_maker.Skeleton import Skeleton, simplify_coordinates
|
from world_maker.Skeleton import Skeleton, simplify_coordinates
|
||||||
from world_maker.terraforming import remove_trees, smooth_terrain
|
from world_maker.terraforming import remove_trees, smooth_terrain
|
||||||
from world_maker.world_maker import world_maker
|
from world_maker.world_maker import world_maker
|
||||||
|
from networks.geometry.Point3D import Point3D
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -95,7 +96,7 @@ def set_roads(skeleton: Skeleton, origin):
|
|||||||
# Simplification
|
# Simplification
|
||||||
for i in range(len(skeleton.lines)):
|
for i in range(len(skeleton.lines)):
|
||||||
print(f"[Roads] Simplify skelton {i+1}/{len(skeleton.lines)}")
|
print(f"[Roads] Simplify skelton {i+1}/{len(skeleton.lines)}")
|
||||||
skeleton.lines[i] = simplify_coordinates(skeleton.lines[i], 10)
|
skeleton.lines[i] = simplify_coordinates(skeleton.lines[i], 40)
|
||||||
|
|
||||||
print("[Roads] Start generation...")
|
print("[Roads] Start generation...")
|
||||||
for i in range(len(skeleton.lines)):
|
for i in range(len(skeleton.lines)):
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class Road:
|
|||||||
|
|
||||||
for i in range(len(self.polyline.total_line_output)):
|
for i in range(len(self.polyline.total_line_output)):
|
||||||
self.polyline_total_line_output[i] = Point3D(
|
self.polyline_total_line_output[i] = Point3D(
|
||||||
self.polyline.total_line_output[i].x, y[round(i*self.index_factor)]+100, self.polyline.total_line_output[i].y)
|
self.polyline.total_line_output[i].x, y[round(i*self.index_factor)], self.polyline.total_line_output[i].y)
|
||||||
|
|
||||||
self._surface()
|
self._surface()
|
||||||
self.place()
|
self.place()
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 85 B |
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 85 B |
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 750 B |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 790 B |
|
Before Width: | Height: | Size: 78 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 117 B |
|
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 85 B |
|
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 798 B After Width: | Height: | Size: 936 B |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 3.1 KiB |
@@ -235,7 +235,7 @@ def highway_map() -> Image:
|
|||||||
|
|
||||||
|
|
||||||
def create_volume(surface: np.ndarray, heightmap: np.ndarray, make_it_flat: bool = False) -> np.ndarray:
|
def create_volume(surface: np.ndarray, heightmap: np.ndarray, make_it_flat: bool = False) -> np.ndarray:
|
||||||
volume = np.full((len(surface), 255, len(surface[0])), False)
|
volume = np.full((len(surface[0]), 255, len(surface)), False)
|
||||||
for z in range(len(surface)):
|
for z in range(len(surface)):
|
||||||
for x in range(len(surface[0])):
|
for x in range(len(surface[0])):
|
||||||
if not make_it_flat:
|
if not make_it_flat:
|
||||||
|
|||||||