إصلاح إحداثيات الخلل واتجاه الباب

This commit is contained in:
AKreuzer
2024-06-15 22:57:38 +02:00
parent 990b66051c
commit 74939422e7
3 changed files with 26 additions and 18 deletions

View File

@@ -7,29 +7,28 @@ from buildings.Entrance import Entrance
from buildings.Roof import Roof
class Building:
def __init__(self,rdata, position : tuple[int,int], size : tuple[int, int], matrice : list[list[int]], floors : int):
self.position = position
self.length, self.width = size
def __init__(self,rdata, positions : list[tuple[int,int,int]], matrice : list[list[int]], doors_direction : DIRECTION):
self.position = (0,0,0)
self.length, self.width, self.height = 0,0,0
self.matrice = matrice
self.floors = floors
# Generate every random components here
self.get_pos_and_size(positions)
tile_size = self.gen_tile_size()
self.foundations = Foundations(rdata["foundations"], size, matrice, tile_size,)
self.foundations = Foundations(rdata["foundations"], (self.length,self.width), matrice, tile_size,)
self.facade = Facade(rdata["facade"], self.foundations.vertices, self.foundations.is_inner_or_outer)
self.entrance = Entrance(rdata, self.foundations.vertices, DIRECTION.EAST, self.foundations.is_inner_or_outer)
self.entrance = Entrance(rdata, self.foundations.vertices, doors_direction, self.foundations.is_inner_or_outer)
self.roof = Roof(rdata["roof"], self.foundations.polygon)
def build(self, editor : Editor, materials : list[str]):
for y in range(self.floors+1):
with editor.pushTransform((self.position[0], y*(self.foundations.floor_height+1) -1, self.position[1])):
if y == self.floors:
self.roof.build(editor, materials)
break
y=0
while y < self.height:
with editor.pushTransform((self.position[0], y -1, self.position[1])):
self.foundations.build(editor, materials)
if y == 0: self.entrance.build(editor, materials)
else : self.facade.build(editor, materials)
y+=self.foundations.floor_height+1
with editor.pushTransform((self.position[0], y -1, self.position[1])): self.roof.build(editor, materials)
def gen_tile_size(self) -> int:
# Tiles are constant square units different for each buildings
@@ -40,4 +39,11 @@ class Building:
if smaller_side <= 15 : return smaller_side // 5
return rd.randint(3, smaller_side // len(self.matrice))
def get_pos_and_size(self, pos : list[tuple[int,int,int]]) -> tuple[tuple[int,int],int,int]:
pos1, pos2 = pos[0], pos[1]
self.position = (min(pos1[0], pos2[0]), min(pos1[1], pos2[1]), min(pos1[2], pos2[2]))
self.length = abs(pos1[0] - pos2[0])
self.height = abs(pos1[1] - pos2[1])
self.width = abs(pos1[2] - pos2[2])

View File

@@ -3,10 +3,9 @@ toit de balcon avec/sans pilliers
collumn style
rembard object
détails facade
rdc
Entrance style
toit (clim, chateau deau, pubs)
tiles 3d
textures object
opti textures
opti géométrique
opti gdpc
@@ -17,4 +16,5 @@ matrices pré-distribués
angles 270
bug entrée au milieu du O
bug entrée dans le pillier
center le building dans son area (ou pas)
center le building dans son area (ou pas)
position building