Vacuum_cleaning-ability #16

Merged
s473601 merged 4 commits from Vacuum_cleaning-ability into main 2023-04-14 13:54:03 +02:00
3 changed files with 8 additions and 5 deletions
Showing only changes of commit 7dd2190c76 - Show all commits

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"))