hotfix number 46 and optimization number 956 on windows

This commit is contained in:
AKreuzer
2024-05-27 22:52:09 +02:00
parent 33b34108e5
commit 1371be4132
7 changed files with 145 additions and 86 deletions

View File

@@ -6,12 +6,11 @@ from buildings.elements.Window import Window
from buildings.elements.Balcony import Balcony
class Facade:
def __init__(self, rdata, vertices : list[Vertice], height : int, length : int, is_inner_or_outer : COLLUMN_STYLE):
def __init__(self, rdata, vertices : list[Vertice], is_inner_or_outer : COLLUMN_STYLE):
self.rdata = rdata
self.vertices = vertices
self.is_inner_or_outer = is_inner_or_outer
self.height = height
self.length = length
self.height, self.length = self.get_dimentions()
self.padding = 0
self.window = self.get_window()
self.has_balcony = self.has_balcony()
@@ -25,8 +24,8 @@ class Facade:
for vertice in self.vertices:
vertice.fill(editor, materials[0], self.height, xpadding = self.padding, zpadding = self.padding)
with editor.pushTransform(Transform(vertice.point1.position,rotation = vertice.facing.value)):
self.build_inter_floor(vertice)
self.window.build(editor, vertice.get_len(), self.height, materials)
self.window.build(editor, materials)
self.build_inter_floor()
def get_window(self) -> Window:
if self.is_inner_or_outer == COLLUMN_STYLE.OUTER or self.is_inner_or_outer == COLLUMN_STYLE.BOTH:
@@ -35,20 +34,23 @@ class Facade:
max_width = self.length-2*self.padding
max_height = min(self.height, self.rdata["windows"]["size"]["max_height"])
return Window(self.rdata["windows"] ,max_width, max_height)
return Window(self.rdata["windows"] ,max_width, max_height, self.length, self.height)
def get_balcony(self) -> Balcony:
len = rd.randint(self.rdata["balcony"]["size"]["min_len"], self.rdata["balcony"]["size"]["max_len"])
max_width = self.length-2*self.padding
return Balcony(len, max_width, self.window)
return Balcony(self.rdata["balcony"], max_width, self.window)
def build_inter_floor(self):
if self.has_inter_floor:
geometry.placeCuboid(self.editor,(0,self.height,-1),(self.length,self.height,-1),Block(self.materials[4], {"facing": "south", "half": "top"}))
geometry.placeCuboid(self.editor,(0,self.height,0),(self.length-1,self.height,0),Block(self.materials[0]))
geometry.placeCuboid(self.editor,(0,self.height,-1),(self.length-1,self.height,-1),Block(self.materials[4], {"facing": "south", "half": "top"}))
def has_balcony(self) -> bool:
return self.rdata["balcony"] >= rd.random()
return self.rdata["balcony"]["proba"] >= rd.random()
def has_inter_floor(self) -> bool:
return self.rdata["inter_floor"] >= rd.random()
def get_dimentions(self) -> tuple[int]:
return ( self.vertices[0].get_height(), self.vertices[0].get_len())