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