start balcony

This commit is contained in:
AKreuzer
2024-05-26 15:28:47 +02:00
parent e47c8cf7ce
commit 33b34108e5
4 changed files with 28 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ from utils.Enums import COLLUMN_STYLE
from gdpc import Editor, Block, geometry, Transform from gdpc import Editor, Block, geometry, Transform
from buildings.geometry.Vertice import Vertice from buildings.geometry.Vertice import Vertice
from buildings.elements.Window import Window from buildings.elements.Window import Window
from buildings.elements.Balcony import Balcony
class Facade: 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], height : int, length : int, is_inner_or_outer : COLLUMN_STYLE):
@@ -36,7 +37,12 @@ class Facade:
return Window(self.rdata["windows"] ,max_width, max_height) return Window(self.rdata["windows"] ,max_width, max_height)
def build_inter_floor(self, vertice : Vertice): 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)
def build_inter_floor(self):
if self.has_inter_floor: 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,-1),(self.length,self.height,-1),Block(self.materials[4], {"facing": "south", "half": "top"}))

View File

@@ -1,4 +1,13 @@
import random as rd
from buildings.elements.Window import Window
class Balcony: class Balcony:
def __init__(self, length, width): def __init__(self, rdata, length : int, max_width : int, windows : Window):
self.rdata = rdata
self.length = length self.length = length
self.width = width self.max_width = max_width
self.windows = windows
def has_multiple_balcony(self):
if self.max_width < self.rdata["balcony"]["multiple"]["min_width"]: return False
return self.rdata["balcony"]["multiple"]["proba"] >= rd.random()

View File

@@ -40,4 +40,12 @@ buildings:
top: 1 top: 1
top_and_bottom: 1 top_and_bottom: 1
inter_floor: 0.5 inter_floor: 0.5
balcony: 0.25 balcony:
proba : 0.25
size:
min_len : 1
max_len : 3
min_width : 3
multiple:
min_width: 5
proba: 0.5