|
|
|
@ -5,6 +5,7 @@ Python class for DF_Hack::Maps
|
|
|
|
|
from ._pydfhack import _MapManager
|
|
|
|
|
from .mixins import NeedsStart
|
|
|
|
|
from .decorators import suspend
|
|
|
|
|
from .blocks import Block, Point
|
|
|
|
|
|
|
|
|
|
class Map(NeedsStart, _MapManager):
|
|
|
|
|
api = None
|
|
|
|
@ -14,15 +15,18 @@ class Map(NeedsStart, _MapManager):
|
|
|
|
|
self.api = api
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Write_Tile_Types(self, x=0, y=0, z=0, tiles=None, point=None):
|
|
|
|
|
def get_size(self):
|
|
|
|
|
return self.size
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Is_Valid_Block(self, x=0, y=0, z=0, point=None):
|
|
|
|
|
"""
|
|
|
|
|
Checks if coords are valid
|
|
|
|
|
"""
|
|
|
|
|
if point:
|
|
|
|
|
point = point.get_block()
|
|
|
|
|
x, y, z = point.xyz
|
|
|
|
|
return self.cls.Write_Tile_Types(self, x, y, z, tiles)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Write_Occupancy(self, *args, **kw):
|
|
|
|
|
return self.cls.Write_Occupancy(self, *args, **kw)
|
|
|
|
|
return self.cls.Is_Valid_Block(self, x, y, z)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Read_Tile_Types(self, x=0, y=0, z=0, point=None):
|
|
|
|
@ -36,25 +40,42 @@ class Map(NeedsStart, _MapManager):
|
|
|
|
|
return self.cls.Read_Tile_Types(self, x, y, z)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Is_Valid_Block(self, *args, **kw):
|
|
|
|
|
return self.cls.Is_Valid_Block(self, *args, **kw)
|
|
|
|
|
def Write_Tile_Types(self, x=0, y=0, z=0, tiles=None, point=None):
|
|
|
|
|
if point:
|
|
|
|
|
point = point.get_block()
|
|
|
|
|
x, y, z = point.xyz
|
|
|
|
|
return self.cls.Write_Tile_Types(self, x, y, z, tiles)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Read_Designations(self, x=0, y=0, z=0, point=None):
|
|
|
|
|
"""
|
|
|
|
|
Returns 16x16 block in form of list of lists.
|
|
|
|
|
"""
|
|
|
|
|
if point:
|
|
|
|
|
point = point.get_block()
|
|
|
|
|
x, y, z = point.xyz
|
|
|
|
|
return self.cls.Read_Designations(self, x, y, z)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Write_Designations(self, x=0, y=0, z=0, tiles=None, point=None):
|
|
|
|
|
if point:
|
|
|
|
|
point = point.get_block()
|
|
|
|
|
x, y, z = point.xyz
|
|
|
|
|
return self.cls.Write_Designations(self, x, y, z, tiles)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Write_Occupancy(self, *args, **kw):
|
|
|
|
|
return self.cls.Write_Occupancy(self, *args, **kw)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Write_Dirty_Bit(self, *args, **kw):
|
|
|
|
|
return self.cls.Write_Dirty_Bit(self, *args, **kw)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Read_Designations(self, *args, **kw):
|
|
|
|
|
return self.cls.Read_Designations(self, *args, **kw)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Write_Block_Flags(self, *args, **kw):
|
|
|
|
|
return self.cls.Write_Block_Flags(self, *args, **kw)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Write_Designations(self, *args, **kw):
|
|
|
|
|
return self.cls.Write_Designations(self, *args, **kw)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def Read_Region_Offsets(self, *args, **kw):
|
|
|
|
|
return self.cls.Read_Region_Offsets(self, *args, **kw)
|
|
|
|
@ -80,5 +101,16 @@ class Map(NeedsStart, _MapManager):
|
|
|
|
|
return self.cls.Read_Block_40d(self, *args, **kw)
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def get_size(self):
|
|
|
|
|
return self.size
|
|
|
|
|
def get_block(self, point):
|
|
|
|
|
point = point.get_block()
|
|
|
|
|
block = Block(api=self.api, coords=point)
|
|
|
|
|
return block
|
|
|
|
|
|
|
|
|
|
@suspend
|
|
|
|
|
def get_tile(self, x=0, y=0, z=0, point=None):
|
|
|
|
|
if not point:
|
|
|
|
|
point = Point(x, y, z)
|
|
|
|
|
block = Block(api=self.api, coords=point.get_block())
|
|
|
|
|
return block.get_tile(point=point)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|