Skip to content
Snippets Groups Projects
Commit 02e52ea9 authored by Florian Schröder's avatar Florian Schröder
Browse files

Update `get_state_image` to handle controlled players list

Enhanced `get_state_image` to accept a list of controlled players, defaulting to a single player if not provided. This change ensures that the drawing function correctly interprets the input for controlled players, improving the function's flexibility and usability.
parent d7cfbab7
No related branches found
No related tags found
2 merge requests!110V1.2.0 changes,!104Resolve "Faster Drawing"
Pipeline #58989 failed
...@@ -937,8 +937,10 @@ class Visualizer: ...@@ -937,8 +937,10 @@ class Visualizer:
pygame.image.save(screen, filename) pygame.image.save(screen, filename)
def get_state_image(self, state: dict, def get_state_image(self, state: dict,
cache_flags: CacheFlags = CacheFlags.COUNTERS | CacheFlags.BACKGROUND) -> npt.NDArray[np.uint8]: cache_flags: CacheFlags = CacheFlags.COUNTERS | CacheFlags.BACKGROUND,
screen = self.draw_gamescreen(state, [0 for _ in state["players"]], cache_flags=cache_flags) controlled_players: list[int] = None,
) -> npt.NDArray[np.uint8]:
screen = self.draw_gamescreen(state, [0] if controlled_players is None else controlled_players, cache_flags=cache_flags)
return pygame.surfarray.pixels3d(screen) return pygame.surfarray.pixels3d(screen)
def draw_recipe_image( def draw_recipe_image(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment