Lowered timeout and improved act()
parent
03135e2ef9
commit
c185965657
|
@ -102,7 +102,7 @@ class Celeste:
|
||||||
self,
|
self,
|
||||||
pico_path,
|
pico_path,
|
||||||
*,
|
*,
|
||||||
state_timeout = 30,
|
state_timeout = 20,
|
||||||
cart_name = "hackcel.p8",
|
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._resetting = False # True between a call to .reset() and the first state message from pico.
|
||||||
self._keys = {} # Dictionary of "key": bool
|
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.
|
Specify what keys should be down. This does NOT send key events.
|
||||||
Celeste._apply_keys() does that at the right time.
|
Celeste._apply_keys() does that at the right time.
|
||||||
|
@ -156,6 +156,9 @@ class Celeste:
|
||||||
action (str): key name, as in Celeste.action_space
|
action (str): key name, as in Celeste.action_space
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if isinstance(action, int):
|
||||||
|
action = Celeste.action_space[action]
|
||||||
|
|
||||||
self._keys = {}
|
self._keys = {}
|
||||||
if action is None:
|
if action is None:
|
||||||
return
|
return
|
||||||
|
|
Reference in New Issue