51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
from pyblockworld import World
|
|
|
|
class Wall:
|
|
__length:int
|
|
__width:int
|
|
__height:int
|
|
__rotated:bool
|
|
__x:float
|
|
__y:float
|
|
__z:float
|
|
__world:World
|
|
__block:str
|
|
|
|
def __init__(self, x:float, y:float, z:float, block:str, world:World, length=10, width=10, height=5, rotated=False):
|
|
self.__width = width
|
|
self.__length = length
|
|
self.__height = height
|
|
self.__x = x
|
|
self.__y = y - 1
|
|
self.__z = z
|
|
self.__world = world
|
|
self.__rotated = rotated
|
|
self.__block = block
|
|
|
|
def build(self):
|
|
if self.__rotated:
|
|
self.__world.setBlocks(self.__x, self.__y, self.__z, self.__x + self.__width, self.__y + self.__height, self.__z, self.__block)
|
|
else:
|
|
self.__world.setBlocks(self.__x, self.__y, self.__z, self.__x, self.__y + self.__height, self.__z + self.__length, self.__block)
|
|
|
|
def getWidth(self):
|
|
return self.__width
|
|
|
|
def getHeight(self):
|
|
return self.__height
|
|
|
|
def getLength(self):
|
|
return self.__length
|
|
|
|
def getWorld(self):
|
|
return self.__world
|
|
|
|
def getX(self):
|
|
return self.__x
|
|
def getY(self):
|
|
return self.__y
|
|
def getZ(self):
|
|
return self.__z
|
|
|
|
def getRotated(self):
|
|
return self.__rotated |