Mark
/
celeste-ai
Archived
1
0
Fork 0

Lowered timeout and improved act()

master
Mark 2023-02-26 12:10:27 -08:00
parent 03135e2ef9
commit c185965657
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 5 additions and 2 deletions

View File

@ -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