update roof
This commit is contained in:
235
House.py
235
House.py
@@ -4,6 +4,7 @@ from gdpc import Editor, Block, geometry
|
|||||||
from list_block import *
|
from list_block import *
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from skimage.morphology import skeletonize
|
from skimage.morphology import skeletonize
|
||||||
|
import math
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
class House:
|
class House:
|
||||||
@@ -14,8 +15,14 @@ class House:
|
|||||||
self.grid = np.zeros((coordinates_max[0], coordinates_max[2]), dtype=[('bool', bool), ('int', int)])
|
self.grid = np.zeros((coordinates_max[0], coordinates_max[2]), dtype=[('bool', bool), ('int', int)])
|
||||||
self.skeleton = []
|
self.skeleton = []
|
||||||
|
|
||||||
|
size = [(coordinates_max[i] - coordinates_min[i]) + 10 for i in range(3)]
|
||||||
|
|
||||||
|
# Créer le tableau
|
||||||
|
self.grid3d = np.zeros(size, dtype=[('bool', bool), ('int', int)])
|
||||||
|
|
||||||
self.nbEtage = (coordinates_max[1] - coordinates_min[1]) // 5
|
self.nbEtage = (coordinates_max[1] - coordinates_min[1]) // 5
|
||||||
|
|
||||||
|
|
||||||
def createHouseSkeleton(self):
|
def createHouseSkeleton(self):
|
||||||
self.delete()
|
self.delete()
|
||||||
x_min, y_min, z_min = self.coordinates_min
|
x_min, y_min, z_min = self.coordinates_min
|
||||||
@@ -41,17 +48,22 @@ class House:
|
|||||||
|
|
||||||
width = perimeter_width // 2
|
width = perimeter_width // 2
|
||||||
depth = perimeter_depth // 2
|
depth = perimeter_depth // 2
|
||||||
|
height = y_max - y_min
|
||||||
|
|
||||||
if x + width-1 > x_max-1:
|
if x + width-1 > x_max-1:
|
||||||
x = x_max - width-1
|
x = x_max - width-1
|
||||||
if z + depth-1 > z_max-1:
|
if z + depth-1 > z_max-1:
|
||||||
z = z_max - depth-1
|
z = z_max - depth-1
|
||||||
|
|
||||||
|
x_plan3d = x - x_min
|
||||||
|
z_plan3d = z - z_min
|
||||||
|
|
||||||
for i in range(0, width-1):
|
for i in range(0, width-1):
|
||||||
for j in range(0, depth-1):
|
for j in range(0, depth-1):
|
||||||
self.editor.placeBlock((x + i, y_min, z + j), Block("stone"))
|
self.editor.placeBlock((x + i, y_min, z + j), Block("stone"))
|
||||||
self.grid[x+i,z+j] = True,1
|
self.grid[x+i,z+j] = True,1
|
||||||
self.skeleton.append((x, z, width-1, depth-1))
|
self.grid3d[x_plan3d+i,0,z_plan3d+j] = True,1
|
||||||
|
self.skeleton.append((x, z, width-1, depth-1, height))
|
||||||
print("Coordinates of the corners: ", (x, z), (x, z+depth-1), (x+width-1, z), (x+width-1, z+depth-1))
|
print("Coordinates of the corners: ", (x, z), (x, z+depth-1), (x+width-1, z), (x+width-1, z+depth-1))
|
||||||
|
|
||||||
block = ["redstone_block", "gold_block", "diamond_block"]
|
block = ["redstone_block", "gold_block", "diamond_block"]
|
||||||
@@ -63,11 +75,7 @@ class House:
|
|||||||
|
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
print("Rectangle n°", _+1, "en cours de création")
|
print("Rectangle n°", _+1, "en cours de création")
|
||||||
corners = [(x-1, z-1), (x-1, z+depth-1), (x+width-1, z-1), (x+width-1, z+depth-1)]
|
|
||||||
around_corners = [(x-1, z),(x, z-1), (x-1, z+depth-2),(x, z+depth-1), (x+width-2, z-1),(x+width-1, z), (x+width-1, z+depth-2),(x+width-2, z+depth-1)]
|
|
||||||
around_around_corners = [(x-1, z+1), (x+1, z-1), (x-1, z+depth-3), (x+1, z+depth-1), (x+width-3, z-1), (x+width-1, z+1), (x+width-1, z+depth-3), (x+width-3, z+depth-1)]
|
|
||||||
|
|
||||||
corners = corners + around_corners + around_around_corners
|
|
||||||
|
|
||||||
for a in range(100000):
|
for a in range(100000):
|
||||||
new_width = np.random.randint(5, width-2)
|
new_width = np.random.randint(5, width-2)
|
||||||
@@ -77,10 +85,7 @@ class House:
|
|||||||
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 ))
|
||||||
|
|
||||||
|
|
||||||
#if (new_x, new_z) in corners or(new_x+new_width-1, new_z) in corners or (new_x, new_z+new_depth-1) in corners or (new_x+new_width-1, new_z+new_depth-1) in corners:
|
|
||||||
# continue
|
|
||||||
|
|
||||||
# Check if the majority of the small rectangle is adjacent to the first rectangle
|
|
||||||
adjacent_blocks = 0
|
adjacent_blocks = 0
|
||||||
for i in range(new_x, new_x + new_width):
|
for i in range(new_x, new_x + new_width):
|
||||||
for j in range(new_z, new_z + new_depth):
|
for j in range(new_z, new_z + new_depth):
|
||||||
@@ -91,16 +96,19 @@ class House:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if not np.any(self.grid[new_x:new_x+new_width, new_z:new_z+new_depth]['bool']):
|
if not np.any(self.grid[new_x:new_x+new_width, new_z:new_z+new_depth]['bool']):
|
||||||
|
new_x_plan3d = new_x - x_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.grid[new_x + i, new_z + j] = True,2
|
self.grid[new_x + i, new_z + 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), Block(block[_]))
|
self.editor.placeBlock((new_x + i, y_min, new_z + j), Block(block[_]))
|
||||||
|
|
||||||
self.skeleton.append((new_x, new_z, new_width, new_depth))
|
self.skeleton.append((new_x, new_z, new_width, new_depth, height))
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("Failed to place rectangle after 1000 attempts.")
|
print("Failed to place rectangle after 1000 attempts.")
|
||||||
@@ -108,36 +116,42 @@ class House:
|
|||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
for x in range(self.coordinates_min[0], self.coordinates_max[0]):
|
for x in range(self.coordinates_min[0], self.coordinates_max[0]):
|
||||||
for y in range(self.coordinates_min[1], self.coordinates_max[1]+4):
|
for y in range(self.coordinates_min[1], self.coordinates_max[1]+10):
|
||||||
for z in range(self.coordinates_min[2], self.coordinates_max[2]):
|
for z in range(self.coordinates_min[2], self.coordinates_max[2]):
|
||||||
self.editor.placeBlock((x, y, z), Block("air"))
|
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)):
|
||||||
x, z, width, depth = self.skeleton[k]
|
x, z, width, depth, height = self.skeleton[k]
|
||||||
|
|
||||||
|
|
||||||
if k!= 0:
|
if k!= 0:
|
||||||
x+=1
|
x+=1
|
||||||
z+=1
|
z+=1
|
||||||
width-=2
|
width-=2
|
||||||
depth-=2
|
depth-=2
|
||||||
|
x_plan3d = x - self.coordinates_min[0]
|
||||||
|
z_plan3d = z - self.coordinates_min[2]
|
||||||
for i in range(-1, width+1):
|
for i in range(-1, width+1):
|
||||||
for j in range(-1, depth+1):
|
for j in range(-1, depth+1):
|
||||||
for y in range(self.coordinates_min[1], self.coordinates_max[1]):
|
for y in range(0, height):
|
||||||
if i == -1 or i == width or j == -1 or j == depth:
|
if i == -1 or i == width or j == -1 or j == depth:
|
||||||
if not (self.grid[x + i, z + j]['bool']) and not (self.grid[x + i, z + j]['int'] == 1) or (self.grid[x + i, z + j]['bool'] and self.grid[x + i, z + j]['int'] == 2):
|
if not (self.grid[x + i, z + j]['bool']) and not (self.grid[x + i, z + j]['int'] == 1) or (self.grid[x + i, z + j]['bool'] and self.grid[x + i, z + j]['int'] == 2):
|
||||||
self.editor.placeBlock((x + i, y, z + j), Block("stone"))
|
self.editor.placeBlock((x + i, self.coordinates_min[1] + y, z + j), Block("stone"))
|
||||||
|
self.grid3d[ x_plan3d+i, y, z_plan3d+j] = True
|
||||||
#print( i, y, j, self.grid[x + i, z + j]['bool'],self.grid[x + i, z + j]['int'])
|
#print( i, y, j, self.grid[x + i, z + j]['bool'],self.grid[x + i, z + j]['int'])
|
||||||
|
|
||||||
|
|
||||||
def getAdjacentWalls(self):
|
def getAdjacentWalls(self):
|
||||||
main_rect = self.skeleton[0]
|
main_rect = self.skeleton[0]
|
||||||
x_main, z_main, width_main, depth_main = main_rect
|
x_main, z_main, width_main, depth_main, heigt_main = main_rect
|
||||||
adjacent_walls = []
|
adjacent_walls = []
|
||||||
width_main-=1
|
width_main-=1
|
||||||
depth_main-=1
|
depth_main-=1
|
||||||
|
|
||||||
for k in range(1, len(self.skeleton)):
|
for k in range(1, len(self.skeleton)):
|
||||||
x, z, width, depth = self.skeleton[k]
|
x, z, width, depth, heigt = self.skeleton[k]
|
||||||
|
|
||||||
|
|
||||||
walls = [(x, z, x + width-1, z), (x, z, x, z + depth-1), (x, z + depth-1, x + width-1, z + depth-1), (x + width-1, z, x + width-1, z + depth-1)]
|
walls = [(x, z, x + width-1, z), (x, z, x, z + depth-1), (x, z + depth-1, x + width-1, z + depth-1), (x + width-1, z, x + width-1, z + depth-1)]
|
||||||
for wall in walls:
|
for wall in walls:
|
||||||
@@ -189,25 +203,74 @@ class House:
|
|||||||
|
|
||||||
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):
|
||||||
x, z, width, depth = self.skeleton[k]
|
x, z, width, depth, height = self.skeleton[k]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if k!= 0:
|
if k!= 0:
|
||||||
x+=1
|
x+=1
|
||||||
z+=1
|
z+=1
|
||||||
width-=2
|
width-=2
|
||||||
depth-=2
|
depth-=2
|
||||||
n=1
|
if width < depth:
|
||||||
|
if width <=5:
|
||||||
|
n = 1
|
||||||
|
elif width <=10:
|
||||||
|
n = 2
|
||||||
|
else:
|
||||||
|
n = 3
|
||||||
|
else:
|
||||||
|
if depth <=5:
|
||||||
|
n = 1
|
||||||
|
elif depth <=10:
|
||||||
|
n = 2
|
||||||
|
else:
|
||||||
|
n = 3
|
||||||
else:
|
else:
|
||||||
n=2
|
|
||||||
|
if width < depth:
|
||||||
|
n = width // 4
|
||||||
|
else:
|
||||||
|
n = depth // 4
|
||||||
|
|
||||||
|
|
||||||
|
x_plan3d = x - self.coordinates_min[0]
|
||||||
|
z_plan3d = z - self.coordinates_min[2]
|
||||||
for i in range(-1, width+1):
|
for i in range(-1, width+1):
|
||||||
for j in range(-1, depth+1):
|
for j in range(-1, depth+1):
|
||||||
if width<depth:
|
if width<depth:
|
||||||
if (i == width//2 and width ==3):
|
if width%2 != 0:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1]+n, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
if (i == width//2 ):
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+n, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
|
self.grid3d[ x_plan3d+i, height+n, z_plan3d+j] = True
|
||||||
|
if 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), Block("quartz_slab",{"type":"bottom"}))
|
||||||
|
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), Block("quartz_slab",{"type":"top"}))
|
||||||
|
|
||||||
|
elif j == depth:
|
||||||
|
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), Block("quartz_slab",{"type":"bottom"}))
|
||||||
|
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), Block("quartz_slab",{"type":"top"}))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if (j == depth//2 ):
|
if depth%2 != 0:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1]+n, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
if (j == depth//2 ):
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+n, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
|
self.grid3d[ x_plan3d+i, height+n, z_plan3d+j] = True
|
||||||
|
if i== -1 :
|
||||||
|
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), Block("quartz_slab",{"type":"bottom"}))
|
||||||
|
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), Block("quartz_slab",{"type":"top"}))
|
||||||
|
|
||||||
|
elif i == width:
|
||||||
|
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), Block("quartz_slab",{"type":"bottom"}))
|
||||||
|
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), Block("quartz_slab",{"type":"top"}))
|
||||||
|
|
||||||
if width<depth:
|
if width<depth:
|
||||||
|
|
||||||
@@ -218,15 +281,58 @@ class House:
|
|||||||
if h % 1 == 0:
|
if h % 1 == 0:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"top"}))
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"top"}))
|
||||||
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"top"}))
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j), Block("blackstone_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), Block("quartz_block"))
|
||||||
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j -1), Block("quartz_block"))
|
||||||
|
elif j == depth:
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j +1), Block("quartz_block"))
|
||||||
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j +1), Block("quartz_block"))
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1]+h-0.5, z + j), Block("blackstone"))
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h-0.5, z + j), Block("blackstone"))
|
||||||
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h-0.5, z + j), Block("blackstone"))
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h-0.5, z + j), Block("blackstone"))
|
||||||
|
|
||||||
|
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
|
||||||
|
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 :
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j -1), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j -1), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h-1, z + j -1), Block("quartz_slab", {"type": "top"}))
|
||||||
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h-1, z + j -1), Block("quartz_slab", {"type": "top"}))
|
||||||
|
elif j == depth:
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j +1), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j +1), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h-1, z + j +1), Block("quartz_slab", {"type": "top"}))
|
||||||
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h-1, z + j +1), Block("quartz_slab", {"type": "top"}))
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j), Block("blackstone_slab",{"type":"bottom"}))
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j), Block("blackstone_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), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j -1), Block("quartz_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), Block("quartz_slab", {"type": "top"}))
|
||||||
|
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), Block("quartz_slab", {"type": "top"}))
|
||||||
|
elif j == depth:
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]+h, z + j +1), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + width-1-i, self.coordinates_max[1]+h, z + j +1), Block("quartz_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), Block("quartz_slab", {"type": "top"}))
|
||||||
|
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), Block("quartz_slab", {"type": "top"}))
|
||||||
if i != -1:
|
if i != -1:
|
||||||
h += 0.5
|
h += 0.5
|
||||||
else:
|
else:
|
||||||
@@ -238,18 +344,102 @@ class House:
|
|||||||
if h % 1 == 0:
|
if h % 1 == 0:
|
||||||
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + i), Block("blackstone_slab",{"type":"top"}))
|
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + i), Block("blackstone_slab",{"type":"top"}))
|
||||||
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + depth-1-i), Block("blackstone_slab",{"type":"top"}))
|
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + depth-1-i), Block("blackstone_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 ), Block("quartz_block"))
|
||||||
|
self.editor.placeBlock((x + j -1, self.coordinates_max[1]+h, z + depth-1-i ), Block("quartz_block"))
|
||||||
|
elif j == width:
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h, z + i ), Block("quartz_block"))
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h, z + depth-1-i ), Block("quartz_block"))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + i), Block("blackstone_slab",{"type":"bottom"}))
|
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + i), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + depth-1-i), Block("blackstone_slab",{"type":"bottom"}))
|
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + depth-1-i), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
self.editor.placeBlock((x + j, self.coordinates_max[1]+h-0.5, z + i), Block("blackstone"))
|
self.editor.placeBlock((x + j, self.coordinates_max[1]+h-0.5, z + i), Block("blackstone"))
|
||||||
self.editor.placeBlock((x + j, self.coordinates_max[1]+h-0.5, z + depth-1-i), Block("blackstone"))
|
self.editor.placeBlock((x + j, self.coordinates_max[1]+h-0.5, z + depth-1-i), Block("blackstone"))
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if j == -1 :
|
||||||
|
self.editor.placeBlock((x + j -1, self.coordinates_max[1]+h, z + i ), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + j -1, self.coordinates_max[1]+h, z + depth-1-i ), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + j -1, self.coordinates_max[1]+h-1, z + i ), Block("quartz_slab", {"type": "top"}))
|
||||||
|
self.editor.placeBlock((x + j -1, self.coordinates_max[1]+h-1, z + depth-1-i ), Block("quartz_slab", {"type": "top"}))
|
||||||
|
elif j == width:
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h, z + i ), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h, z + depth-1-i ), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h-1, z + i ), Block("quartz_slab", {"type": "top"}))
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h-1, z + depth-1-i ), Block("quartz_slab", {"type": "top"}))
|
||||||
else:
|
else:
|
||||||
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + i), Block("blackstone_slab",{"type":"bottom"}))
|
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + i), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + depth-1-i), Block("blackstone_slab",{"type":"bottom"}))
|
self.editor.placeBlock((x + j, self.coordinates_max[1]+h, z + depth-1-i), Block("blackstone_slab",{"type":"bottom"}))
|
||||||
|
|
||||||
|
self.grid3d[ j, round(height+h), i] = True
|
||||||
|
self.grid3d[ j, round(height+h), depth-1-i] = True
|
||||||
|
|
||||||
|
if j == -1 :
|
||||||
|
self.editor.placeBlock((x + j -1, self.coordinates_max[1]+h, z + i ), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + j -1, self.coordinates_max[1]+h, z + depth-1-i ), Block("quartz_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 ), Block("quartz_slab", {"type": "top"}))
|
||||||
|
if not self.grid3d[ j, height+h-1, depth-1-i]:
|
||||||
|
self.editor.placeBlock((x + j -1, self.coordinates_max[1]+h-1, z + depth-1-i ), Block("quartz_slab", {"type": "top"}))
|
||||||
|
elif j == width:
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h, z + i ), Block("quartz_slab", {"type": "bottom"}))
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h, z + depth-1-i ), Block("quartz_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 ), Block("quartz_slab", {"type": "top"}))
|
||||||
|
if not self.grid3d[ j, height+h-1, depth-1-i]:
|
||||||
|
self.editor.placeBlock((x + j +1, self.coordinates_max[1]+h-1, z + depth-1-i ), Block("quartz_slab", {"type": "top"}))
|
||||||
|
|
||||||
|
|
||||||
|
self.grid3d[ j, round(height+h), i] = True
|
||||||
|
self.grid3d[ j, round(height+h), depth-1-i] = True
|
||||||
|
|
||||||
|
|
||||||
if i != -1:
|
if i != -1:
|
||||||
h += 0.5
|
h += 0.5
|
||||||
|
|
||||||
|
|
||||||
|
QUARTZ_SLAB = Block("quartz_slab", {"type": "top"})
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(-2, width+2):
|
||||||
|
for j in range(-2, depth+2):
|
||||||
|
if i == -2 or i == width+1 or j == -2 or j == depth+1:
|
||||||
|
if not self.grid3d[x_plan3d+i, height-1, z_plan3d+j]['bool']:
|
||||||
|
if width<depth:
|
||||||
|
if i == -2 or i == width+1:
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_max[1]-1, z + j), QUARTZ_SLAB)
|
||||||
|
|
||||||
|
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]
|
||||||
|
|
||||||
|
if k!= 0:
|
||||||
|
x+=1
|
||||||
|
z+=1
|
||||||
|
width-=2
|
||||||
|
depth-=2
|
||||||
|
x_plan3d = x - self.coordinates_min[0]
|
||||||
|
z_plan3d = z - self.coordinates_min[2]
|
||||||
|
for y in range(1,self.nbEtage+1):
|
||||||
|
for i in range(0, width):
|
||||||
|
for j in range(0, depth):
|
||||||
|
self.editor.placeBlock((x + i, self.coordinates_min[1] +4*y, z + j), Block("quartz_block"))
|
||||||
|
self.grid3d[ x_plan3d+i, 4*y, z_plan3d+j] = True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@@ -268,6 +458,7 @@ if __name__ == "__main__":
|
|||||||
print(house.getAdjacentWalls())
|
print(house.getAdjacentWalls())
|
||||||
house.placeDoor()
|
house.placeDoor()
|
||||||
house.placeRoof()
|
house.placeRoof()
|
||||||
|
house.putCelling()
|
||||||
|
|
||||||
new_coordinates_min =(coordinates_max[0] + 10, coordinates_min[1], coordinates_min[2])
|
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_max = (coordinates_max[0] + 10 +24, coordinates_max[1], coordinates_max[2])
|
||||||
|
|||||||
Reference in New Issue
Block a user