From 5dbd9211ded2a2a952a1beda340823947a60f3d9 Mon Sep 17 00:00:00 2001 From: Brosef Date: Sun, 22 Jun 2025 18:00:42 +0100 Subject: [PATCH] Added awaitingTimeout function (not tested, good luck team) --- src/gameUtils/base.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gameUtils/base.py b/src/gameUtils/base.py index e873f00..5f57978 100644 --- a/src/gameUtils/base.py +++ b/src/gameUtils/base.py @@ -60,4 +60,18 @@ class Game: to wait before firing. """ - self._timeouts.append(Timeout(id, time.perf_counter()+delay)) \ No newline at end of file + self._timeouts.append(Timeout(id, time.perf_counter()+delay)) + + def awaitingTimeout(self, id: str): + """ + Tells you if a timeout ID is on the timeout stack. + + Args: + id (str): The timeout ID. + + Returns: + bool: True if there is a timeout with that ID + ID on the stack, False otherwise. + """ + + return any([timeout.id == id for timeout in self._timeouts]) \ No newline at end of file