Skip to content

Commit

Permalink
Fix hiveminds and scripts not blocking correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
NicEastvillage authored and VirxEC committed Jan 25, 2025
1 parent 6a73c12 commit a1b0c35
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
5 changes: 1 addition & 4 deletions rlbot/managers/hivemind.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,18 @@ def _packet_processor(self, packet: flat.GamePacket):

def _run(self):
running = True
has_more_messages = True

while running:
# If there might be more messages,
# check for another one with blocking=False
# if there are no more messages, process the latest packet
# then wait for the next message with blocking=True
match self._game_interface.handle_incoming_messages(
blocking=not has_more_messages
blocking=self._latest_packet is None
):
case MsgHandlingResult.TERMINATED:
running = False
case MsgHandlingResult.NO_INCOMING_MSGS:
has_more_messages = False

if self._latest_packet is not None:
self._packet_processor(self._latest_packet)
self._latest_packet = None
Expand Down
5 changes: 1 addition & 4 deletions rlbot/managers/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,18 @@ def _packet_processor(self, packet: flat.GamePacket):

def _run(self):
running = True
has_more_messages = True

while running:
# If there might be more messages,
# check for another one with blocking=False
# if there are no more messages, process the latest packet
# then wait for the next message with blocking=True
match self._game_interface.handle_incoming_messages(
blocking=not has_more_messages
blocking=self._latest_packet is None
):
case MsgHandlingResult.TERMINATED:
running = False
case MsgHandlingResult.NO_INCOMING_MSGS:
has_more_messages = False

if self._latest_packet is not None:
self._packet_processor(self._latest_packet)
self._latest_packet = None
Expand Down
2 changes: 1 addition & 1 deletion rlbot/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0-beta.20"
__version__ = "2.0.0-beta.21"

0 comments on commit a1b0c35

Please sign in to comment.