60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
from attributes import PackSize
|
|
import random
|
|
|
|
class CategoryData:
|
|
def __init__(self, name, passable=False, can_store=True, location='general', pack_size=PackSize.ALL):
|
|
self.name = name
|
|
self.passable = passable
|
|
self.can_store = can_store
|
|
self.location = location
|
|
self.pack_size = pack_size
|
|
|
|
def __repr__(self):
|
|
return self.name
|
|
|
|
class Pack:
|
|
def __init__(self, size, categ='general'):
|
|
self.size = size
|
|
self.category = categ
|
|
|
|
|
|
CATEGORY = {
|
|
'floor': CategoryData('Floor', True, False), #lava
|
|
'rack': CategoryData('Rack', False, True),
|
|
# 'freezer': CategoryData('Freezer', False, True, location='cold_room')
|
|
}
|
|
|
|
|
|
class Warehouse:
|
|
def __init__(self, width, length):
|
|
self.width = width
|
|
self.length = length
|
|
self.tiles = self.generate_map()
|
|
|
|
def __str__(self):
|
|
return "Magazyn {}x{}".format(self.width, self.length)
|
|
|
|
def generate_map(self):
|
|
warehouse_tiles = []
|
|
categories = list(CATEGORY.keys())
|
|
for x in range(self.width):
|
|
row = [Tile('floor', x, y) for y in range(self.length)]
|
|
warehouse_tiles.append(row)
|
|
|
|
# warehouse_tiles = self.create_racks(20, warehouse_tiles)
|
|
return warehouse_tiles
|
|
|
|
# def create_racks(self, number_of_racks=0, warehouse_tiles=[]):
|
|
|
|
|
|
class Tile:
|
|
def __init__(self, category, x_position, y_position):
|
|
self.category = CATEGORY.get(category, CATEGORY['floor'])
|
|
self.x_position = x_position
|
|
self.y_position = y_position
|
|
|
|
def __str__(self):
|
|
return "Tile type: {} on position ({},{})".format(self.category, self.x_position, self.y_position)
|
|
|
|
def __repr__(self):
|
|
return "Tile type: {} on position ({},{})".format(self.category, self.x_position, self.y_position) |