Added maximum mount of container_filling value, it's 100% - one pell it's 25%.

This commit is contained in:
Pavel 2023-04-14 00:25:35 +02:00
parent 029bcb1986
commit 7dd2190c76
3 changed files with 8 additions and 5 deletions

View File

@ -31,8 +31,9 @@ class VacuumMoveCommand(Command):
return
if self.world.is_garbage_at(end_x, end_y):
self.vacuum.increase_container_filling()
self.world.dust[end_x][end_y].pop()
if self.vacuum.get_container_filling() < 100:
self.vacuum.increase_container_filling()
self.world.dust[end_x][end_y].pop()
if self.world.is_docking_station_at(end_x, end_y):
self.vacuum.dump_trash()

View File

@ -10,9 +10,12 @@ class Vacuum(Entity):
self.container_filling = 0
def increase_container_filling(self) -> None:
self.container_filling += 10
self.container_filling += 25
def dump_trash(self) -> None:
self.container_filling = 0
def get_container_filling(self):
return self.container_filling
# TODO VACUUM: add more properties

View File

@ -63,7 +63,6 @@ class Main:
def update(self):
self.commands.append(RandomCatMoveCommand(self.world, self.world.cat))
for command in self.commands:
command.run()
self.commands.clear()
@ -76,7 +75,7 @@ def generate_world(tiles_x: int, tiles_y: int) -> World:
temp_y = randint(0, tiles_y - 1)
world.add_entity(Entity(temp_x, temp_y, "PEEL"))
world.vacuum = Vacuum(1, 1)
world.doc_station = Doc_Station(9, 9)
world.doc_station = Doc_Station(9, 8)
world.cat = Cat(7, 8)
world.add_entity(world.cat)
world.add_entity(Entity(2, 8, "PLANT1"))