From c67cce5dcce2ef28a2bac7075b84a442c1a9a6d7 Mon Sep 17 00:00:00 2001 From: Jonas Zeunert Date: Tue, 7 Jun 2022 00:04:48 +0200 Subject: [PATCH] Deactivate credit while play --- GameState.py | 1 + config.py | 2 +- events/EndBallEvent.py | 1 + events/StartGameEvent.py | 3 +++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/GameState.py b/GameState.py index 87ce347..7e90d9c 100644 --- a/GameState.py +++ b/GameState.py @@ -19,6 +19,7 @@ class GameState: def nextPlayer(self): self.currentPlayer = next(self.players) + self.isPlaying = True @property def currentPlayer(self): diff --git a/config.py b/config.py index 508825c..f930374 100644 --- a/config.py +++ b/config.py @@ -25,6 +25,6 @@ RED_SPECIAL_TIMES = 1 ORANGE_SPECIAL = SpecialEvent.points ORANGE_SPECIAL_BANK = ORANGE_SPECIAL_BANK_OPTIONS["BOTH"] ## Tech config -WAIT_TIME_TO_RESET_SECONDS = 0.6 +WAIT_TIME_TO_RESET_SECONDS = 0.2 MAX_NETWORK_RETRIES = 10 NETWORK_SLEEP_TIME_SECONDS = 0.05 diff --git a/events/EndBallEvent.py b/events/EndBallEvent.py index 6d48154..55bddbc 100644 --- a/events/EndBallEvent.py +++ b/events/EndBallEvent.py @@ -20,6 +20,7 @@ class EndBallEvent(Event): StartBallEvent().trigger(None) return + self.gameState.isPlaying = False self.gameState.currentPlayer.removeBall() self.scorePoints() diff --git a/events/StartGameEvent.py b/events/StartGameEvent.py index 44f8064..fbf2ef3 100644 --- a/events/StartGameEvent.py +++ b/events/StartGameEvent.py @@ -11,6 +11,9 @@ class StartGameEvent(Event): super().__init__("Start Game Event") def trigger(self, target): + if self.gameState.isPlaying: + return + super().trigger(target) self.flipper.activate()