mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-24 16:06:51 +08:00
fix
This commit is contained in:
parent
2d39ad7121
commit
843d064bd2
@ -156,20 +156,17 @@ class CoopSession(Session):
|
||||
from ba._general import WeakCall
|
||||
super().on_player_leave(sessionplayer)
|
||||
|
||||
if _ba.app.server is not None:
|
||||
# If we're in server mode, end game and show results.
|
||||
_ba.timer(2.0, WeakCall(self._end_game_if_empty))
|
||||
else:
|
||||
# Otherwise, if all our players leave
|
||||
# we wanna quit out of the session.
|
||||
_ba.timer(2.0, WeakCall(self._end_session_if_empty))
|
||||
_ba.timer(2.0, WeakCall(self._check_end_game))
|
||||
|
||||
def _check_end_game(self) -> None:
|
||||
if not _ba.app.server:
|
||||
self._end_session_if_empty()
|
||||
|
||||
def _end_game_if_empty(self) -> None:
|
||||
activity = self.getactivity()
|
||||
if activity is None:
|
||||
return # Probably everything is already broken, why do something?
|
||||
|
||||
if activity.players:
|
||||
if [player for player in activity.players if player.is_alive()]:
|
||||
return
|
||||
|
||||
with _ba.Context(activity):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user