From 74b9b926c40b9f71c38837bd1e6ad3fdcd126654 Mon Sep 17 00:00:00 2001 From: fheinrich <fheinrich@techfak.uni-bielefeld.de> Date: Thu, 1 Feb 2024 10:58:07 +0100 Subject: [PATCH] Dispenser items are moved --- overcooked_simulator/gui_2d_vis/drawing.py | 18 +++++++++++++++++- .../gui_2d_vis/visualization.yaml | 10 ++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/overcooked_simulator/gui_2d_vis/drawing.py b/overcooked_simulator/gui_2d_vis/drawing.py index 5d047bd2..c8a14b92 100644 --- a/overcooked_simulator/gui_2d_vis/drawing.py +++ b/overcooked_simulator/gui_2d_vis/drawing.py @@ -451,11 +451,27 @@ class Visualizer: for counter in state["counters"]: if counter["occupied_by"]: + item_pos = counter["pos"] + + counter_type = counter["type"] + if counter_type.endswith("Dispenser"): + if "item_offset" in self.config["Dispenser"].keys(): + offset_vec = pygame.math.Vector2( + self.config["Dispenser"]["item_offset"] + ) + offset_vec.rotate_ip( + offset_vec.angle_to( + pygame.math.Vector2(counter["orientation"]) + ) + + 180 + ) + item_pos += offset_vec + self.draw_counter_occupier( screen, counter["occupied_by"], grid_size, - np.array(counter["pos"]) * grid_size, + np.array(item_pos) * grid_size, ) if SHOW_COUNTER_CENTERS: diff --git a/overcooked_simulator/gui_2d_vis/visualization.yaml b/overcooked_simulator/gui_2d_vis/visualization.yaml index bc1a29b0..3ef2f3a3 100644 --- a/overcooked_simulator/gui_2d_vis/visualization.yaml +++ b/overcooked_simulator/gui_2d_vis/visualization.yaml @@ -89,10 +89,12 @@ Trashcan: Dispenser: parts: [ ] -# - color: gray83 -# type: rect -# height: 0.8 -# width: 0.8 + # - color: gray83 + # type: rect + # height: 0.8 + # width: 0.8 + item_offset: [ 0, -0.15 ] + ServingWindow: parts: -- GitLab