diff --git a/overcooked_simulator/gui_2d_vis/overcooked_gui.py b/overcooked_simulator/gui_2d_vis/overcooked_gui.py index d7375be76f643e63e7507dda99abb8002678beb5..db5c818802b9257e14bea4608acf76d94d9bd03e 100644 --- a/overcooked_simulator/gui_2d_vis/overcooked_gui.py +++ b/overcooked_simulator/gui_2d_vis/overcooked_gui.py @@ -549,15 +549,18 @@ class PyGameGUI: self.timer_label.set_text(f"Time remaining: {display_time}") def draw_orders(self, state): - orders = [ - "Burger", - "TomatoSoupPlate", - "OnionSoupPlate", - "OnionSoupPlate", - "OnionSoupPlate", - "OnionSoupPlate", - ] - + # print(state["orders"]) + # for o in state["orders"]: + # print(o.meal.name) + # orders = [ + # "Burger", + # "TomatoSoupPlate", + # "OnionSoupPlate", + # "OnionSoupPlate", + # "OnionSoupPlate", + # "OnionSoupPlate", + # ] + orders = [o.meal.name for o in state["orders"]] orders_width = self.game_width - 100 orders_height = self.screen_margin self.orders_screen = pygame.Surface( diff --git a/overcooked_simulator/gui_2d_vis/visualization.yaml b/overcooked_simulator/gui_2d_vis/visualization.yaml index bef233b6af08f9d8be8ad301dcd47f74b01f208f..35ce1d927a7b5f72a2655932b45e9488703834eb 100644 --- a/overcooked_simulator/gui_2d_vis/visualization.yaml +++ b/overcooked_simulator/gui_2d_vis/visualization.yaml @@ -193,6 +193,12 @@ Burger: path: images/burger.png size: 0.8 +Salad: + parts: + - type: image + path: images/salad.png + size: 0.8 + TomatoSoup: parts: - type: image diff --git a/overcooked_simulator/order.py b/overcooked_simulator/order.py index 589e588e11327819697673241b5317ae9acf00ad..fc10a405fe428e901b703467aa6bacf8fe2babbb 100644 --- a/overcooked_simulator/order.py +++ b/overcooked_simulator/order.py @@ -88,6 +88,7 @@ class RandomOrderGeneration(OrderGeneration): return self.create_orders_for_meals( random.choices(self.available_meals, k=self.kwargs.num_start_meals), now, + self.kwargs.sample_on_serving, ) def get_orders( @@ -100,6 +101,7 @@ class RandomOrderGeneration(OrderGeneration): return self.create_orders_for_meals( random.choices(self.available_meals, k=len(new_finished_orders)), now, + True, ) if self.kwargs.sample_on_dur: if self.needed_orders: @@ -122,16 +124,21 @@ class RandomOrderGeneration(OrderGeneration): ) return [] - def create_orders_for_meals(self, meals: list[Item], now: datetime) -> list[Order]: + def create_orders_for_meals( + self, meals: list[Item], now: datetime, no_time_limit: bool = False + ) -> list[Order]: orders = [] for meal in meals: - duration = timedelta( - seconds=int( - getattr(random, self.kwargs.duration_sample["func"])( - **self.kwargs.duration_sample["kwargs"] + if no_time_limit: + duration = datetime.max - now + else: + duration = timedelta( + seconds=int( + getattr(random, self.kwargs.duration_sample["func"])( + **self.kwargs.duration_sample["kwargs"] + ) ) ) - ) log.info(f"Create order for meal {meal} with duration {duration}") orders.append( Order(