mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 23:13:46 +08:00
preflight
This commit is contained in:
parent
dfb2ba4779
commit
e43ef6d48b
@ -34,7 +34,6 @@ if TYPE_CHECKING:
|
|||||||
from typing import Optional, List, Dict, Any, Sequence, Union
|
from typing import Optional, List, Dict, Any, Sequence, Union
|
||||||
import ba
|
import ba
|
||||||
|
|
||||||
|
|
||||||
MAX_QUICK_CHANGE_COUNT = 30
|
MAX_QUICK_CHANGE_COUNT = 30
|
||||||
QUICK_CHANGE_INTERVAL = 0.05
|
QUICK_CHANGE_INTERVAL = 0.05
|
||||||
|
|
||||||
@ -173,7 +172,7 @@ class Chooser:
|
|||||||
self._profilenames: List[str] = []
|
self._profilenames: List[str] = []
|
||||||
self._ready: bool = False
|
self._ready: bool = False
|
||||||
self.character_names: List[str] = []
|
self.character_names: List[str] = []
|
||||||
self.last_change: Sequence[Union[float, count]] = (0, 0)
|
self.last_change: Sequence[Union[float, int]] = (0, 0)
|
||||||
|
|
||||||
# Hmm does this need to be public?
|
# Hmm does this need to be public?
|
||||||
self.profiles: Dict[str, Dict[str, Any]] = {}
|
self.profiles: Dict[str, Dict[str, Any]] = {}
|
||||||
@ -668,13 +667,14 @@ class Chooser:
|
|||||||
def handlemessage(self, msg: Any) -> Any:
|
def handlemessage(self, msg: Any) -> Any:
|
||||||
"""Standard generic message handler."""
|
"""Standard generic message handler."""
|
||||||
if isinstance(msg, ChangeMessage):
|
if isinstance(msg, ChangeMessage):
|
||||||
now = ba.time()
|
now = _ba.time()
|
||||||
count = self.last_change[1] + 1
|
count = self.last_change[1] + 1
|
||||||
if now - self.last_change[0] < QUICK_CHANGE_INTERVAL and count > MAX_QUICK_CHANGE_COUNT:
|
if (now - self.last_change[0] < QUICK_CHANGE_INTERVAL
|
||||||
|
and count > MAX_QUICK_CHANGE_COUNT):
|
||||||
# Hmm maybe we should notify client?
|
# Hmm maybe we should notify client?
|
||||||
_ba.disconnect_client(self._player.get_input_device().client_id)
|
_ba.disconnect_client(
|
||||||
|
self._player.get_input_device().client_id)
|
||||||
self.last_change = (now, count)
|
self.last_change = (now, count)
|
||||||
0
|
|
||||||
|
|
||||||
# If we've been removed from the lobby, ignore this stuff.
|
# If we've been removed from the lobby, ignore this stuff.
|
||||||
if self._dead:
|
if self._dead:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user