Added custom district generator and old GDMC functions and classes (to get the height, water and tree map)

This commit is contained in:
NichiHachi
2024-06-11 04:56:54 +02:00
parent 6e5359c8af
commit c8abb90a84
10 changed files with 541 additions and 0 deletions

34
world_maker/Block.py Normal file
View File

@@ -0,0 +1,34 @@
from gdpc import Editor, Block, geometry
from gdpc.lookup import *
import numpy as np
import math
SOLID_NATURAL_BLOCKS = SOILS | STONES | ORES | LIQUIDS
class Block:
def __init__(self, coordinates:tuple, name:str):
self.coordinates = coordinates
self.name = name
self.neighbors = []
self.surface = None
def addNeighbors(self, neighbors:list[Block]):
for neighbor in neighbors:
self.neighbors.append(neighbor)
def isSurface(self):
if self.surface == None:
if str(self.name) in SOLID_NATURAL_BLOCKS:
for neighbor in self.neighbors:
if str(neighbor.name) not in SOLID_NATURAL_BLOCKS:
self.surface = True
return True
if len(self.neighbors) != 0:
self.surface = False
return False
else:
self.surface = False
return False
else:
return self.surface