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

Merge branch '26-bug-when-moving-away-while-cutting-cutting-continues' into 'main'

Resolve "Bug when moving away while cutting, cutting continues"

Closes #26

See merge request scs/cocosy/overcooked-simulator!12
parents d0d9e558 8d2f7f2b
No related branches found
No related tags found
1 merge request!12Resolve "Bug when moving away while cutting, cutting continues"
Pipeline #41861 passed
......@@ -114,9 +114,6 @@ class Environment:
action: The action to be performed
"""
# if action.act_type != "movement":
# print("RECEIVED ACTION:", action)
assert action.player in self.players.keys(), "Unknown player."
player = self.players[action.player]
......@@ -132,8 +129,10 @@ class Environment:
elif action.act_type == "interact":
if action.action == "keydown":
player.perform_interact_hold_start(counter)
elif action.action == "keyup":
player.perform_interact_hold_stop(counter)
player.last_interacted_counter = counter
if action.action == "keyup":
if player.last_interacted_counter:
player.perform_interact_hold_stop(player.last_interacted_counter)
def get_closest_counter(self, point: np.ndarray):
"""Determines the closest counter for a given 2d-coordinate point in the env.
......
......@@ -23,6 +23,9 @@ class Player:
self.move_dist: int = 5
self.interaction_range: int = 60
self.facing_direction: npt.NDArray[float] = np.array([0, 1])
self.last_interacted_counter: Optional[
Counter
] = None # needed to stop progress when moved away
def move(self, movement: npt.NDArray[float]):
"""Moves the player position by the given movement vector.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment