mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-10-20 00:00:39 +00:00
syncing ba,bastd from master
This commit is contained in:
parent
d9634f722e
commit
e44fe44e5b
108 changed files with 793 additions and 683 deletions
2
dist/ba_data/python/ba/_accountv1.py
vendored
2
dist/ba_data/python/ba/_accountv1.py
vendored
|
|
@ -74,7 +74,7 @@ class AccountV1Subsystem:
|
|||
|
||||
def get_league_rank_points(self,
|
||||
data: dict[str, Any] | None,
|
||||
subset: str = None) -> int:
|
||||
subset: str | None = None) -> int:
|
||||
"""(internal)"""
|
||||
if data is None:
|
||||
return 0
|
||||
|
|
|
|||
4
dist/ba_data/python/ba/_achievement.py
vendored
4
dist/ba_data/python/ba/_achievement.py
vendored
|
|
@ -610,8 +610,8 @@ class Achievement:
|
|||
x: float,
|
||||
y: float,
|
||||
delay: float,
|
||||
outdelay: float = None,
|
||||
color: Sequence[float] = None,
|
||||
outdelay: float | None = None,
|
||||
color: Sequence[float] | None = None,
|
||||
style: str = 'post_game') -> list[ba.Actor]:
|
||||
"""Create a display for the Achievement.
|
||||
|
||||
|
|
|
|||
9
dist/ba_data/python/ba/_ads.py
vendored
9
dist/ba_data/python/ba/_ads.py
vendored
|
|
@ -53,14 +53,15 @@ class AdsSubsystem:
|
|||
|
||||
def show_ad(self,
|
||||
purpose: str,
|
||||
on_completion_call: Callable[[], Any] = None) -> None:
|
||||
on_completion_call: Callable[[], Any] | None = None) -> None:
|
||||
"""(internal)"""
|
||||
self.last_ad_purpose = purpose
|
||||
_ba.show_ad(purpose, on_completion_call)
|
||||
|
||||
def show_ad_2(self,
|
||||
purpose: str,
|
||||
on_completion_call: Callable[[bool], Any] = None) -> None:
|
||||
def show_ad_2(
|
||||
self,
|
||||
purpose: str,
|
||||
on_completion_call: Callable[[bool], Any] | None = None) -> None:
|
||||
"""(internal)"""
|
||||
self.last_ad_purpose = purpose
|
||||
_ba.show_ad_2(purpose, on_completion_call)
|
||||
|
|
|
|||
5
dist/ba_data/python/ba/_app.py
vendored
5
dist/ba_data/python/ba/_app.py
vendored
|
|
@ -341,7 +341,6 @@ class App:
|
|||
from bastd import maps as stdmaps
|
||||
from bastd.actor import spazappearance
|
||||
from ba._generated.enums import TimeType
|
||||
|
||||
|
||||
self._aioloop = _asyncio.setup_asyncio()
|
||||
|
||||
|
|
@ -430,8 +429,6 @@ class App:
|
|||
|
||||
self.meta.on_app_running()
|
||||
self.plugins.on_app_running()
|
||||
import custom_hooks
|
||||
custom_hooks.on_app_running()
|
||||
|
||||
# from ba._dependency import test_depset
|
||||
# test_depset()
|
||||
|
|
@ -580,7 +577,7 @@ class App:
|
|||
def launch_coop_game(self,
|
||||
game: str,
|
||||
force: bool = False,
|
||||
args: dict = None) -> bool:
|
||||
args: dict | None = None) -> bool:
|
||||
"""High level way to launch a local co-op session."""
|
||||
# pylint: disable=cyclic-import
|
||||
from ba._campaign import getcampaign
|
||||
|
|
|
|||
7
dist/ba_data/python/ba/_apputils.py
vendored
7
dist/ba_data/python/ba/_apputils.py
vendored
|
|
@ -177,9 +177,10 @@ def garbage_collect() -> None:
|
|||
gc.collect()
|
||||
|
||||
|
||||
def print_live_object_warnings(when: Any,
|
||||
ignore_session: ba.Session = None,
|
||||
ignore_activity: ba.Activity = None) -> None:
|
||||
def print_live_object_warnings(
|
||||
when: Any,
|
||||
ignore_session: ba.Session | None = None,
|
||||
ignore_activity: ba.Activity | None = None) -> None:
|
||||
"""Print warnings for remaining objects in the current context."""
|
||||
# pylint: disable=cyclic-import
|
||||
from ba._session import Session
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_coopgame.py
vendored
2
dist/ba_data/python/ba/_coopgame.py
vendored
|
|
@ -177,7 +177,7 @@ class CoopGameActivity(GameActivity[PlayerType, TeamType]):
|
|||
def spawn_player_spaz(self,
|
||||
player: PlayerType,
|
||||
position: Sequence[float] = (0.0, 0.0, 0.0),
|
||||
angle: float = None) -> PlayerSpaz:
|
||||
angle: float | None = None) -> PlayerSpaz:
|
||||
"""Spawn and wire up a standard player spaz."""
|
||||
spaz = super().spawn_player_spaz(player, position, angle)
|
||||
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_gameactivity.py
vendored
2
dist/ba_data/python/ba/_gameactivity.py
vendored
|
|
@ -841,7 +841,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
|
|||
def spawn_player_spaz(self,
|
||||
player: PlayerType,
|
||||
position: Sequence[float] = (0, 0, 0),
|
||||
angle: float = None) -> PlayerSpaz:
|
||||
angle: float | None = None) -> PlayerSpaz:
|
||||
"""Create and wire up a ba.PlayerSpaz for the provided ba.Player."""
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=cyclic-import
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_general.py
vendored
2
dist/ba_data/python/ba/_general.py
vendored
|
|
@ -360,7 +360,7 @@ def _verify_object_death(wref: weakref.ref) -> None:
|
|||
print_active_refs(obj)
|
||||
|
||||
|
||||
def storagename(suffix: str = None) -> str:
|
||||
def storagename(suffix: str | None = None) -> str:
|
||||
"""Generate a unique name for storing class data in shared places.
|
||||
|
||||
Category: **General Utility Functions**
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_language.py
vendored
2
dist/ba_data/python/ba/_language.py
vendored
|
|
@ -240,7 +240,7 @@ class LanguageSubsystem:
|
|||
|
||||
def get_resource(self,
|
||||
resource: str,
|
||||
fallback_resource: str = None,
|
||||
fallback_resource: str | None = None,
|
||||
fallback_value: Any = None) -> Any:
|
||||
"""Return a translation resource by name.
|
||||
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_level.py
vendored
2
dist/ba_data/python/ba/_level.py
vendored
|
|
@ -25,7 +25,7 @@ class Level:
|
|||
gametype: type[ba.GameActivity],
|
||||
settings: dict,
|
||||
preview_texture_name: str,
|
||||
displayname: str = None):
|
||||
displayname: str | None = None):
|
||||
self._name = name
|
||||
self._gametype = gametype
|
||||
self._settings = settings
|
||||
|
|
|
|||
3
dist/ba_data/python/ba/_map.py
vendored
3
dist/ba_data/python/ba/_map.py
vendored
|
|
@ -388,7 +388,8 @@ class Map(Actor):
|
|||
assert farthestpt is not None
|
||||
return tuple(farthestpt)
|
||||
|
||||
def get_flag_position(self, team_index: int = None) -> Sequence[float]:
|
||||
def get_flag_position(self,
|
||||
team_index: int | None = None) -> Sequence[float]:
|
||||
"""Return a flag position on the map for the given team index.
|
||||
|
||||
Pass None to get the default flag point.
|
||||
|
|
|
|||
12
dist/ba_data/python/ba/_messages.py
vendored
12
dist/ba_data/python/ba/_messages.py
vendored
|
|
@ -236,17 +236,17 @@ class HitMessage:
|
|||
"""
|
||||
|
||||
def __init__(self,
|
||||
srcnode: ba.Node = None,
|
||||
pos: Sequence[float] = None,
|
||||
velocity: Sequence[float] = None,
|
||||
srcnode: ba.Node | None = None,
|
||||
pos: Sequence[float] | None = None,
|
||||
velocity: Sequence[float] | None = None,
|
||||
magnitude: float = 1.0,
|
||||
velocity_magnitude: float = 0.0,
|
||||
radius: float = 1.0,
|
||||
source_player: ba.Player = None,
|
||||
source_player: ba.Player | None = None,
|
||||
kick_back: float = 1.0,
|
||||
flat_damage: float = None,
|
||||
flat_damage: float | None = None,
|
||||
hit_type: str = 'generic',
|
||||
force_direction: Sequence[float] = None,
|
||||
force_direction: Sequence[float] | None = None,
|
||||
hit_subtype: str = 'default'):
|
||||
"""Instantiate a message with given values."""
|
||||
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_music.py
vendored
2
dist/ba_data/python/ba/_music.py
vendored
|
|
@ -273,7 +273,7 @@ class MusicSubsystem:
|
|||
musictype: MusicType | str | None,
|
||||
continuous: bool = False,
|
||||
mode: MusicPlayMode = MusicPlayMode.REGULAR,
|
||||
testsoundtrack: dict[str, Any] = None) -> None:
|
||||
testsoundtrack: dict[str, Any] | None = None) -> None:
|
||||
"""Plays the requested music type/mode.
|
||||
|
||||
For most cases, setmusic() is the proper call to use, which itself
|
||||
|
|
|
|||
40
dist/ba_data/python/ba/_plugin.py
vendored
40
dist/ba_data/python/ba/_plugin.py
vendored
|
|
@ -66,6 +66,7 @@ class PluginSubsystem:
|
|||
def load_plugins(self) -> None:
|
||||
"""(internal)"""
|
||||
from ba._general import getclass
|
||||
from ba._language import Lstr
|
||||
|
||||
# Note: the plugins we load is purely based on what's enabled
|
||||
# in the app config. Our meta-scan gives us a list of available
|
||||
|
|
@ -76,15 +77,21 @@ class PluginSubsystem:
|
|||
assert isinstance(plugstates, dict)
|
||||
plugkeys: list[str] = sorted(key for key, val in plugstates.items()
|
||||
if val.get('enabled', False))
|
||||
disappeared_plugs: set[str] = set()
|
||||
for plugkey in plugkeys:
|
||||
try:
|
||||
cls = getclass(plugkey, Plugin)
|
||||
except ModuleNotFoundError:
|
||||
disappeared_plugs.add(plugkey)
|
||||
continue
|
||||
except Exception as exc:
|
||||
_ba.playsound(_ba.getsound('error'))
|
||||
# TODO: Lstr.
|
||||
errstr = f"Error loading plugin class '{plugkey}': {exc}"
|
||||
_ba.screenmessage(errstr, color=(1, 0, 0))
|
||||
_ba.log(errstr, to_server=False)
|
||||
_ba.screenmessage(Lstr(resource='pluginClassLoadErrorText',
|
||||
subs=[('${PLUGIN}', plugkey),
|
||||
('${ERROR}', str(exc))]),
|
||||
color=(1, 0, 0))
|
||||
_ba.log(f"Error loading plugin class '{plugkey}': {exc}",
|
||||
to_server=False)
|
||||
continue
|
||||
try:
|
||||
plugin = cls()
|
||||
|
|
@ -93,10 +100,29 @@ class PluginSubsystem:
|
|||
except Exception as exc:
|
||||
from ba import _error
|
||||
_ba.playsound(_ba.getsound('error'))
|
||||
# TODO: Lstr.
|
||||
_ba.screenmessage(f"Error loading plugin: '{plugkey}': {exc}",
|
||||
_ba.screenmessage(Lstr(resource='pluginInitErrorText',
|
||||
subs=[('${PLUGIN}', plugkey),
|
||||
('${ERROR}', str(exc))]),
|
||||
color=(1, 0, 0))
|
||||
_error.print_exception(f"Error loading plugin: '{plugkey}'.")
|
||||
_error.print_exception(f"Error initing plugin: '{plugkey}'.")
|
||||
|
||||
# If plugins disappeared, let the user know gently and remove them
|
||||
# from the config so we'll again let the user know if they later
|
||||
# reappear. This makes it much smoother to switch between users
|
||||
# or workspaces.
|
||||
if disappeared_plugs:
|
||||
_ba.playsound(_ba.getsound('shieldDown'))
|
||||
_ba.screenmessage(Lstr(resource='pluginsRemovedText',
|
||||
subs=[('${NUM}',
|
||||
str(len(disappeared_plugs)))]),
|
||||
color=(1, 1, 0))
|
||||
_ba.log(
|
||||
f'{len(disappeared_plugs)} plugin(s) no longer found:'
|
||||
f' {disappeared_plugs}',
|
||||
to_server=False)
|
||||
for goneplug in disappeared_plugs:
|
||||
del _ba.app.config['Plugins'][goneplug]
|
||||
_ba.app.config.commit()
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_profile.py
vendored
2
dist/ba_data/python/ba/_profile.py
vendored
|
|
@ -50,7 +50,7 @@ def get_player_profile_icon(profilename: str) -> str:
|
|||
|
||||
def get_player_profile_colors(
|
||||
profilename: str | None,
|
||||
profiles: dict[str, dict[str, Any]] = None
|
||||
profiles: dict[str, dict[str, Any]] | None = None
|
||||
) -> tuple[tuple[float, float, float], tuple[float, float, float]]:
|
||||
"""Given a profile, return colors for them."""
|
||||
appconfig = _ba.app.config
|
||||
|
|
|
|||
4
dist/ba_data/python/ba/_session.py
vendored
4
dist/ba_data/python/ba/_session.py
vendored
|
|
@ -72,8 +72,8 @@ class Session:
|
|||
|
||||
def __init__(self,
|
||||
depsets: Sequence[ba.DependencySet],
|
||||
team_names: Sequence[str] = None,
|
||||
team_colors: Sequence[Sequence[float]] = None,
|
||||
team_names: Sequence[str] | None = None,
|
||||
team_colors: Sequence[Sequence[float]] | None = None,
|
||||
min_players: int = 1,
|
||||
max_players: int = 8):
|
||||
"""Instantiate a session.
|
||||
|
|
|
|||
8
dist/ba_data/python/ba/_stats.py
vendored
8
dist/ba_data/python/ba/_stats.py
vendored
|
|
@ -314,11 +314,11 @@ class Stats:
|
|||
def player_scored(self,
|
||||
player: ba.Player,
|
||||
base_points: int = 1,
|
||||
target: Sequence[float] = None,
|
||||
target: Sequence[float] | None = None,
|
||||
kill: bool = False,
|
||||
victim_player: ba.Player = None,
|
||||
victim_player: ba.Player | None = None,
|
||||
scale: float = 1.0,
|
||||
color: Sequence[float] = None,
|
||||
color: Sequence[float] | None = None,
|
||||
title: str | ba.Lstr | None = None,
|
||||
screenmessage: bool = True,
|
||||
display: bool = True,
|
||||
|
|
@ -422,7 +422,7 @@ class Stats:
|
|||
def player_was_killed(self,
|
||||
player: ba.Player,
|
||||
killed: bool = False,
|
||||
killer: ba.Player = None) -> None:
|
||||
killer: ba.Player | None = None) -> None:
|
||||
"""Should be called when a player is killed."""
|
||||
from ba._language import Lstr
|
||||
name = player.getname()
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_store.py
vendored
2
dist/ba_data/python/ba/_store.py
vendored
|
|
@ -398,7 +398,7 @@ def get_clean_price(price_string: str) -> str:
|
|||
return psubs.get(price_string, price_string)
|
||||
|
||||
|
||||
def get_available_purchase_count(tab: str = None) -> int:
|
||||
def get_available_purchase_count(tab: str | None = None) -> int:
|
||||
"""(internal)"""
|
||||
try:
|
||||
if _ba.get_v1_account_state() != 'signed_in':
|
||||
|
|
|
|||
4
dist/ba_data/python/ba/_teamgame.py
vendored
4
dist/ba_data/python/ba/_teamgame.py
vendored
|
|
@ -91,8 +91,8 @@ class TeamGameActivity(GameActivity[PlayerType, TeamType]):
|
|||
|
||||
def spawn_player_spaz(self,
|
||||
player: PlayerType,
|
||||
position: Sequence[float] = None,
|
||||
angle: float = None) -> PlayerSpaz:
|
||||
position: Sequence[float] | None = None,
|
||||
angle: float | None = None) -> PlayerSpaz:
|
||||
"""
|
||||
Method override; spawns and wires up a standard ba.PlayerSpaz for
|
||||
a ba.Player.
|
||||
|
|
|
|||
2
dist/ba_data/python/ba/_ui.py
vendored
2
dist/ba_data/python/ba/_ui.py
vendored
|
|
@ -144,7 +144,7 @@ class UISubsystem:
|
|||
_ba.timer(1.0, _delay_kill, timetype=TimeType.REAL)
|
||||
self._main_menu_window = window
|
||||
|
||||
def clear_main_menu_window(self, transition: str = None) -> None:
|
||||
def clear_main_menu_window(self, transition: str | None = None) -> None:
|
||||
"""Clear any existing 'main' window with the provided transition."""
|
||||
if self._main_menu_window:
|
||||
if transition is not None:
|
||||
|
|
|
|||
59
dist/ba_data/python/ba/_workspace.py
vendored
59
dist/ba_data/python/ba/_workspace.py
vendored
|
|
@ -52,17 +52,17 @@ class WorkspaceSubsystem:
|
|||
daemon=True,
|
||||
).start()
|
||||
|
||||
def _errmsg(self, msg: str | ba.Lstr) -> None:
|
||||
def _errmsg(self, msg: ba.Lstr) -> None:
|
||||
_ba.screenmessage(msg, color=(1, 0, 0))
|
||||
_ba.playsound(_ba.getsound('error'))
|
||||
|
||||
def _successmsg(self, msg: str | ba.Lstr) -> None:
|
||||
def _successmsg(self, msg: ba.Lstr) -> None:
|
||||
_ba.screenmessage(msg, color=(0, 1, 0))
|
||||
_ba.playsound(_ba.getsound('gunCocking'))
|
||||
|
||||
def _set_active_workspace_bg(self, workspaceid: str, workspacename: str,
|
||||
on_completed: Callable[[], None]) -> None:
|
||||
# pylint: disable=too-many-branches
|
||||
from ba._language import Lstr
|
||||
|
||||
class _SkipSyncError(RuntimeError):
|
||||
pass
|
||||
|
|
@ -101,45 +101,42 @@ class WorkspaceSubsystem:
|
|||
break
|
||||
state.iteration += 1
|
||||
|
||||
extras: list[str] = []
|
||||
# Hmm; let's not show deletes for now since currently lots of
|
||||
# .pyc files get deleted.
|
||||
if bool(False):
|
||||
if state.total_deletes:
|
||||
extras.append(f'{state.total_deletes} files deleted')
|
||||
if state.total_downloads:
|
||||
extras.append(f'{state.total_downloads} files downloaded')
|
||||
if state.total_up_to_date:
|
||||
extras.append(f'{state.total_up_to_date} files up-to-date')
|
||||
# Actually let's try with none of this; seems a bit excessive.
|
||||
if bool(False) and extras:
|
||||
extras_s = '\n' + ', '.join(extras) + '.'
|
||||
else:
|
||||
extras_s = ''
|
||||
_ba.pushcall(tpartial(self._successmsg,
|
||||
f'{workspacename} activated.{extras_s}'),
|
||||
from_other_thread=True)
|
||||
_ba.pushcall(
|
||||
tpartial(
|
||||
self._successmsg,
|
||||
Lstr(resource='activatedText',
|
||||
subs=[('${THING}', workspacename)]),
|
||||
),
|
||||
from_other_thread=True,
|
||||
)
|
||||
|
||||
except _SkipSyncError:
|
||||
_ba.pushcall(tpartial(
|
||||
self._errmsg, f'Can\'t sync {workspacename}'
|
||||
f'. Reusing previous synced version.'),
|
||||
from_other_thread=True)
|
||||
_ba.pushcall(
|
||||
tpartial(
|
||||
self._errmsg,
|
||||
Lstr(resource='workspaceSyncReuseText',
|
||||
subs=[('$WORKSPACE', workspacename)])),
|
||||
from_other_thread=True,
|
||||
)
|
||||
|
||||
except CleanError as exc:
|
||||
# Avoid reusing existing if we fail in the middle; could
|
||||
# be in wonky state.
|
||||
set_path = False
|
||||
_ba.pushcall(tpartial(self._errmsg, str(exc)),
|
||||
_ba.pushcall(tpartial(self._errmsg, Lstr(value=str(exc))),
|
||||
from_other_thread=True)
|
||||
except Exception:
|
||||
# Ditto.
|
||||
set_path = False
|
||||
logging.exception('Error syncing workspace.')
|
||||
# TODO: Lstr.
|
||||
_ba.pushcall(tpartial(
|
||||
self._errmsg, 'Error syncing workspace. See log for details.'),
|
||||
from_other_thread=True)
|
||||
logging.exception("Error syncing workspace '%s'.", workspacename)
|
||||
_ba.pushcall(
|
||||
tpartial(
|
||||
self._errmsg,
|
||||
Lstr(resource='workspaceSyncErrorText',
|
||||
subs=[('${WORKSPACE}', workspacename)]),
|
||||
),
|
||||
from_other_thread=True,
|
||||
)
|
||||
|
||||
if set_path and wspath.is_dir():
|
||||
# Add to Python paths and also to list of stuff to be scanned
|
||||
|
|
|
|||
6
dist/ba_data/python/bastd/actor/bomb.py
vendored
6
dist/ba_data/python/bastd/actor/bomb.py
vendored
|
|
@ -327,7 +327,7 @@ class Blast(ba.Actor):
|
|||
velocity: Sequence[float] = (0.0, 0.0, 0.0),
|
||||
blast_radius: float = 2.0,
|
||||
blast_type: str = 'normal',
|
||||
source_player: ba.Player = None,
|
||||
source_player: ba.Player | None = None,
|
||||
hit_type: str = 'explosion',
|
||||
hit_subtype: str = 'normal'):
|
||||
"""Instantiate with given values."""
|
||||
|
|
@ -657,8 +657,8 @@ class Bomb(ba.Actor):
|
|||
bomb_type: str = 'normal',
|
||||
blast_radius: float = 2.0,
|
||||
bomb_scale: float = 1.0,
|
||||
source_player: ba.Player = None,
|
||||
owner: ba.Node = None):
|
||||
source_player: ba.Player | None = None,
|
||||
owner: ba.Node | None = None):
|
||||
"""Create a new Bomb.
|
||||
|
||||
bomb_type can be 'ice','impact','land_mine','normal','sticky', or
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class ControlsGuide(ba.Actor):
|
|||
position: tuple[float, float] = (390.0, 120.0),
|
||||
scale: float = 1.0,
|
||||
delay: float = 0.0,
|
||||
lifespan: float = None,
|
||||
lifespan: float | None = None,
|
||||
bright: bool = False):
|
||||
"""Instantiate an overlay.
|
||||
|
||||
|
|
|
|||
4
dist/ba_data/python/bastd/actor/flag.py
vendored
4
dist/ba_data/python/bastd/actor/flag.py
vendored
|
|
@ -167,9 +167,9 @@ class Flag(ba.Actor):
|
|||
def __init__(self,
|
||||
position: Sequence[float] = (0.0, 1.0, 0.0),
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
materials: Sequence[ba.Material] = None,
|
||||
materials: Sequence[ba.Material] | None = None,
|
||||
touchable: bool = True,
|
||||
dropped_timeout: int = None):
|
||||
dropped_timeout: int | None = None):
|
||||
"""Instantiate a flag.
|
||||
|
||||
If 'touchable' is False, the flag will only touch terrain;
|
||||
|
|
|
|||
6
dist/ba_data/python/bastd/actor/image.py
vendored
6
dist/ba_data/python/bastd/actor/image.py
vendored
|
|
@ -40,9 +40,9 @@ class Image(ba.Actor):
|
|||
attach: Attach = Attach.CENTER,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0, 1.0),
|
||||
scale: tuple[float, float] = (100.0, 100.0),
|
||||
transition_out_delay: float = None,
|
||||
model_opaque: ba.Model = None,
|
||||
model_transparent: ba.Model = None,
|
||||
transition_out_delay: float | None = None,
|
||||
model_opaque: ba.Model | None = None,
|
||||
model_transparent: ba.Model | None = None,
|
||||
vr_depth: float = 0.0,
|
||||
host_only: bool = False,
|
||||
front: bool = False):
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ class OnScreenCountdown(ba.Actor):
|
|||
Useful for time-based games that count down to zero.
|
||||
"""
|
||||
|
||||
def __init__(self, duration: int, endcall: Callable[[], Any] = None):
|
||||
def __init__(self,
|
||||
duration: int,
|
||||
endcall: Callable[[], Any] | None = None):
|
||||
"""Duration is provided in seconds."""
|
||||
super().__init__()
|
||||
self._timeremaining = duration
|
||||
|
|
@ -73,7 +75,7 @@ class OnScreenCountdown(ba.Actor):
|
|||
# Release callbacks/refs.
|
||||
self._endcall = None
|
||||
|
||||
def _update(self, forcevalue: int = None) -> None:
|
||||
def _update(self, forcevalue: int | None = None) -> None:
|
||||
if forcevalue is not None:
|
||||
tval = forcevalue
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ class PowerupBoxFactory:
|
|||
self._powerupdist.append(powerup)
|
||||
|
||||
def get_random_powerup_type(self,
|
||||
forcetype: str = None,
|
||||
excludetypes: list[str] = None) -> str:
|
||||
forcetype: str | None = None,
|
||||
excludetypes: list[str] | None = None) -> str:
|
||||
"""Returns a random powerup type (string).
|
||||
|
||||
See ba.Powerup.poweruptype for available type values.
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ class _Entry:
|
|||
|
||||
def set_value(self,
|
||||
score: float,
|
||||
max_score: float = None,
|
||||
max_score: float | None = None,
|
||||
countdown: bool = False,
|
||||
flash: bool = True,
|
||||
show_value: bool = True) -> None:
|
||||
|
|
@ -327,7 +327,7 @@ class Scoreboard:
|
|||
|
||||
_ENTRYSTORENAME = ba.storagename('entry')
|
||||
|
||||
def __init__(self, label: ba.Lstr = None, score_split: float = 0.7):
|
||||
def __init__(self, label: ba.Lstr | None = None, score_split: float = 0.7):
|
||||
"""Instantiate a scoreboard.
|
||||
|
||||
Label can be something like 'points' and will
|
||||
|
|
@ -356,7 +356,7 @@ class Scoreboard:
|
|||
def set_team_value(self,
|
||||
team: ba.Team,
|
||||
score: float,
|
||||
max_score: float = None,
|
||||
max_score: float | None = None,
|
||||
countdown: bool = False,
|
||||
flash: bool = True,
|
||||
show_value: bool = True) -> None:
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/actor/spawner.py
vendored
2
dist/ba_data/python/bastd/actor/spawner.py
vendored
|
|
@ -54,7 +54,7 @@ class Spawner:
|
|||
pt: Sequence[float] = (0, 0, 0), # pylint: disable=invalid-name
|
||||
spawn_time: float = 1.0,
|
||||
send_spawn_message: bool = True,
|
||||
spawn_callback: Callable[[], Any] = None):
|
||||
spawn_callback: Callable[[], Any] | None = None):
|
||||
"""Instantiate a Spawner.
|
||||
|
||||
Requires some custom data, a position,
|
||||
|
|
|
|||
7
dist/ba_data/python/bastd/actor/spaz.py
vendored
7
dist/ba_data/python/bastd/actor/spaz.py
vendored
|
|
@ -67,7 +67,7 @@ class Spaz(ba.Actor):
|
|||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
highlight: Sequence[float] = (0.5, 0.5, 0.5),
|
||||
character: str = 'Spaz',
|
||||
source_player: ba.Player = None,
|
||||
source_player: ba.Player | None = None,
|
||||
start_invincible: bool = True,
|
||||
can_accept_powerups: bool = True,
|
||||
powerups_expire: bool = False,
|
||||
|
|
@ -177,6 +177,7 @@ class Spaz(ba.Actor):
|
|||
self._bomb_wear_off_timer: ba.Timer | None = None
|
||||
self._bomb_wear_off_flash_timer: ba.Timer | None = None
|
||||
self._multi_bomb_wear_off_timer: ba.Timer | None = None
|
||||
self._multi_bomb_wear_off_flash_timer: ba.Timer | None = None
|
||||
self.bomb_count = self.default_bomb_count
|
||||
self._max_bomb_count = self.default_bomb_count
|
||||
self.bomb_type_default = self.default_bomb_type
|
||||
|
|
@ -704,7 +705,7 @@ class Spaz(ba.Actor):
|
|||
self.node.mini_billboard_1_start_time = t_ms
|
||||
self.node.mini_billboard_1_end_time = (
|
||||
t_ms + POWERUP_WEAR_OFF_TIME)
|
||||
self._multi_bomb_wear_off_timer = (ba.Timer(
|
||||
self._multi_bomb_wear_off_flash_timer = (ba.Timer(
|
||||
(POWERUP_WEAR_OFF_TIME - 2000),
|
||||
ba.WeakCall(self._multi_bomb_wear_off_flash),
|
||||
timeformat=ba.TimeFormat.MILLISECONDS))
|
||||
|
|
@ -1266,7 +1267,7 @@ class Spaz(ba.Actor):
|
|||
else:
|
||||
self.node.counter_text = ''
|
||||
|
||||
def curse_explode(self, source_player: ba.Player = None) -> None:
|
||||
def curse_explode(self, source_player: ba.Player | None = None) -> None:
|
||||
"""Explode the poor spaz spectacularly."""
|
||||
if self._cursed and self.node:
|
||||
self.shatter(extreme=True)
|
||||
|
|
|
|||
11
dist/ba_data/python/bastd/actor/spazbot.py
vendored
11
dist/ba_data/python/bastd/actor/spazbot.py
vendored
|
|
@ -888,11 +888,12 @@ class SpazBotSet:
|
|||
def __del__(self) -> None:
|
||||
self.clear()
|
||||
|
||||
def spawn_bot(self,
|
||||
bot_type: type[SpazBot],
|
||||
pos: Sequence[float],
|
||||
spawn_time: float = 3.0,
|
||||
on_spawn_call: Callable[[SpazBot], Any] = None) -> None:
|
||||
def spawn_bot(
|
||||
self,
|
||||
bot_type: type[SpazBot],
|
||||
pos: Sequence[float],
|
||||
spawn_time: float = 3.0,
|
||||
on_spawn_call: Callable[[SpazBot], Any] | None = None) -> None:
|
||||
"""Spawn a bot from this set."""
|
||||
from bastd.actor import spawner
|
||||
spawner.Spawner(pt=pos,
|
||||
|
|
|
|||
4
dist/ba_data/python/bastd/actor/text.py
vendored
4
dist/ba_data/python/bastd/actor/text.py
vendored
|
|
@ -60,8 +60,8 @@ class Text(ba.Actor):
|
|||
v_attach: VAttach = VAttach.CENTER,
|
||||
h_attach: HAttach = HAttach.CENTER,
|
||||
scale: float = 1.0,
|
||||
transition_out_delay: float = None,
|
||||
maxwidth: float = None,
|
||||
transition_out_delay: float | None = None,
|
||||
maxwidth: float | None = None,
|
||||
shadow: float = 0.5,
|
||||
flatness: float = 0.0,
|
||||
vr_depth: float = 0.0,
|
||||
|
|
|
|||
8
dist/ba_data/python/bastd/actor/zoomtext.py
vendored
8
dist/ba_data/python/bastd/actor/zoomtext.py
vendored
|
|
@ -24,9 +24,9 @@ class ZoomText(ba.Actor):
|
|||
def __init__(self,
|
||||
text: str | ba.Lstr,
|
||||
position: tuple[float, float] = (0.0, 0.0),
|
||||
shiftposition: tuple[float, float] = None,
|
||||
shiftdelay: float = None,
|
||||
lifespan: float = None,
|
||||
shiftposition: tuple[float, float] | None = None,
|
||||
shiftdelay: float | None = None,
|
||||
lifespan: float | None = None,
|
||||
flash: bool = True,
|
||||
trail: bool = True,
|
||||
h_align: str = 'center',
|
||||
|
|
@ -36,7 +36,7 @@ class ZoomText(ba.Actor):
|
|||
scale: float = 1.0,
|
||||
project_scale: float = 1.0,
|
||||
tilt_translate: float = 0.0,
|
||||
maxwidth: float = None):
|
||||
maxwidth: float | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
super().__init__()
|
||||
self._dying = False
|
||||
|
|
|
|||
|
|
@ -492,8 +492,8 @@ class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]):
|
|||
|
||||
def spawn_player_spaz(self,
|
||||
player: Player,
|
||||
position: Sequence[float] = None,
|
||||
angle: float = None) -> PlayerSpaz:
|
||||
position: Sequence[float] | None = None,
|
||||
angle: float | None = None) -> PlayerSpaz:
|
||||
"""Intercept new spazzes and add our team material for them."""
|
||||
spaz = super().spawn_player_spaz(player, position, angle)
|
||||
player = spaz.getplayer(Player, True)
|
||||
|
|
|
|||
37
dist/ba_data/python/bastd/game/chosenone.py
vendored
37
dist/ba_data/python/bastd/game/chosenone.py
vendored
|
|
@ -137,9 +137,6 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
|||
self.setup_standard_powerup_drops()
|
||||
self._flag_spawn_pos = self.map.get_flag_position(None)
|
||||
Flag.project_stand(self._flag_spawn_pos)
|
||||
self._set_chosen_one_player(None)
|
||||
|
||||
pos = self._flag_spawn_pos
|
||||
ba.timer(1.0, call=self._tick, repeat=True)
|
||||
|
||||
mat = self._reset_region_material = ba.Material()
|
||||
|
|
@ -156,14 +153,20 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
|||
),
|
||||
)
|
||||
|
||||
self._reset_region = ba.newnode('region',
|
||||
attrs={
|
||||
'position': (pos[0], pos[1] + 0.75,
|
||||
pos[2]),
|
||||
'scale': (0.5, 0.5, 0.5),
|
||||
'type': 'sphere',
|
||||
'materials': [mat]
|
||||
})
|
||||
self._set_chosen_one_player(None)
|
||||
|
||||
def _create_reset_region(self) -> None:
|
||||
assert self._reset_region_material is not None
|
||||
assert self._flag_spawn_pos is not None
|
||||
pos = self._flag_spawn_pos
|
||||
self._reset_region = ba.newnode(
|
||||
'region',
|
||||
attrs={
|
||||
'position': (pos[0], pos[1] + 0.75, pos[2]),
|
||||
'scale': (0.5, 0.5, 0.5),
|
||||
'type': 'sphere',
|
||||
'materials': [self._reset_region_material]
|
||||
})
|
||||
|
||||
def _get_chosen_one_player(self) -> Player | None:
|
||||
# Should never return invalid references; return None in that case.
|
||||
|
|
@ -176,14 +179,14 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
|||
if self._get_chosen_one_player() is not None:
|
||||
return
|
||||
|
||||
# Attempt to get a Player controlling a Spaz that we hit.
|
||||
# Attempt to get a Actor that we hit.
|
||||
try:
|
||||
player = ba.getcollision().opposingnode.getdelegate(
|
||||
PlayerSpaz, True).getplayer(Player, True)
|
||||
spaz = ba.getcollision().opposingnode.getdelegate(PlayerSpaz, True)
|
||||
player = spaz.getplayer(Player, True)
|
||||
except ba.NotFoundError:
|
||||
return
|
||||
|
||||
if player.is_alive():
|
||||
if spaz.is_alive():
|
||||
self._set_chosen_one_player(player)
|
||||
|
||||
def _flash_flag_spawn(self) -> None:
|
||||
|
|
@ -278,6 +281,10 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
|
|||
|
||||
# Also an extra momentary flash.
|
||||
self._flash_flag_spawn()
|
||||
|
||||
# Re-create our flag region in case if someone is waiting for
|
||||
# flag right there:
|
||||
self._create_reset_region()
|
||||
else:
|
||||
if player.actor:
|
||||
self._flag = None
|
||||
|
|
|
|||
6
dist/ba_data/python/bastd/game/football.py
vendored
6
dist/ba_data/python/bastd/game/football.py
vendored
|
|
@ -596,7 +596,9 @@ class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
|
|||
if closest_bot is not None:
|
||||
closest_bot.target_flag = self._flag
|
||||
|
||||
def _drop_powerup(self, index: int, poweruptype: str = None) -> None:
|
||||
def _drop_powerup(self,
|
||||
index: int,
|
||||
poweruptype: str | None = None) -> None:
|
||||
if poweruptype is None:
|
||||
poweruptype = (PowerupBoxFactory.get().get_random_powerup_type(
|
||||
excludetypes=self._exclude_powerups))
|
||||
|
|
@ -610,7 +612,7 @@ class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
|
|||
|
||||
def _drop_powerups(self,
|
||||
standard_points: bool = False,
|
||||
poweruptype: str = None) -> None:
|
||||
poweruptype: str | None = None) -> None:
|
||||
"""Generic powerup drop."""
|
||||
if standard_points:
|
||||
spawnpoints = self.map.powerup_spawn_points
|
||||
|
|
|
|||
6
dist/ba_data/python/bastd/game/onslaught.py
vendored
6
dist/ba_data/python/bastd/game/onslaught.py
vendored
|
|
@ -690,7 +690,9 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
|||
del player, bomb # Unused.
|
||||
self._player_has_dropped_bomb = True
|
||||
|
||||
def _drop_powerup(self, index: int, poweruptype: str = None) -> None:
|
||||
def _drop_powerup(self,
|
||||
index: int,
|
||||
poweruptype: str | None = None) -> None:
|
||||
poweruptype = (PowerupBoxFactory.get().get_random_powerup_type(
|
||||
forcetype=poweruptype, excludetypes=self._excluded_powerups))
|
||||
PowerupBox(position=self.map.powerup_spawn_points[index],
|
||||
|
|
@ -703,7 +705,7 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
|
|||
|
||||
def _drop_powerups(self,
|
||||
standard_points: bool = False,
|
||||
poweruptype: str = None) -> None:
|
||||
poweruptype: str | None = None) -> None:
|
||||
"""Generic powerup drop."""
|
||||
if standard_points:
|
||||
points = self.map.powerup_spawn_points
|
||||
|
|
|
|||
6
dist/ba_data/python/bastd/game/runaround.py
vendored
6
dist/ba_data/python/bastd/game/runaround.py
vendored
|
|
@ -497,7 +497,9 @@ class RunaroundGame(ba.CoopGameActivity[Player, Team]):
|
|||
del player # Unused.
|
||||
self._player_has_picked_up_powerup = True
|
||||
|
||||
def _drop_powerup(self, index: int, poweruptype: str = None) -> None:
|
||||
def _drop_powerup(self,
|
||||
index: int,
|
||||
poweruptype: str | None = None) -> None:
|
||||
if poweruptype is None:
|
||||
poweruptype = (PowerupBoxFactory.get().get_random_powerup_type(
|
||||
excludetypes=self._exclude_powerups))
|
||||
|
|
@ -509,7 +511,7 @@ class RunaroundGame(ba.CoopGameActivity[Player, Team]):
|
|||
|
||||
def _drop_powerups(self,
|
||||
standard_points: bool = False,
|
||||
force_first: str = None) -> None:
|
||||
force_first: str | None = None) -> None:
|
||||
"""Generic powerup drop."""
|
||||
|
||||
# If its been a minute since our last wave finished emerging, stop
|
||||
|
|
|
|||
|
|
@ -132,7 +132,9 @@ class TheLastStandGame(ba.CoopGameActivity[Player, Team]):
|
|||
self._bot_update_timer = ba.Timer(self._bot_update_interval,
|
||||
ba.WeakCall(self._update_bots))
|
||||
|
||||
def _drop_powerup(self, index: int, poweruptype: str = None) -> None:
|
||||
def _drop_powerup(self,
|
||||
index: int,
|
||||
poweruptype: str | None = None) -> None:
|
||||
if poweruptype is None:
|
||||
poweruptype = (PowerupBoxFactory.get().get_random_powerup_type(
|
||||
excludetypes=self._excludepowerups))
|
||||
|
|
@ -146,7 +148,7 @@ class TheLastStandGame(ba.CoopGameActivity[Player, Team]):
|
|||
|
||||
def _drop_powerups(self,
|
||||
standard_points: bool = False,
|
||||
force_first: str = None) -> None:
|
||||
force_first: str | None = None) -> None:
|
||||
"""Generic powerup drop."""
|
||||
from bastd.actor import powerupbox
|
||||
if standard_points:
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/mainmenu.py
vendored
2
dist/ba_data/python/bastd/mainmenu.py
vendored
|
|
@ -767,7 +767,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
|
|||
y: float,
|
||||
scale: float,
|
||||
delay: float,
|
||||
custom_texture: str = None,
|
||||
custom_texture: str | None = None,
|
||||
jitter_scale: float = 1.0,
|
||||
rotate: float = 0.0,
|
||||
vr_depth_offset: float = 0.0) -> None:
|
||||
|
|
|
|||
10
dist/ba_data/python/bastd/tutorial.py
vendored
10
dist/ba_data/python/bastd/tutorial.py
vendored
|
|
@ -178,7 +178,7 @@ class Team(ba.Team[Player]):
|
|||
|
||||
class TutorialActivity(ba.Activity[Player, Team]):
|
||||
|
||||
def __init__(self, settings: dict = None):
|
||||
def __init__(self, settings: dict | None = None):
|
||||
from bastd.maps import Rampage
|
||||
if settings is None:
|
||||
settings = {}
|
||||
|
|
@ -492,7 +492,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
|
|||
position: Sequence[float],
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
make_current: bool = False,
|
||||
relative_to: int = None,
|
||||
relative_to: int | None = None,
|
||||
name: str | ba.Lstr = '',
|
||||
flash: bool = True,
|
||||
angle: float = 0.0):
|
||||
|
|
@ -550,7 +550,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
|
|||
position: Sequence[float],
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
make_current: bool = False,
|
||||
relative_to: int = None):
|
||||
relative_to: int | None = None):
|
||||
self._position = position
|
||||
self._relative_to = relative_to
|
||||
|
||||
|
|
@ -761,7 +761,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
|
|||
|
||||
class PrintPos:
|
||||
|
||||
def __init__(self, spaz_num: int = None):
|
||||
def __init__(self, spaz_num: int | None = None):
|
||||
self._spaz_num = spaz_num
|
||||
|
||||
def run(self, a: TutorialActivity) -> None:
|
||||
|
|
@ -787,7 +787,7 @@ class TutorialActivity(ba.Activity[Player, Team]):
|
|||
|
||||
def __init__(self,
|
||||
celebrate_type: str = 'both',
|
||||
spaz_num: int = None,
|
||||
spaz_num: int | None = None,
|
||||
duration: int = 1000):
|
||||
self._spaz_num = spaz_num
|
||||
self._celebrate_type = celebrate_type
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import _ba
|
|||
import ba
|
||||
|
||||
|
||||
def show_sign_in_prompt(account_type: str = None) -> None:
|
||||
def show_sign_in_prompt(account_type: str | None = None) -> None:
|
||||
"""Bring up a prompt telling the user they must sign in."""
|
||||
from bastd.ui.confirm import ConfirmWindow
|
||||
from bastd.ui.account import settings
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/ui/account/link.py
vendored
2
dist/ba_data/python/bastd/ui/account/link.py
vendored
|
|
@ -18,7 +18,7 @@ if TYPE_CHECKING:
|
|||
class AccountLinkWindow(ba.Window):
|
||||
"""Window for linking accounts."""
|
||||
|
||||
def __init__(self, origin_widget: ba.Widget = None):
|
||||
def __init__(self, origin_widget: ba.Widget | None = None):
|
||||
scale_origin: tuple[float, float] | None
|
||||
if origin_widget is not None:
|
||||
self._transition_out = 'out_scale'
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class AccountSettingsWindow(ba.Window):
|
|||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
modal: bool = False,
|
||||
origin_widget: ba.Widget = None,
|
||||
origin_widget: ba.Widget | None = None,
|
||||
close_once_signed_in: bool = False):
|
||||
# pylint: disable=too-many-statements
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
|||
class AccountUnlinkWindow(ba.Window):
|
||||
"""A window to kick off account unlinks."""
|
||||
|
||||
def __init__(self, origin_widget: ba.Widget = None):
|
||||
def __init__(self, origin_widget: ba.Widget | None = None):
|
||||
scale_origin: tuple[float, float] | None
|
||||
if origin_widget is not None:
|
||||
self._transition_out = 'out_scale'
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ class AccountViewerWindow(popup.PopupWindow):
|
|||
|
||||
def __init__(self,
|
||||
account_id: str,
|
||||
profile_id: str = None,
|
||||
profile_id: str | None = None,
|
||||
position: tuple[float, float] = (0.0, 0.0),
|
||||
scale: float = None,
|
||||
scale: float | None = None,
|
||||
offset: tuple[float, float] = (0.0, 0.0)):
|
||||
from ba.internal import is_browser_likely_available, master_server_get
|
||||
|
||||
|
|
|
|||
4
dist/ba_data/python/bastd/ui/achievements.py
vendored
4
dist/ba_data/python/bastd/ui/achievements.py
vendored
|
|
@ -16,7 +16,9 @@ if TYPE_CHECKING:
|
|||
class AchievementsWindow(popup.PopupWindow):
|
||||
"""Popup window to view achievements."""
|
||||
|
||||
def __init__(self, position: tuple[float, float], scale: float = None):
|
||||
def __init__(self,
|
||||
position: tuple[float, float],
|
||||
scale: float | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
uiscale = ba.app.ui.uiscale
|
||||
if scale is None:
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ class CharacterPicker(popup.PopupWindow):
|
|||
parent: ba.Widget,
|
||||
position: tuple[float, float] = (0.0, 0.0),
|
||||
delegate: Any = None,
|
||||
scale: float = None,
|
||||
scale: float | None = None,
|
||||
offset: tuple[float, float] = (0.0, 0.0),
|
||||
tint_color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
tint2_color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
selected_character: str = None):
|
||||
selected_character: str | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
from bastd.actor import spazappearance
|
||||
del parent # unused here
|
||||
|
|
|
|||
4
dist/ba_data/python/bastd/ui/colorpicker.py
vendored
4
dist/ba_data/python/bastd/ui/colorpicker.py
vendored
|
|
@ -24,7 +24,7 @@ class ColorPicker(PopupWindow):
|
|||
position: tuple[float, float],
|
||||
initial_color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
delegate: Any = None,
|
||||
scale: float = None,
|
||||
scale: float | None = None,
|
||||
offset: tuple[float, float] = (0.0, 0.0),
|
||||
tag: Any = ''):
|
||||
# pylint: disable=too-many-locals
|
||||
|
|
@ -162,7 +162,7 @@ class ColorPickerExact(PopupWindow):
|
|||
position: tuple[float, float],
|
||||
initial_color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
delegate: Any = None,
|
||||
scale: float = None,
|
||||
scale: float | None = None,
|
||||
offset: tuple[float, float] = (0.0, 0.0),
|
||||
tag: Any = ''):
|
||||
# pylint: disable=too-many-locals
|
||||
|
|
|
|||
8
dist/ba_data/python/bastd/ui/config.py
vendored
8
dist/ba_data/python/bastd/ui/config.py
vendored
|
|
@ -28,10 +28,10 @@ class ConfigCheckBox:
|
|||
position: tuple[float, float],
|
||||
size: tuple[float, float],
|
||||
displayname: str | ba.Lstr | None = None,
|
||||
scale: float = None,
|
||||
maxwidth: float = None,
|
||||
scale: float | None = None,
|
||||
maxwidth: float | None = None,
|
||||
autoselect: bool = True,
|
||||
value_change_call: Callable[[Any], Any] = None):
|
||||
value_change_call: Callable[[Any], Any] | None = None):
|
||||
if displayname is None:
|
||||
displayname = configkey
|
||||
self._value_change_call = value_change_call
|
||||
|
|
@ -84,7 +84,7 @@ class ConfigNumberEdit:
|
|||
minval: float = 0.0,
|
||||
maxval: float = 100.0,
|
||||
increment: float = 1.0,
|
||||
callback: Callable[[float], Any] = None,
|
||||
callback: Callable[[float], Any] | None = None,
|
||||
xoffset: float = 0.0,
|
||||
displayname: str | ba.Lstr | None = None,
|
||||
changesound: bool = True,
|
||||
|
|
|
|||
6
dist/ba_data/python/bastd/ui/confirm.py
vendored
6
dist/ba_data/python/bastd/ui/confirm.py
vendored
|
|
@ -18,7 +18,7 @@ class ConfirmWindow:
|
|||
|
||||
def __init__(self,
|
||||
text: str | ba.Lstr = 'Are you sure?',
|
||||
action: Callable[[], Any] = None,
|
||||
action: Callable[[], Any] | None = None,
|
||||
width: float = 360.0,
|
||||
height: float = 100.0,
|
||||
cancel_button: bool = True,
|
||||
|
|
@ -27,7 +27,7 @@ class ConfirmWindow:
|
|||
text_scale: float = 1.0,
|
||||
ok_text: str | ba.Lstr | None = None,
|
||||
cancel_text: str | ba.Lstr | None = None,
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
if ok_text is None:
|
||||
ok_text = ba.Lstr(resource='okText')
|
||||
|
|
@ -127,7 +127,7 @@ class QuitWindow:
|
|||
def __init__(self,
|
||||
swish: bool = False,
|
||||
back: bool = False,
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
ui = ba.app.ui
|
||||
app = ba.app
|
||||
self._back = back
|
||||
|
|
|
|||
4
dist/ba_data/python/bastd/ui/coop/browser.py
vendored
4
dist/ba_data/python/bastd/ui/coop/browser.py
vendored
|
|
@ -37,7 +37,7 @@ class CoopBrowserWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str | None = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=cyclic-import
|
||||
import threading
|
||||
|
|
@ -1415,7 +1415,7 @@ class CoopBrowserWindow(ba.Window):
|
|||
|
||||
def run(self,
|
||||
game: str | None,
|
||||
tournament_button: dict[str, Any] = None) -> None:
|
||||
tournament_button: dict[str, Any] | None = None) -> None:
|
||||
"""Run the provided game."""
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-statements
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/ui/creditslist.py
vendored
2
dist/ba_data/python/bastd/ui/creditslist.py
vendored
|
|
@ -16,7 +16,7 @@ if TYPE_CHECKING:
|
|||
class CreditsListWindow(ba.Window):
|
||||
"""Window for displaying game credits."""
|
||||
|
||||
def __init__(self, origin_widget: ba.Widget = None):
|
||||
def __init__(self, origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=too-many-statements
|
||||
import json
|
||||
|
|
|
|||
4
dist/ba_data/python/bastd/ui/fileselector.py
vendored
4
dist/ba_data/python/bastd/ui/fileselector.py
vendored
|
|
@ -21,9 +21,9 @@ class FileSelectorWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
path: str,
|
||||
callback: Callable[[str | None], Any] = None,
|
||||
callback: Callable[[str | None], Any] | None = None,
|
||||
show_base_path: bool = True,
|
||||
valid_file_extensions: Sequence[str] = None,
|
||||
valid_file_extensions: Sequence[str] | None = None,
|
||||
allow_folders: bool = False):
|
||||
if valid_file_extensions is None:
|
||||
valid_file_extensions = []
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class GatherWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str | None = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=cyclic-import
|
||||
|
|
|
|||
8
dist/ba_data/python/bastd/ui/getcurrency.py
vendored
8
dist/ba_data/python/bastd/ui/getcurrency.py
vendored
|
|
@ -20,8 +20,8 @@ class GetCurrencyWindow(ba.Window):
|
|||
transition: str = 'in_right',
|
||||
from_modal_store: bool = False,
|
||||
modal: bool = False,
|
||||
origin_widget: ba.Widget = None,
|
||||
store_back_location: str = None):
|
||||
origin_widget: ba.Widget | None = None,
|
||||
store_back_location: str | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
|
||||
|
|
@ -105,8 +105,8 @@ class GetCurrencyWindow(ba.Window):
|
|||
position: tuple[float, float],
|
||||
size: tuple[float, float],
|
||||
label: ba.Lstr,
|
||||
price: str = None,
|
||||
tex_name: str = None,
|
||||
price: str | None = None,
|
||||
tex_name: str | None = None,
|
||||
tex_opacity: float = 1.0,
|
||||
tex_scale: float = 1.0,
|
||||
enabled: bool = True,
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/ui/helpui.py
vendored
2
dist/ba_data/python/bastd/ui/helpui.py
vendored
|
|
@ -18,7 +18,7 @@ class HelpWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
main_menu: bool = False,
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
from ba.internal import get_remote_app_name
|
||||
|
|
|
|||
4
dist/ba_data/python/bastd/ui/iconpicker.py
vendored
4
dist/ba_data/python/bastd/ui/iconpicker.py
vendored
|
|
@ -22,11 +22,11 @@ class IconPicker(popup.PopupWindow):
|
|||
parent: ba.Widget,
|
||||
position: tuple[float, float] = (0.0, 0.0),
|
||||
delegate: Any = None,
|
||||
scale: float = None,
|
||||
scale: float | None = None,
|
||||
offset: tuple[float, float] = (0.0, 0.0),
|
||||
tint_color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
tint2_color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
selected_icon: str = None):
|
||||
selected_icon: str | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
del parent # unused here
|
||||
del tint_color # unused_here
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ class LeagueRankButton:
|
|||
position: tuple[float, float],
|
||||
size: tuple[float, float],
|
||||
scale: float,
|
||||
on_activate_call: Callable[[], Any] = None,
|
||||
transition_delay: float = None,
|
||||
color: tuple[float, float, float] = None,
|
||||
textcolor: tuple[float, float, float] = None,
|
||||
smooth_update_delay: float = None):
|
||||
on_activate_call: Callable[[], Any] | None = None,
|
||||
transition_delay: float | None = None,
|
||||
color: tuple[float, float, float] | None = None,
|
||||
textcolor: tuple[float, float, float] | None = None,
|
||||
smooth_update_delay: float | None = None):
|
||||
if on_activate_call is None:
|
||||
on_activate_call = ba.WeakCall(self._default_on_activate_call)
|
||||
self._on_activate_call = on_activate_call
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class LeagueRankWindow(ba.Window):
|
|||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
modal: bool = False,
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
ba.set_analytics_screen('League Rank Window')
|
||||
|
||||
self._league_rank_data: dict[str, Any] | None = None
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/ui/play.py
vendored
2
dist/ba_data/python/bastd/ui/play.py
vendored
|
|
@ -18,7 +18,7 @@ class PlayWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
import threading
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class PlaylistBrowserWindow(ba.Window):
|
|||
def __init__(self,
|
||||
sessiontype: type[ba.Session],
|
||||
transition: str | None = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=cyclic-import
|
||||
from bastd.ui.playlist import PlaylistTypeVars
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||
def __init__(self,
|
||||
sessiontype: type[ba.Session],
|
||||
transition: str = 'in_right',
|
||||
select_playlist: str = None,
|
||||
origin_widget: ba.Widget = None):
|
||||
select_playlist: str | None = None,
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# Yes this needs tidying.
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=too-many-statements
|
||||
|
|
@ -297,7 +297,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
|||
_ba.fade_screen(False, endcall=self._run_selected_playlist)
|
||||
_ba.lock_all_input()
|
||||
|
||||
def _refresh(self, select_playlist: str = None) -> None:
|
||||
def _refresh(self, select_playlist: str | None = None) -> None:
|
||||
from efro.util import asserttype
|
||||
old_selection = self._selected_playlist_name
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ class PlaylistEditController:
|
|||
|
||||
def __init__(self,
|
||||
sessiontype: type[ba.Session],
|
||||
existing_playlist_name: str = None,
|
||||
existing_playlist_name: str | None = None,
|
||||
transition: str = 'in_right',
|
||||
playlist: list[dict[str, Any]] = None,
|
||||
playlist_name: str = None):
|
||||
playlist: list[dict[str, Any]] | None = None,
|
||||
playlist_name: str | None = None):
|
||||
from ba.internal import preload_map_preview_media, filter_playlist
|
||||
from bastd.ui.playlist import PlaylistTypeVars
|
||||
from bastd.ui.playlist.edit import PlaylistEditWindow
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ class PlaylistEditGameWindow(ba.Window):
|
|||
sessiontype: type[ba.Session],
|
||||
config: dict[str, Any] | None,
|
||||
completion_call: Callable[[dict[str, Any] | None], Any],
|
||||
default_selection: str = None,
|
||||
default_selection: str | None = None,
|
||||
transition: str = 'in_right',
|
||||
edit_info: dict[str, Any] = None):
|
||||
edit_info: dict[str, Any] | None = None):
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ class SharePlaylistImportWindow(promocode.PromoCodeWindow):
|
|||
"""Window for importing a shared playlist."""
|
||||
|
||||
def __init__(self,
|
||||
origin_widget: ba.Widget = None,
|
||||
on_success_callback: Callable[[], Any] = None):
|
||||
origin_widget: ba.Widget | None = None,
|
||||
on_success_callback: Callable[[], Any] | None = None):
|
||||
promocode.PromoCodeWindow.__init__(self,
|
||||
modal=True,
|
||||
origin_widget=origin_widget)
|
||||
|
|
|
|||
24
dist/ba_data/python/bastd/ui/popup.py
vendored
24
dist/ba_data/python/bastd/ui/popup.py
vendored
|
|
@ -26,7 +26,7 @@ class PopupWindow:
|
|||
offset: tuple[float, float] = (0, 0),
|
||||
bg_color: tuple[float, float, float] = (0.35, 0.55, 0.15),
|
||||
focus_position: tuple[float, float] = (0, 0),
|
||||
focus_size: tuple[float, float] = None,
|
||||
focus_size: tuple[float, float] | None = None,
|
||||
toolbar_visibility: str = 'menu_minimal_no_back'):
|
||||
# pylint: disable=too-many-locals
|
||||
if focus_size is None:
|
||||
|
|
@ -108,10 +108,10 @@ class PopupMenuWindow(PopupWindow):
|
|||
current_choice: str,
|
||||
delegate: Any = None,
|
||||
width: float = 230.0,
|
||||
maxwidth: float = None,
|
||||
maxwidth: float | None = None,
|
||||
scale: float = 1.0,
|
||||
choices_disabled: Sequence[str] = None,
|
||||
choices_display: Sequence[ba.Lstr] = None):
|
||||
choices_disabled: Sequence[str] | None = None,
|
||||
choices_display: Sequence[ba.Lstr] | None = None):
|
||||
# FIXME: Clean up a bit.
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-locals
|
||||
|
|
@ -268,15 +268,15 @@ class PopupMenu:
|
|||
parent: ba.Widget,
|
||||
position: tuple[float, float],
|
||||
choices: Sequence[str],
|
||||
current_choice: str = None,
|
||||
on_value_change_call: Callable[[str], Any] = None,
|
||||
opening_call: Callable[[], Any] = None,
|
||||
closing_call: Callable[[], Any] = None,
|
||||
current_choice: str | None = None,
|
||||
on_value_change_call: Callable[[str], Any] | None = None,
|
||||
opening_call: Callable[[], Any] | None = None,
|
||||
closing_call: Callable[[], Any] | None = None,
|
||||
width: float = 230.0,
|
||||
maxwidth: float = None,
|
||||
scale: float = None,
|
||||
choices_disabled: Sequence[str] = None,
|
||||
choices_display: Sequence[ba.Lstr] = None,
|
||||
maxwidth: float | None = None,
|
||||
scale: float | None = None,
|
||||
choices_disabled: Sequence[str] | None = None,
|
||||
choices_display: Sequence[ba.Lstr] | None = None,
|
||||
button_size: tuple[float, float] = (160.0, 50.0),
|
||||
autoselect: bool = True):
|
||||
# pylint: disable=too-many-locals
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ class ProfileBrowserWindow(ba.Window):
|
|||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
in_main_menu: bool = True,
|
||||
selected_profile: str = None,
|
||||
origin_widget: ba.Widget = None):
|
||||
selected_profile: str | None = None,
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
self._in_main_menu = in_main_menu
|
||||
|
|
|
|||
4
dist/ba_data/python/bastd/ui/promocode.py
vendored
4
dist/ba_data/python/bastd/ui/promocode.py
vendored
|
|
@ -17,7 +17,9 @@ if TYPE_CHECKING:
|
|||
class PromoCodeWindow(ba.Window):
|
||||
"""Window for entering promo codes."""
|
||||
|
||||
def __init__(self, modal: bool = False, origin_widget: ba.Widget = None):
|
||||
def __init__(self,
|
||||
modal: bool = False,
|
||||
origin_widget: ba.Widget | None = None):
|
||||
|
||||
scale_origin: tuple[float, float] | None
|
||||
if origin_widget is not None:
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/ui/purchase.py
vendored
2
dist/ba_data/python/bastd/ui/purchase.py
vendored
|
|
@ -19,7 +19,7 @@ class PurchaseWindow(ba.Window):
|
|||
def __init__(self,
|
||||
items: list[str],
|
||||
transition: str = 'in_right',
|
||||
header_text: ba.Lstr = None):
|
||||
header_text: ba.Lstr | None = None):
|
||||
from ba.internal import get_store_item_display_size
|
||||
from bastd.ui.store import item as storeitemui
|
||||
if header_text is None:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class AdvancedSettingsWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
from ba.internal import master_server_get
|
||||
import threading
|
||||
|
|
@ -542,6 +542,14 @@ class AdvancedSettingsWindow(ba.Window):
|
|||
|
||||
def _on_net_test_press(self) -> None:
|
||||
from bastd.ui.settings.nettesting import NetTestingWindow
|
||||
|
||||
# Net-testing requires a signed in v1 account.
|
||||
if _ba.get_v1_account_state() != 'signed_in':
|
||||
ba.screenmessage(ba.Lstr(resource='notSignedInErrorText'),
|
||||
color=(1, 0, 0))
|
||||
ba.playsound(ba.getsound('error'))
|
||||
return
|
||||
|
||||
self._save_state()
|
||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||
ba.app.ui.set_main_menu_window(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class AllSettingsWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
import threading
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class AudioSettingsWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=cyclic-import
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class ControlsSettingsWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# FIXME: should tidy up here.
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-branches
|
||||
|
|
|
|||
10
dist/ba_data/python/bastd/ui/settings/gamepad.py
vendored
10
dist/ba_data/python/bastd/ui/settings/gamepad.py
vendored
|
|
@ -21,7 +21,7 @@ class GamepadSettingsWindow(ba.Window):
|
|||
is_main_menu: bool = True,
|
||||
transition: str = 'in_right',
|
||||
transition_out: str = 'out_right',
|
||||
settings: dict = None):
|
||||
settings: dict | None = None):
|
||||
self._input = gamepad
|
||||
|
||||
# If our input-device went away, just return an empty zombie.
|
||||
|
|
@ -652,8 +652,8 @@ class GamepadSettingsWindow(ba.Window):
|
|||
texture: ba.Texture,
|
||||
button: str,
|
||||
scale: float = 1.0,
|
||||
message: ba.Lstr = None,
|
||||
message2: ba.Lstr = None,
|
||||
message: ba.Lstr | None = None,
|
||||
message2: ba.Lstr | None = None,
|
||||
maxwidth: float = 80.0) -> ba.Widget:
|
||||
if message is None:
|
||||
message = ba.Lstr(resource=self._r + '.pressAnyButtonText')
|
||||
|
|
@ -754,8 +754,8 @@ class AwaitGamepadInputWindow(ba.Window):
|
|||
button: str,
|
||||
callback: Callable[[str, dict[str, Any], AwaitGamepadInputWindow],
|
||||
Any],
|
||||
message: ba.Lstr = None,
|
||||
message2: ba.Lstr = None):
|
||||
message: ba.Lstr | None = None,
|
||||
message2: ba.Lstr | None = None):
|
||||
if message is None:
|
||||
print('AwaitGamepadInputWindow message is None!')
|
||||
# Shouldn't get here.
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ class GamepadAdvancedSettingsWindow(ba.Window):
|
|||
increment: float = 1.0,
|
||||
change_sound: bool = True,
|
||||
x_offset: float = 0.0,
|
||||
displayname: ba.Lstr = None) -> tuple[ba.Widget, ba.Widget]:
|
||||
displayname: ba.Lstr | None = None) -> tuple[ba.Widget, ba.Widget]:
|
||||
|
||||
if displayname is None:
|
||||
displayname = name
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class GraphicsSettingsWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-statements
|
||||
|
|
|
|||
|
|
@ -131,7 +131,8 @@ def _run_diagnostics(weakwin: weakref.ref[NetTestingWindow]) -> None:
|
|||
|
||||
# We're running in a background thread but UI stuff needs to run
|
||||
# in the logic thread; give ourself a way to pass stuff to it.
|
||||
def _print(text: str, color: tuple[float, float, float] = None) -> None:
|
||||
def _print(text: str,
|
||||
color: tuple[float, float, float] | None = None) -> None:
|
||||
|
||||
def _print_in_logic_thread() -> None:
|
||||
win = weakwin()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class PluginSettingsWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
app = ba.app
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class SoundtrackBrowserWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=too-many-statements
|
||||
|
||||
|
|
@ -355,7 +355,7 @@ class SoundtrackBrowserWindow(ba.Window):
|
|||
return ba.Lstr(resource=self._r + '.defaultSoundtrackNameText')
|
||||
return ba.Lstr(value=soundtrack)
|
||||
|
||||
def _refresh(self, select_soundtrack: str = None) -> None:
|
||||
def _refresh(self, select_soundtrack: str | None = None) -> None:
|
||||
from efro.util import asserttype
|
||||
self._allow_changing_soundtracks = False
|
||||
old_selection = self._selected_soundtrack
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ class StoreBrowserWindow(ba.Window):
|
|||
def __init__(self,
|
||||
transition: str = 'in_right',
|
||||
modal: bool = False,
|
||||
show_tab: StoreBrowserWindow.TabID = None,
|
||||
on_close_call: Callable[[], Any] = None,
|
||||
back_location: str = None,
|
||||
origin_widget: ba.Widget = None):
|
||||
show_tab: StoreBrowserWindow.TabID | None = None,
|
||||
on_close_call: Callable[[], Any] | None = None,
|
||||
back_location: str | None = None,
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-locals
|
||||
from bastd.ui.tabs import TabRow
|
||||
|
|
|
|||
10
dist/ba_data/python/bastd/ui/store/button.py
vendored
10
dist/ba_data/python/bastd/ui/store/button.py
vendored
|
|
@ -20,12 +20,12 @@ class StoreButton:
|
|||
position: Sequence[float],
|
||||
size: Sequence[float],
|
||||
scale: float,
|
||||
on_activate_call: Callable[[], Any] = None,
|
||||
transition_delay: float = None,
|
||||
color: Sequence[float] = None,
|
||||
textcolor: Sequence[float] = None,
|
||||
on_activate_call: Callable[[], Any] | None = None,
|
||||
transition_delay: float | None = None,
|
||||
color: Sequence[float] | None = None,
|
||||
textcolor: Sequence[float] | None = None,
|
||||
show_tickets: bool = False,
|
||||
button_type: str = None,
|
||||
button_type: str | None = None,
|
||||
sale_scale: float = 1.0):
|
||||
self._position = position
|
||||
self._size = size
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/ui/tabs.py
vendored
2
dist/ba_data/python/bastd/ui/tabs.py
vendored
|
|
@ -35,7 +35,7 @@ class TabRow(Generic[T]):
|
|||
tabdefs: list[tuple[T, ba.Lstr]],
|
||||
pos: tuple[float, float],
|
||||
size: tuple[float, float],
|
||||
on_select_call: Callable[[T], None] = None) -> None:
|
||||
on_select_call: Callable[[T], None] | None = None) -> None:
|
||||
if not tabdefs:
|
||||
raise ValueError('At least one tab def is required')
|
||||
self.tabs: dict[T, Tab] = {}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ class TournamentEntryWindow(popup.PopupWindow):
|
|||
|
||||
def __init__(self,
|
||||
tournament_id: str,
|
||||
tournament_activity: ba.Activity = None,
|
||||
tournament_activity: ba.Activity | None = None,
|
||||
position: tuple[float, float] = (0.0, 0.0),
|
||||
delegate: Any = None,
|
||||
scale: float = None,
|
||||
scale: float | None = None,
|
||||
offset: tuple[float, float] = (0.0, 0.0),
|
||||
on_close_call: Callable[[], Any] = None):
|
||||
on_close_call: Callable[[], Any] | None = None):
|
||||
# Needs some tidying.
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-statements
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ class TournamentScoresWindow(popup_ui.PopupWindow):
|
|||
|
||||
def __init__(self,
|
||||
tournament_id: str,
|
||||
tournament_activity: ba.GameActivity = None,
|
||||
tournament_activity: ba.GameActivity | None = None,
|
||||
position: tuple[float, float] = (0.0, 0.0),
|
||||
scale: float = None,
|
||||
scale: float | None = None,
|
||||
offset: tuple[float, float] = (0.0, 0.0),
|
||||
tint_color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
tint2_color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
selected_character: str = None,
|
||||
on_close_call: Callable[[], Any] = None):
|
||||
selected_character: str | None = None,
|
||||
on_close_call: Callable[[], Any] | None = None):
|
||||
|
||||
del tournament_activity # unused arg
|
||||
del tint_color # unused arg
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/ui/trophies.py
vendored
2
dist/ba_data/python/bastd/ui/trophies.py
vendored
|
|
@ -19,7 +19,7 @@ class TrophiesWindow(popup.PopupWindow):
|
|||
def __init__(self,
|
||||
position: tuple[float, float],
|
||||
data: dict[str, Any],
|
||||
scale: float = None):
|
||||
scale: float | None = None):
|
||||
self._data = data
|
||||
uiscale = ba.app.ui.uiscale
|
||||
if scale is None:
|
||||
|
|
|
|||
2
dist/ba_data/python/bastd/ui/watch.py
vendored
2
dist/ba_data/python/bastd/ui/watch.py
vendored
|
|
@ -25,7 +25,7 @@ class WatchWindow(ba.Window):
|
|||
|
||||
def __init__(self,
|
||||
transition: str | None = 'in_right',
|
||||
origin_widget: ba.Widget = None):
|
||||
origin_widget: ba.Widget | None = None):
|
||||
# pylint: disable=too-many-locals
|
||||
# pylint: disable=too-many-statements
|
||||
from bastd.ui.tabs import TabRow
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ T = TypeVar('T')
|
|||
class _PathCapture:
|
||||
"""Utility for obtaining dataclass storage paths in a type safe way."""
|
||||
|
||||
def __init__(self, obj: Any, pathparts: list[str] = None):
|
||||
def __init__(self, obj: Any, pathparts: list[str] | None = None):
|
||||
self._is_dataclass = dataclasses.is_dataclass(obj)
|
||||
if pathparts is None:
|
||||
pathparts = []
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ PREP_ATTR = '_DCIOPREP'
|
|||
PREP_SESSION_ATTR = '_DCIOPREPSESSION'
|
||||
|
||||
|
||||
def ioprep(cls: type, globalns: dict = None) -> None:
|
||||
def ioprep(cls: type, globalns: dict | None = None) -> None:
|
||||
"""Prep a dataclass type for use with this module's functionality.
|
||||
|
||||
Prepping ensures that all types contained in a data class as well as
|
||||
|
|
|
|||
2
dist/ba_data/python/efro/rpc.py
vendored
2
dist/ba_data/python/efro/rpc.py
vendored
|
|
@ -115,7 +115,7 @@ class RPCEndpoint:
|
|||
label: str,
|
||||
debug_print: bool = False,
|
||||
debug_print_io: bool = False,
|
||||
debug_print_call: Callable[[str], None] = None,
|
||||
debug_print_call: Callable[[str], None] | None = None,
|
||||
keepalive_interval: float = DEFAULT_KEEPALIVE_INTERVAL,
|
||||
keepalive_timeout: float = DEFAULT_KEEPALIVE_TIMEOUT) -> None:
|
||||
self._handle_raw_message_call = handle_raw_message_call
|
||||
|
|
|
|||
2
dist/ba_data/python/efro/util.py
vendored
2
dist/ba_data/python/efro/util.py
vendored
|
|
@ -176,7 +176,7 @@ class DirtyBit:
|
|||
dirty: bool = False,
|
||||
retry_interval: float = 5.0,
|
||||
use_lock: bool = False,
|
||||
auto_dirty_seconds: float = None,
|
||||
auto_dirty_seconds: float | None = None,
|
||||
min_update_interval: float | None = None):
|
||||
curtime = time.time()
|
||||
self._retry_interval = retry_interval
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue