diff --git a/overcooked_simulator/gui_2d_vis/drawing.py b/overcooked_simulator/gui_2d_vis/drawing.py index 5d047bd2df564eb53b9da0f2ca02960440c0e475..c8a14b92e40926f7e1db80bd3269bf0088a16e9b 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 bc1a29b095cdcd0ad2fb2cdf49d1d2902073ea46..3ef2f3a3d79b980f9c92e32b795ac4c1f2204e1b 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: