corrections corners bugs, clean tree structure and start entrance

This commit is contained in:
AKreuzer
2024-06-11 03:06:06 +02:00
parent 536c71d372
commit de3950d376
21 changed files with 153 additions and 86 deletions

View File

@@ -1,16 +1,17 @@
import random as rd
from gdpc import Editor, Block, geometry
from utils.functions import *
from utils.Enums import BALCONY_BORDER_RADIUS
from utils.Enums import BALCONY_BORDER_RADIUS,COLLUMN_STYLE
from buildings.geometry.Point import Point
from buildings.geometry.Vertice import Vertice
from buildings.elements.Window import Window
class Balcony:
def __init__(self, rdata, max_width : int, windows : Window):
def __init__(self, rdata, max_width : int, windows : Window, collumn_style : COLLUMN_STYLE):
self.rdata = rdata
self.windows = windows
self.max_width = max_width
self.collumn_style = collumn_style
self.length = self.get_len()
self.has_multiple = self.has_multiple()
self.has_details = self.has_details()
@@ -94,7 +95,8 @@ class Balcony:
def get_attach_points(self) -> list[int]:
# points where the structures can start/finish
points = [i for i in range(self.max_width)]
padding = 0 if self.collumn_style.value < 2 else 1 # collumn_style < 2 = no outer collumns
points = [i + padding for i in range(self.max_width)]
if self.follow_window:
pad = self.windows.padding
for w in self.windows.windows:
@@ -104,7 +106,7 @@ class Balcony:
return points
def create_structure(self, x1 : int, x2 : int) -> Vertice:
return Vertice(Point(x1,0,0), Point(x2,0,-self.length))
return Vertice(Point(x = x1), Point(x = x2,z = -self.length))
def append_structure(self, structures : list[Vertice], x1 : int, x2 : int, attach_points : list[int], len_attach_points : int, centered : bool):
structures.append(self.create_structure(attach_points[x1], attach_points[x2]))

View File

@@ -8,4 +8,7 @@ class Collumn(Rectangle):
def set_is_outer(self, is_outer : bool):
self.is_outer = is_outer
def __repr__(self):
return super().__repr__() + f"\nIs outer : {self.is_outer}\n\n"

View File

@@ -0,0 +1,3 @@
class Buttons:
def __init__(self):
pass

View File

@@ -5,7 +5,7 @@ from utils.Enums import WINDOW_BORDER_RADIUS
from utils.functions import *
from buildings.geometry.Point import Point
from buildings.geometry.Vertice import Vertice
from buildings.elements.Glass import Glass
from buildings.elements.WindowElt.Glass import Glass
class Window:
def __init__(self, rdata, max_width : int, max_height : int, facade_len : int, facade_height : int):
@@ -31,7 +31,7 @@ class Window:
if leng > 1: self.build_border_radius(g.x1, g.x2)
def build_crossbars(self, x1 : int, x2 : int, len : int):
if self.has_vertical_crossbar and self.height >= self.rdata["crossbars"]["min_height_for_vertical_crossbar"]:
if self.has_vertical_crossbar and self.height+1 >= self.rdata["crossbars"]["min_height_for_vertical_crossbar"]:
y = self.height//2
geometry.placeCuboid(self.editor,(x1,y,0),(x2,y,0),Block(self.materials[3]))
if self.has_horizontal_crossbar and len >= self.rdata["crossbars"]["min_width_for_horizontal_crossbar"]:
@@ -46,7 +46,6 @@ class Window:
self.editor.placeBlock((x1,0,0),Block(self.materials[4], {"facing": "west"}))
self.editor.placeBlock((x2,0,0),Block(self.materials[4], {"facing": "east"}))
def get_windows(self) -> list[Glass]:
windows = []
if not self.has_multiple: windows = [Glass(0,self.width-1,[self.create_window(0, self.width)])]
@@ -103,7 +102,7 @@ class Window:
def create_window(self, x1 : int, length : int = None) -> Vertice:
x2 = x1 if length is None else x1 + length -1
return Vertice(Point(x1,0,0), Point(x2,self.height,0))
return Vertice(Point(x = x1), Point(x2,self.height))
def has_multiple_windows(self):
if self.width > self.rdata["size"]["max_width"]: return True