diff --git a/celeste/celeste_ai/celeste.py b/celeste/celeste_ai/celeste.py index 0ee166e..d7fdf13 100755 --- a/celeste/celeste_ai/celeste.py +++ b/celeste/celeste_ai/celeste.py @@ -102,7 +102,7 @@ class Celeste: self, pico_path, *, - state_timeout = 30, + state_timeout = 20, cart_name = "hackcel.p8", ): @@ -147,7 +147,7 @@ class Celeste: self._resetting = False # True between a call to .reset() and the first state message from pico. self._keys = {} # Dictionary of "key": bool - def act(self, action: str): + def act(self, action: str | int): """ Specify what keys should be down. This does NOT send key events. Celeste._apply_keys() does that at the right time. @@ -156,6 +156,9 @@ class Celeste: action (str): key name, as in Celeste.action_space """ + if isinstance(action, int): + action = Celeste.action_space[action] + self._keys = {} if action is None: return