dddd
This commit is contained in:
parent
61be80491d
commit
add8915277
8
agent.py
8
agent.py
@ -78,10 +78,12 @@ class Agent:
|
|||||||
self.y = next.y
|
self.y = next.y
|
||||||
|
|
||||||
def check_if_can_move(self, next_coords: Coordinates):
|
def check_if_can_move(self, next_coords: Coordinates):
|
||||||
next_tile = self.warehouse.tiles[next_coords.x][next_coords.y]
|
tile_on_map = 0 <= next_coords.x < self.assigned_warehouse.width and 0 <= next_coords.y < self.assigned_warehouse.height
|
||||||
|
if not tile_on_map:
|
||||||
|
return False
|
||||||
|
next_tile = self.assigned_warehouse.tiles[next_coords.x][next_coords.y]
|
||||||
tile_passable = isinstance(next_tile, Tile) and next_tile.category.passable
|
tile_passable = isinstance(next_tile, Tile) and next_tile.category.passable
|
||||||
tile_on_map = 0 <= next_coords.x < self.warehouse.width and 0 <= next_coords.y < self.warehouse.height
|
return tile_passable
|
||||||
return tile_passable and tile_on_map
|
|
||||||
|
|
||||||
def pick_up_package(self, pack):
|
def pick_up_package(self, pack):
|
||||||
tile = pack.lays_on_field
|
tile = pack.lays_on_field
|
||||||
|
Loading…
Reference in New Issue
Block a user