From c3fc592f844f7d04c257f1e6ccc94dd16fc53ddb Mon Sep 17 00:00:00 2001 From: KAymeric Date: Tue, 4 Jun 2024 19:07:50 +0200 Subject: [PATCH] some critical fixes on balcony --- buildings/elements/Balcony.py | 8 +++++--- main.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/buildings/elements/Balcony.py b/buildings/elements/Balcony.py index 9d9edd0..fcab85e 100644 --- a/buildings/elements/Balcony.py +++ b/buildings/elements/Balcony.py @@ -20,8 +20,8 @@ class Balcony: def get_structures(self) -> list[Vertice]: attach_points = self.get_attach_points() - len_attach_points = len(attach_points) - min_wid = self.rdata["size"]["min_width"] -1 + len_attach_points = len(attach_points)-1 + min_wid = self.rdata["size"]["min_width"] min_gap = self.rdata["multiple"]["min_gap"] growth_chance = self.rdata["growth"] midpoint = len_attach_points//2 @@ -32,6 +32,7 @@ class Balcony: while True: x1 -= 1 x2 += 1 if centered else 0 + print(x1,x2, attach_points) leng = attach_points[x2] - attach_points[x1] - 1 if x1 == 0: @@ -46,6 +47,7 @@ class Balcony: if not self.has_multiple: break else: + print(x1,min_wid, min_gap) if x1-min_wid < min_gap: break gap = rd.randint(min_gap, x1-min_wid) x2 = x1-gap @@ -64,7 +66,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-1)) + return Vertice(Point(x1,0,0), Point(x2,0,-self.length+1)) def follow_window(self) -> bool: return self.windows.ypadding > 3 diff --git a/main.py b/main.py index 55c4506..45fe8f5 100644 --- a/main.py +++ b/main.py @@ -24,7 +24,7 @@ random_data = y.data transform = Transform((0,-60,-5),rotation = 0) editor.transform.push(transform) -geometry.placeCuboid(editor, (0,0,-1), (100,15,1), Block("air")) +geometry.placeCuboid(editor, (0,0,-3), (100,15,1), Block("air")) x = 0