ba_data update

This commit is contained in:
Ayush Saini 2024-01-27 21:25:16 +05:30
parent 2174ae566d
commit 7ba24ecbcf
146 changed files with 1756 additions and 347 deletions

View file

@ -10,6 +10,7 @@ import random
import weakref
from typing import TYPE_CHECKING
from typing_extensions import override
import bascenev1 as bs
import bauiv1 as bui
@ -42,7 +43,9 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
self._language: str | None = None
self._update_timer: bs.Timer | None = None
self._news: NewsDisplay | None = None
self._attract_mode_timer: bs.Timer | None = None
@override
def on_transition_in(self) -> None:
# pylint: disable=too-many-locals
# pylint: disable=too-many-statements
@ -83,7 +86,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
'scale': scale,
'position': (0, 10),
'vr_depth': -10,
'text': '\xa9 2011-2023 Eric Froemling',
'text': '\xa9 2011-2024 Eric Froemling',
},
)
)
@ -295,6 +298,10 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
if not (env.demo or env.arcade) and not app.ui_v1.use_toolbars:
self._news = NewsDisplay(self)
self._attract_mode_timer = bs.Timer(
3.12, self._update_attract_mode, repeat=True
)
# Bring up the last place we were, or start at the main menu otherwise.
with bs.ContextRef.empty():
from bauiv1lib import specialoffer
@ -387,7 +394,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
bs.app.ui_v1.set_main_menu_window(
MainMenuWindow(transition=None).get_root_widget(),
from_window=None,
from_window=False, # Disable check here.
)
# attempt to show any pending offers immediately.
@ -403,6 +410,7 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
bui.apptimer(2.0, specialoffer.show_offer)
bui.apptimer(2.0, try_again)
app.classic.main_menu_did_initial_transition = True
def _update(self) -> None:
@ -836,6 +844,26 @@ class MainMenuActivity(bs.Activity[bs.Player, bs.Team]):
bui.apptimer(0.5, _start_menu_music)
def _update_attract_mode(self) -> None:
if bui.app.classic is None:
return
if not bui.app.config.resolve('Show Demos When Idle'):
return
threshold = 20.0
# If we're idle *and* have been in this activity for that long,
# flip over to our cpu demo.
if bui.get_input_idle_time() > threshold and bs.time() > threshold:
bui.app.classic.run_stress_test(
playlist_type='Random',
playlist_name='__default__',
player_count=8,
round_duration=20,
attract_mode=True,
)
class NewsDisplay:
"""Wrangles news display."""
@ -1113,6 +1141,7 @@ class MainMenuSession(bs.Session):
self._locked = False
self.setactivity(bs.newactivity(MainMenuActivity))
@override
def on_activity_end(self, activity: bs.Activity, results: Any) -> None:
if self._locked:
bui.unlock_all_input()
@ -1120,6 +1149,7 @@ class MainMenuSession(bs.Session):
# Any ending activity leads us into the main menu one.
self.setactivity(bs.newactivity(MainMenuActivity))
@override
def on_player_request(self, player: bs.SessionPlayer) -> bool:
# Reject all player requests.
return False