mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2026-08-29 13:16:28 +00:00
ba_data update
This commit is contained in:
parent
2174ae566d
commit
7ba24ecbcf
146 changed files with 1756 additions and 347 deletions
4
dist/ba_data/python/baclassic/_ads.py
vendored
4
dist/ba_data/python/baclassic/_ads.py
vendored
|
|
@ -229,9 +229,7 @@ class AdsSubsystem:
|
|||
await asyncio.sleep(1.0)
|
||||
payload.run(fallback=True)
|
||||
|
||||
_fallback_task = babase.app.aioloop.create_task(
|
||||
add_fallback_task()
|
||||
)
|
||||
babase.app.create_async_task(add_fallback_task())
|
||||
self.show_ad('between_game', on_completion_call=payload.run)
|
||||
else:
|
||||
babase.pushcall(call) # Just run the callback without the ad.
|
||||
|
|
|
|||
104
dist/ba_data/python/baclassic/_benchmark.py
vendored
104
dist/ba_data/python/baclassic/_benchmark.py
vendored
|
|
@ -4,8 +4,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import random
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from typing_extensions import override
|
||||
import babase
|
||||
import bascenev1
|
||||
import _baclassic
|
||||
|
|
@ -42,70 +44,81 @@ def run_cpu_benchmark() -> None:
|
|||
cfg['Graphics Quality'] = self._old_quality
|
||||
cfg.apply()
|
||||
|
||||
@override
|
||||
def on_player_request(self, player: bascenev1.SessionPlayer) -> bool:
|
||||
return False
|
||||
|
||||
bascenev1.new_host_session(BenchmarkSession, benchmark_type='cpu')
|
||||
|
||||
|
||||
@dataclass
|
||||
class _StressTestArgs:
|
||||
playlist_type: str
|
||||
playlist_name: str
|
||||
player_count: int
|
||||
round_duration: int
|
||||
attract_mode: bool
|
||||
|
||||
|
||||
def run_stress_test(
|
||||
playlist_type: str = 'Random',
|
||||
playlist_name: str = '__default__',
|
||||
player_count: int = 8,
|
||||
round_duration: int = 30,
|
||||
attract_mode: bool = False,
|
||||
) -> None:
|
||||
"""Run a stress test."""
|
||||
|
||||
babase.screenmessage(
|
||||
"Beginning stress test.. use 'End Test' to stop testing.",
|
||||
color=(1, 1, 0),
|
||||
)
|
||||
with babase.ContextRef.empty():
|
||||
start_stress_test(
|
||||
{
|
||||
'playlist_type': playlist_type,
|
||||
'playlist_name': playlist_name,
|
||||
'player_count': player_count,
|
||||
'round_duration': round_duration,
|
||||
}
|
||||
if not attract_mode:
|
||||
babase.screenmessage(
|
||||
"Beginning stress test.. use 'End Test' to stop testing.",
|
||||
color=(1, 1, 0),
|
||||
)
|
||||
_start_stress_test(
|
||||
_StressTestArgs(
|
||||
playlist_type=playlist_type,
|
||||
playlist_name=playlist_name,
|
||||
player_count=player_count,
|
||||
round_duration=round_duration,
|
||||
attract_mode=attract_mode,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def stop_stress_test() -> None:
|
||||
"""End a running stress test."""
|
||||
|
||||
_baclassic.set_stress_testing(False, 0)
|
||||
assert babase.app.classic is not None
|
||||
try:
|
||||
if babase.app.classic.stress_test_reset_timer is not None:
|
||||
babase.screenmessage('Ending stress test...', color=(1, 1, 0))
|
||||
except Exception:
|
||||
pass
|
||||
babase.app.classic.stress_test_reset_timer = None
|
||||
|
||||
_baclassic.set_stress_testing(False, 0, False)
|
||||
babase.app.classic.stress_test_update_timer = None
|
||||
babase.app.classic.stress_test_update_timer_2 = None
|
||||
|
||||
|
||||
def start_stress_test(args: dict[str, Any]) -> None:
|
||||
def _start_stress_test(args: _StressTestArgs) -> None:
|
||||
"""(internal)"""
|
||||
from bascenev1 import DualTeamSession, FreeForAllSession
|
||||
|
||||
assert babase.app.classic is not None
|
||||
|
||||
appconfig = babase.app.config
|
||||
playlist_type = args['playlist_type']
|
||||
playlist_type = args.playlist_type
|
||||
if playlist_type == 'Random':
|
||||
if random.random() < 0.5:
|
||||
playlist_type = 'Teams'
|
||||
else:
|
||||
playlist_type = 'Free-For-All'
|
||||
babase.screenmessage(
|
||||
'Running Stress Test (listType="'
|
||||
+ playlist_type
|
||||
+ '", listName="'
|
||||
+ args['playlist_name']
|
||||
+ '")...'
|
||||
)
|
||||
if not args.attract_mode:
|
||||
babase.screenmessage(
|
||||
'Running Stress Test (listType="'
|
||||
+ playlist_type
|
||||
+ '", listName="'
|
||||
+ args.playlist_name
|
||||
+ '")...'
|
||||
)
|
||||
if playlist_type == 'Teams':
|
||||
appconfig['Team Tournament Playlist Selection'] = args['playlist_name']
|
||||
appconfig['Team Tournament Playlist Selection'] = args.playlist_name
|
||||
appconfig['Team Tournament Playlist Randomize'] = 1
|
||||
babase.apptimer(
|
||||
1.0,
|
||||
|
|
@ -115,7 +128,7 @@ def start_stress_test(args: dict[str, Any]) -> None:
|
|||
),
|
||||
)
|
||||
else:
|
||||
appconfig['Free-for-All Playlist Selection'] = args['playlist_name']
|
||||
appconfig['Free-for-All Playlist Selection'] = args.playlist_name
|
||||
appconfig['Free-for-All Playlist Randomize'] = 1
|
||||
babase.apptimer(
|
||||
1.0,
|
||||
|
|
@ -124,19 +137,38 @@ def start_stress_test(args: dict[str, Any]) -> None:
|
|||
babase.Call(bascenev1.new_host_session, FreeForAllSession),
|
||||
),
|
||||
)
|
||||
_baclassic.set_stress_testing(True, args['player_count'])
|
||||
babase.app.classic.stress_test_reset_timer = babase.AppTimer(
|
||||
args['round_duration'], babase.Call(_reset_stress_test, args)
|
||||
_baclassic.set_stress_testing(True, args.player_count, args.attract_mode)
|
||||
babase.app.classic.stress_test_update_timer = babase.AppTimer(
|
||||
args.round_duration, babase.Call(_reset_stress_test, args)
|
||||
)
|
||||
if args.attract_mode:
|
||||
babase.app.classic.stress_test_update_timer_2 = babase.AppTimer(
|
||||
0.48, babase.Call(_update_attract_mode_test, args), repeat=True
|
||||
)
|
||||
|
||||
|
||||
def _reset_stress_test(args: dict[str, Any]) -> None:
|
||||
_baclassic.set_stress_testing(False, args['player_count'])
|
||||
babase.screenmessage('Resetting stress test...')
|
||||
def _update_attract_mode_test(args: _StressTestArgs) -> None:
|
||||
if babase.get_input_idle_time() < 5.0:
|
||||
_reset_stress_test(args)
|
||||
|
||||
|
||||
def _reset_stress_test(args: _StressTestArgs) -> None:
|
||||
_baclassic.set_stress_testing(False, args.player_count, False)
|
||||
if not args.attract_mode:
|
||||
babase.screenmessage('Resetting stress test...')
|
||||
session = bascenev1.get_foreground_host_session()
|
||||
assert session is not None
|
||||
session.end()
|
||||
babase.apptimer(1.0, babase.Call(start_stress_test, args))
|
||||
|
||||
assert babase.app.classic is not None
|
||||
babase.app.classic.stress_test_update_timer = None
|
||||
babase.app.classic.stress_test_update_timer_2 = None
|
||||
|
||||
# For regular stress tests we keep the party going. For attract-mode
|
||||
# we just end back at the main menu. If things are idle there then
|
||||
# we'll get sent back to a new stress test.
|
||||
if not args.attract_mode:
|
||||
babase.apptimer(1.0, babase.Call(_start_stress_test, args))
|
||||
|
||||
|
||||
def run_gpu_benchmark() -> None:
|
||||
|
|
|
|||
2
dist/ba_data/python/baclassic/_net.py
vendored
2
dist/ba_data/python/baclassic/_net.py
vendored
|
|
@ -9,6 +9,7 @@ import threading
|
|||
from enum import Enum
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from typing_extensions import override
|
||||
import babase
|
||||
import bascenev1
|
||||
|
||||
|
|
@ -68,6 +69,7 @@ class MasterServerV1CallThread(threading.Thread):
|
|||
with self._context:
|
||||
self._callback(arg)
|
||||
|
||||
@override
|
||||
def run(self) -> None:
|
||||
# pylint: disable=consider-using-with
|
||||
# pylint: disable=too-many-branches
|
||||
|
|
|
|||
17
dist/ba_data/python/baclassic/_subsystem.py
vendored
17
dist/ba_data/python/baclassic/_subsystem.py
vendored
|
|
@ -8,6 +8,7 @@ import random
|
|||
import logging
|
||||
import weakref
|
||||
|
||||
from typing_extensions import override
|
||||
from efro.dataclassio import dataclass_from_dict
|
||||
import babase
|
||||
import bauiv1
|
||||
|
|
@ -69,7 +70,8 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||
|
||||
# Misc.
|
||||
self.tips: list[str] = []
|
||||
self.stress_test_reset_timer: babase.AppTimer | None = None
|
||||
self.stress_test_update_timer: babase.AppTimer | None = None
|
||||
self.stress_test_update_timer_2: babase.AppTimer | None = None
|
||||
self.value_test_defaults: dict = {}
|
||||
self.special_offer: dict | None = None
|
||||
self.ping_thread_count = 0
|
||||
|
|
@ -148,6 +150,7 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||
assert isinstance(self._env['legacy_user_agent_string'], str)
|
||||
return self._env['legacy_user_agent_string']
|
||||
|
||||
@override
|
||||
def on_app_loading(self) -> None:
|
||||
from bascenev1lib.actor import spazappearance
|
||||
from bascenev1lib import maps as stdmaps
|
||||
|
|
@ -229,13 +232,16 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||
|
||||
self.accounts.on_app_loading()
|
||||
|
||||
@override
|
||||
def on_app_suspend(self) -> None:
|
||||
self.accounts.on_app_suspend()
|
||||
|
||||
@override
|
||||
def on_app_unsuspend(self) -> None:
|
||||
self.accounts.on_app_unsuspend()
|
||||
self.music.on_app_unsuspend()
|
||||
|
||||
@override
|
||||
def on_app_shutdown(self) -> None:
|
||||
self.music.on_app_shutdown()
|
||||
|
||||
|
|
@ -555,11 +561,18 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||
playlist_name: str = '__default__',
|
||||
player_count: int = 8,
|
||||
round_duration: int = 30,
|
||||
attract_mode: bool = False,
|
||||
) -> None:
|
||||
"""Run a stress test."""
|
||||
from baclassic._benchmark import run_stress_test as run
|
||||
|
||||
run(playlist_type, playlist_name, player_count, round_duration)
|
||||
run(
|
||||
playlist_type=playlist_type,
|
||||
playlist_name=playlist_name,
|
||||
player_count=player_count,
|
||||
round_duration=round_duration,
|
||||
attract_mode=attract_mode,
|
||||
)
|
||||
|
||||
def get_input_device_mapped_value(
|
||||
self, device: bascenev1.InputDevice, name: str
|
||||
|
|
|
|||
7
dist/ba_data/python/baclassic/macmusicapp.py
vendored
7
dist/ba_data/python/baclassic/macmusicapp.py
vendored
|
|
@ -8,6 +8,7 @@ import threading
|
|||
from collections import deque
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from typing_extensions import override
|
||||
import babase
|
||||
|
||||
from baclassic._music import MusicPlayer
|
||||
|
|
@ -27,6 +28,7 @@ class MacMusicAppMusicPlayer(MusicPlayer):
|
|||
self._thread = _MacMusicAppThread()
|
||||
self._thread.start()
|
||||
|
||||
@override
|
||||
def on_select_entry(
|
||||
self,
|
||||
callback: Callable[[Any], None],
|
||||
|
|
@ -40,6 +42,7 @@ class MacMusicAppMusicPlayer(MusicPlayer):
|
|||
callback, current_entry, selection_target_name
|
||||
)
|
||||
|
||||
@override
|
||||
def on_set_volume(self, volume: float) -> None:
|
||||
self._thread.set_volume(volume)
|
||||
|
||||
|
|
@ -47,6 +50,7 @@ class MacMusicAppMusicPlayer(MusicPlayer):
|
|||
"""Asynchronously fetch the list of available iTunes playlists."""
|
||||
self._thread.get_playlists(callback)
|
||||
|
||||
@override
|
||||
def on_play(self, entry: Any) -> None:
|
||||
assert babase.app.classic is not None
|
||||
music = babase.app.classic.music
|
||||
|
|
@ -59,9 +63,11 @@ class MacMusicAppMusicPlayer(MusicPlayer):
|
|||
entry_type,
|
||||
)
|
||||
|
||||
@override
|
||||
def on_stop(self) -> None:
|
||||
self._thread.play_playlist(None)
|
||||
|
||||
@override
|
||||
def on_app_shutdown(self) -> None:
|
||||
self._thread.shutdown()
|
||||
|
||||
|
|
@ -77,6 +83,7 @@ class _MacMusicAppThread(threading.Thread):
|
|||
self._current_playlist: str | None = None
|
||||
self._orig_volume: int | None = None
|
||||
|
||||
@override
|
||||
def run(self) -> None:
|
||||
"""Run the Music.app thread."""
|
||||
babase.set_thread_name('BA_MacMusicAppThread')
|
||||
|
|
|
|||
7
dist/ba_data/python/baclassic/osmusic.py
vendored
7
dist/ba_data/python/baclassic/osmusic.py
vendored
|
|
@ -9,6 +9,7 @@ import logging
|
|||
import threading
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from typing_extensions import override
|
||||
import babase
|
||||
|
||||
from baclassic._music import MusicPlayer
|
||||
|
|
@ -33,6 +34,7 @@ class OSMusicPlayer(MusicPlayer):
|
|||
# FIXME: should ask the C++ layer for these; just hard-coding for now.
|
||||
return ['mp3', 'ogg', 'm4a', 'wav', 'flac', 'mid']
|
||||
|
||||
@override
|
||||
def on_select_entry(
|
||||
self,
|
||||
callback: Callable[[Any], None],
|
||||
|
|
@ -48,9 +50,11 @@ class OSMusicPlayer(MusicPlayer):
|
|||
callback, current_entry, selection_target_name
|
||||
)
|
||||
|
||||
@override
|
||||
def on_set_volume(self, volume: float) -> None:
|
||||
babase.music_player_set_volume(volume)
|
||||
|
||||
@override
|
||||
def on_play(self, entry: Any) -> None:
|
||||
assert babase.app.classic is not None
|
||||
music = babase.app.classic.music
|
||||
|
|
@ -99,11 +103,13 @@ class OSMusicPlayer(MusicPlayer):
|
|||
self._actually_playing = True
|
||||
babase.music_player_play(result)
|
||||
|
||||
@override
|
||||
def on_stop(self) -> None:
|
||||
self._want_to_play = False
|
||||
self._actually_playing = False
|
||||
babase.music_player_stop()
|
||||
|
||||
@override
|
||||
def on_app_shutdown(self) -> None:
|
||||
babase.music_player_shutdown()
|
||||
|
||||
|
|
@ -120,6 +126,7 @@ class _PickFolderSongThread(threading.Thread):
|
|||
self._callback = callback
|
||||
self._path = path
|
||||
|
||||
@override
|
||||
def run(self) -> None:
|
||||
do_log_error = True
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue