Skip to content
Snippets Groups Projects
Commit f98d32a7 authored by Fabian Heinrich's avatar Fabian Heinrich
Browse files

Fixed main merged, adjusted polygon

parent 9b106212
No related branches found
No related tags found
1 merge request!42Resolve "FOV of the players, fog-of-war like vision"
Pipeline #45616 passed
......@@ -165,14 +165,16 @@ class Visualizer:
screen,
colors["black"],
(
pos - (direction * grid_size * 0.8),
pos - (direction * grid_size * 0.6),
left_beam,
left_beam + (direction.rotate(90) * rect_scale),
pos
- (direction * rect_scale * 2)
+ (direction.rotate(90) * rect_scale),
pos
- (direction * rect_scale * 2)
+ (direction.rotate(-90) * rect_scale),
right_beam + (direction.rotate(-90) * rect_scale),
right_beam,
),
)
......
......@@ -754,7 +754,8 @@ class Environment:
def get_json_state(self, player_id: str = None) -> str:
if player_id in self.players:
self.hook(PRE_STATE, player_id=player_id)state = {
self.hook(PRE_STATE, player_id=player_id)
state = {
"players": [p.to_dict() for p in self.players.values()],
"counters": [c.to_dict() for c in self.counters],
"kitchen": {"width": self.kitchen_width, "height": self.kitchen_height},
......@@ -768,12 +769,14 @@ class Environment:
"view_restriction": [
self.players[player_id].facing_direction.tolist(),
self.players[player_id].pos.tolist(),
40.0,
35.0,
]
if FOG_OF_WAR
else None,
}self.hook(STATE_DICT, state=state, player_id=player_id)
json_data = json.dumps(state)self.hook(JSON_STATE, json_data=json_data, player_id=player_id)
}
self.hook(STATE_DICT, state=state, player_id=player_id)
json_data = json.dumps(state)
self.hook(JSON_STATE, json_data=json_data, player_id=player_id)
assert StateRepresentation.model_validate_json(json_data=json_data)
return json_data
raise ValueError(f"No valid {player_id=}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment