This commit is contained in:
Eric Froemling 2020-06-02 15:37:47 -07:00
parent 67693dc639
commit 546ad7848f
43 changed files with 230 additions and 97 deletions

View File

@ -4132,16 +4132,16 @@
"assets/build/windows/x64/python.exe": "https://files.ballistica.net/cache/ba1/25/a7/dc87c1be41605eb6fefd0145144c",
"assets/build/windows/x64/python37.dll": "https://files.ballistica.net/cache/ba1/b9/e4/d912f56e42e9991bcbb4c804cfcb",
"assets/build/windows/x64/pythonw.exe": "https://files.ballistica.net/cache/ba1/6c/bb/b6f52c306aa4e88061510e96cefe",
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/15/7a/d4e39ad022b8365418ecee4d026b",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ab/ad/7e371dfb7ed7b10d46f0bf9497d8",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/92/28/faa6501d779b381dec7fb9ac19c5",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/45/57/97d03c6230cfc4d9f0687249f408",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/df/ec/9a476535716a8798813506f502a5",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ae/78/7a6522e860506fe1046808ce7b0b",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/fa/67/ec5ab3ace8d2e740e85f23ebfbb0",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/87/49/3c1d3c8a995df400e46df3470b02",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/7c/6f/c04c002f3a92497f52ff56f62bd3",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/e2/c7/91f468ff6714872fe4329a11b27d",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/85/ef/23050d0205b3449a8e4c74c35e62",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ef/a1/78572099ac9ef2d0734fb14ed164"
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2e/aa/9bcdf166975aa5295669df48f641",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d8/44/091ec27299abfb3e4a12efbb4016",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/1b/2f/99bcfa67fb5a77d9d80883fcc9a4",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f6/f5/fbd4514b7ca4663f917ee848acc5",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8b/3c/7f4895731a58ab99c8deb2caa563",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ba/d5/5a51c250695ce84b0cf2d59ef447",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/44/e9/33f406d3ff1a7a5ec5c0d7f185e6",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/53/55/1f3e23b7c6e975056854005de9aa",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/c5/5d/56272619667b1fcd87b759d8688d",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/8b/d0/24e71e25ac40fbd513e21c318ba4",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8a/6a/ba53af1a84abfa764213f1791ea2",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/d8/7b/b32727ec4d7e899d54ebe83e1203"
}

View File

@ -34,6 +34,7 @@
<w>acnt</w>
<w>actionhero</w>
<w>activityname</w>
<w>activityplayer</w>
<w>activitytypes</w>
<w>activityutils</w>
<w>actorclass</w>

View File

@ -34,7 +34,7 @@ NOTE: This file was autogenerated by gendummymodule; do not edit by hand.
"""
# (hash we can use to see if this file is out of date)
# SOURCES_HASH=214847179904844500339904334878206016957
# SOURCES_HASH=78832523659898286100096175148597852751
# I'm sorry Pylint. I know this file saddens you. Be strong.
# pylint: disable=useless-suppression
@ -843,7 +843,7 @@ class SessionPlayer:
character: str
The character this player has selected in their profile.
gameplayer: Optional[ba.Player]
activityplayer: Optional[ba.Player]
The current game-specific instance for this player.
"""
id: int
@ -853,7 +853,7 @@ class SessionPlayer:
color: Sequence[float]
highlight: Sequence[float]
character: str
gameplayer: Optional[ba.Player]
activityplayer: Optional[ba.Player]
def assigninput(self, type: Union[str, Tuple[str, ...]],
call: Callable) -> None:

View File

@ -39,7 +39,7 @@ from _ba import (CollideModel, Context, ContextCall, Data, InputDevice,
open_url, widget)
from ba._activity import Activity
from ba._actor import Actor
from ba._player import PlayerInfo, Player, StandLocation
from ba._player import PlayerInfo, Player, EmptyPlayer, StandLocation
from ba._nodeactor import NodeActor
from ba._app import App
from ba._coopgame import CoopGameActivity
@ -62,7 +62,7 @@ from ba._session import Session
from ba._servermode import ServerController
from ba._score import ScoreType, ScoreInfo
from ba._stats import PlayerScoredMessage, PlayerRecord, Stats
from ba._team import SessionTeam, Team
from ba._team import SessionTeam, Team, EmptyTeam
from ba._teamgame import TeamGameActivity
from ba._dualteamsession import DualTeamSession
from ba._achievement import Achievement

View File

@ -140,7 +140,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
# the next activity?
can_show_ad_on_death = False
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
"""Creates an Activity in the current ba.Session.
The activity will not be actually run until ba.Session.setactivity()
@ -582,7 +582,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
assert team is not None
sessionplayer.setactivity(self)
with _ba.Context(self):
sessionplayer.gameplayer = player = self.create_player(
sessionplayer.activityplayer = player = self.create_player(
sessionplayer)
player.postinit(sessionplayer)
@ -606,7 +606,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
"""
assert not self.expired
player: Any = sessionplayer.gameplayer
player: Any = sessionplayer.activityplayer
assert isinstance(player, self._playertype)
team: Any = sessionplayer.sessionteam.gameteam
assert isinstance(team, self._teamtype)
@ -714,7 +714,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
# These should never fail I think...
sessionplayer.setactivity(None)
sessionplayer.gameplayer = None
sessionplayer.activityplayer = None
def _setup_player_and_team_types(self) -> None:
"""Pull player and team types from our typing.Generic params."""

View File

@ -26,9 +26,9 @@ from typing import TYPE_CHECKING
import _ba
from ba._activity import Activity
from ba._music import setmusic, MusicType
# False positive due to our class_generics_filter custom pylint filter.
from ba import _player
from ba import _team
# False-positive from pylint due to our class-generics-filter.
from ba._player import EmptyPlayer # pylint: disable=W0611
from ba._team import EmptyTeam # pylint: disable=W0611
if TYPE_CHECKING:
from typing import Any, Dict, Optional
@ -36,21 +36,10 @@ if TYPE_CHECKING:
from ba._lobby import JoinInfo
# Even though we don't need custom Player/Team types, define empty ones
# so we don't have ba.Player[Any] and ba.Team[Any] as our types which
# reduces type safety.
class Player(_player.Player['Team']):
"""Our player type for this game."""
class Team(_team.Team[Player]):
"""Our team type for this game."""
class EndSessionActivity(Activity[Player, Team]):
class EndSessionActivity(Activity[EmptyPlayer, EmptyTeam]):
"""Special ba.Activity to fade out and end the current ba.Session."""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
# Keeps prev activity alive while we fade out.
@ -75,13 +64,13 @@ class EndSessionActivity(Activity[Player, Team]):
call_after_ad(Call(_ba.new_host_session, MainMenuSession))
class JoinActivity(Activity[Player, Team]):
class JoinActivity(Activity[EmptyPlayer, EmptyTeam]):
"""Standard activity for waiting for players to join.
It shows tips and other info and waits for all players to check ready.
"""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
# This activity is a special 'joiner' activity.
@ -112,13 +101,13 @@ class JoinActivity(Activity[Player, Team]):
_ba.set_analytics_screen('Joining Screen')
class TransitionActivity(Activity[Player, Team]):
class TransitionActivity(Activity[EmptyPlayer, EmptyTeam]):
"""A simple overlay fade out/in.
Useful as a bare minimum transition between two level based activities.
"""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
# Keep prev activity alive while we fade in.
@ -145,13 +134,13 @@ class TransitionActivity(Activity[Player, Team]):
_ba.timer(0.1, self.end)
class ScoreScreenActivity(Activity[Player, Team]):
class ScoreScreenActivity(Activity[EmptyPlayer, EmptyTeam]):
"""A standard score screen that fades in and shows stuff for a while.
After a specified delay, player input is assigned to end the activity.
"""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self.transition_time = 0.5
self.inherits_tint = True
@ -169,7 +158,7 @@ class ScoreScreenActivity(Activity[Player, Team]):
self._custom_continue_message: Optional[ba.Lstr] = None
self._server_transitioning: Optional[bool] = None
def on_player_join(self, player: Player) -> None:
def on_player_join(self, player: EmptyPlayer) -> None:
from ba import _general
super().on_player_join(player)
time_till_assign = max(
@ -235,7 +224,7 @@ class ScoreScreenActivity(Activity[Player, Team]):
# Otherwise end the activity normally.
self.end()
def _safe_assign(self, player: Player) -> None:
def _safe_assign(self, player: EmptyPlayer) -> None:
# Just to be extra careful, don't assign if we're transitioning out.
# (though theoretically that would be ok).

View File

@ -50,7 +50,7 @@ class CoopGameActivity(GameActivity[PlayerType, TeamType]):
from ba._coopsession import CoopSession
return issubclass(sessiontype, CoopSession)
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
# Cache these for efficiency.

View File

@ -278,7 +278,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
# By default, games support any versus mode
return issubclass(sessiontype, MultiTeamSession)
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
"""Instantiate the Activity."""
super().__init__(settings)
@ -1224,7 +1224,7 @@ class GameActivity(Activity[PlayerType, TeamType]):
trail=trail,
color=color).autoretain()
def _calc_map_name(self, settings: Dict[str, Any]) -> str:
def _calc_map_name(self, settings: dict) -> str:
map_name: str
if 'map' in settings:
map_name = settings['map']

View File

@ -42,7 +42,7 @@ class Level:
def __init__(self,
name: str,
gametype: Type[ba.GameActivity],
settings: Dict[str, Any],
settings: dict,
preview_texture_name: str,
displayname: str = None):
"""Initializes a Level object with the provided values."""

View File

@ -299,6 +299,23 @@ class Player(Generic[TeamType]):
return self.exists()
class EmptyPlayer(Player['ba.EmptyTeam']):
"""An empty player for use by Activities that don't need to define one.
Category: Gameplay Classes
ba.Player and ba.Team are 'Generic' types, and so passing them as
type arguments when defining a ba.Activity reduces type safety.
For example, activity.teams[0].player will have type 'Any' in that case.
For that reason, it is better to pass EmptyPlayer and EmptyTeam when
defining a ba.Activity that does not need custom types of its own.
Note that EmptyPlayer defines its team type as EmptyTeam and vice versa,
so if you want to define your own class for one of them you must do so
for both.
"""
# NOTE: It seems we might not need these playercast() calls; have gone
# the direction where things returning players generally take a type arg
# and do this themselves; that way the user is 'forced' to deal with types

View File

@ -274,7 +274,7 @@ class Session:
' in on_player_leave.')
# Grab their activity-specific player instance.
player = sessionplayer.gameplayer
player = sessionplayer.activityplayer
assert isinstance(player, (Player, type(None)))
# Remove them from any current Activity.

View File

@ -206,9 +206,9 @@ class PlayerRecord:
# a current position for them.
our_pos: Optional[Sequence[float]] = None
if self._player is not None:
if self._player.gameplayer is not None:
if self._player.gameplayer.node:
our_pos = self._player.gameplayer.node.position
if self._player.activityplayer is not None:
if self._player.activityplayer.node:
our_pos = self._player.activityplayer.node.position
if our_pos is None:
return

View File

@ -211,3 +211,20 @@ class Team(Generic[PlayerType]):
return sessionteam
from ba import _error
raise _error.SessionTeamNotFoundError()
class EmptyTeam(Team['ba.EmptyPlayer']):
"""An empty player for use by Activities that don't need to define one.
Category: Gameplay Classes
ba.Player and ba.Team are 'Generic' types, and so passing them as
type arguments when defining a ba.Activity reduces type safety.
For example, activity.teams[0].player will have type 'Any' in that case.
For that reason, it is better to pass EmptyPlayer and EmptyTeam when
defining a ba.Activity that does not need custom types of its own.
Note that EmptyPlayer defines its team type as EmptyTeam and vice versa,
so if you want to define your own class for one of them you must do so
for both.
"""

View File

@ -58,7 +58,7 @@ class TeamGameActivity(GameActivity[PlayerType, TeamType]):
return (issubclass(sessiontype, DualTeamSession)
or issubclass(sessiontype, FreeForAllSession))
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
# By default we don't show kill-points in free-for-all sessions.

View File

@ -38,7 +38,7 @@ class CoopJoinActivity(JoinActivity):
# We can assume our session is a CoopSession.
session: ba.CoopSession
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
session = self.session
assert isinstance(session, ba.CoopSession)

View File

@ -41,7 +41,7 @@ if TYPE_CHECKING:
class CoopScoreScreen(ba.Activity[ba.Player, ba.Team]):
"""Score screen showing the results of a cooperative game."""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
# pylint: disable=too-many-statements
super().__init__(settings)

View File

@ -35,7 +35,7 @@ if TYPE_CHECKING:
class TeamVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
"""Scorescreen between rounds of a dual-team session."""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings=settings)
self._winner: ba.SessionTeam = settings['winner']
assert isinstance(self._winner, ba.SessionTeam)

View File

@ -34,7 +34,7 @@ if TYPE_CHECKING:
class FreeForAllVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
"""Score screen shown at after free-for-all rounds."""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings=settings)
# Keep prev activity alive while we fade in.

View File

@ -35,7 +35,7 @@ if TYPE_CHECKING:
class MultiTeamJoinActivity(JoinActivity):
"""Join screen for teams sessions."""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._next_up_text: Optional[Text] = None

View File

@ -35,7 +35,7 @@ if TYPE_CHECKING:
class MultiTeamScoreScreenActivity(ScoreScreenActivity):
"""Base class for score screens."""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings=settings)
self._score_display_sound = ba.getsound('scoreHit01')
self._score_display_sound_small = ba.getsound('scoreHit02')

View File

@ -34,7 +34,7 @@ if TYPE_CHECKING:
class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
"""Final score screen for a team series."""
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings=settings)
self._min_view_time = 15.0
self._is_ffa = isinstance(self.session, ba.FreeForAllSession)

View File

@ -86,7 +86,7 @@ class AssaultGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('team_flag')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._scoreboard = Scoreboard()
self._last_score_time = 0.0

View File

@ -153,7 +153,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('team_flag')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._scoreboard = Scoreboard()
self._alarmsound = ba.getsound('alarm')

View File

@ -95,7 +95,7 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('keep_away')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._scoreboard = Scoreboard()
self._chosen_one_player: Optional[Player] = None

View File

@ -120,7 +120,7 @@ class ConquestGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('conquest')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
shared = SharedObjects.get()
self._scoreboard = Scoreboard()

View File

@ -101,7 +101,7 @@ class DeathMatchGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('melee')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._scoreboard = Scoreboard()
self._score_to_win: Optional[int] = None

View File

@ -77,7 +77,7 @@ class EasterEggHuntGame(ba.TeamGameActivity[Player, Team]):
or issubclass(sessiontype, ba.DualTeamSession)
or issubclass(sessiontype, ba.FreeForAllSession))
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
shared = SharedObjects.get()
self._last_player_death_time = None

View File

@ -237,7 +237,7 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('melee')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._scoreboard = Scoreboard()
self._start_time: Optional[float] = None

View File

@ -123,7 +123,7 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('football')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._scoreboard: Optional[Scoreboard] = Scoreboard()
@ -329,9 +329,7 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
"""
Co-op variant of football
"""
"""Co-op variant of football."""
name = 'Football'
tips = ['Use the pick-up button to grab the flag < ${PICKUP} >']
@ -356,7 +354,7 @@ class FootballCoopGame(ba.CoopGameActivity[Player, Team]):
return 'score ${ARG1} touchdowns', touchdowns
return 'score a touchdown'
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
settings['map'] = 'Football Stadium'
super().__init__(settings)
self._preset = settings.get('preset', 'rookie')

View File

@ -153,7 +153,7 @@ class HockeyGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('hockey')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
shared = SharedObjects.get()
self._scoreboard = Scoreboard()

View File

@ -94,7 +94,7 @@ class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('keep_away')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._scoreboard = Scoreboard()
self._swipsound = ba.getsound('swip')

View File

@ -96,7 +96,7 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('king_of_the_hill')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
shared = SharedObjects.get()
self._scoreboard = Scoreboard()

View File

@ -74,7 +74,7 @@ class MeteorShowerGame(ba.TeamGameActivity[Player, Team]):
or issubclass(sessiontype, ba.FreeForAllSession)
or issubclass(sessiontype, ba.CoopSession))
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._epic_mode = settings.get('Epic Mode', False)

View File

@ -71,7 +71,7 @@ class NinjaFightGame(ba.TeamGameActivity[Player, Team]):
# In the constructor we should load any media we need/etc.
# ...but not actually create anything yet.
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._winsound = ba.getsound('score')
self._won = False

View File

@ -155,7 +155,7 @@ class OnslaughtGame(ba.CoopGameActivity[Player, Team]):
# Show messages when players die since it matters here.
announce_player_deaths = True
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
self._preset = Preset(settings.get('preset', 'training'))
if self._preset in {

View File

@ -144,7 +144,7 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
return ba.getmaps('race')
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
self._race_started = False
super().__init__(settings)
self._scoreboard = Scoreboard()

View File

@ -86,7 +86,7 @@ class RunaroundGame(ba.CoopGameActivity[Player, Team]):
StickyBot: 0.5
}
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
settings['map'] = 'Tower D'
super().__init__(settings)
shared = SharedObjects.get()

View File

@ -83,7 +83,7 @@ class TargetPracticeGame(ba.TeamGameActivity[Player, Team]):
return (issubclass(sessiontype, ba.CoopSession)
or issubclass(sessiontype, ba.MultiTeamSession))
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
super().__init__(settings)
self._scoreboard = Scoreboard()
self._targets: List[Target] = []

View File

@ -77,7 +77,7 @@ class TheLastStandGame(ba.CoopGameActivity[Player, Team]):
default_music = ba.MusicType.EPIC
def __init__(self, settings: Dict[str, Any]):
def __init__(self, settings: dict):
settings['map'] = 'Rampage'
super().__init__(settings)
self._new_wave_sound = ba.getsound('scoreHit01')

View File

@ -197,7 +197,7 @@ class Team(ba.Team[Player]):
class TutorialActivity(ba.Activity[Player, Team]):
def __init__(self, settings: Dict[str, Any] = None):
def __init__(self, settings: dict = None):
from bastd.maps import Rampage
if settings is None:
settings = {}

View File

@ -39,7 +39,7 @@ class GamepadSettingsWindow(ba.Window):
is_main_menu: bool = True,
transition: str = 'in_right',
transition_out: str = 'out_right',
settings: Dict[str, Any] = None):
settings: dict = None):
self._input = gamepad
# If this fails, our input device went away or something;

View File

@ -262,7 +262,7 @@ class ConfigKeyboardWindow(ba.Window):
class AwaitKeyboardInputWindow(ba.Window):
"""Window for capturing a keypress."""
def __init__(self, button: str, ui: ba.Widget, settings: Dict[str, Any]):
def __init__(self, button: str, ui: ba.Widget, settings: dict):
self._capture_button = button
self._capture_key_ui = ui

View File

@ -26,6 +26,9 @@
<li><a href="#class_ba_Material">ba.Material</a></li>
<li><a href="#class_ba_Node">ba.Node</a></li>
<li><a href="#class_ba_Player">ba.Player</a></li>
<ul>
<li><a href="#class_ba_EmptyPlayer">ba.EmptyPlayer</a></li>
</ul>
<li><a href="#class_ba_PlayerInfo">ba.PlayerInfo</a></li>
<li><a href="#class_ba_PlayerRecord">ba.PlayerRecord</a></li>
<li><a href="#class_ba_ScoreInfo">ba.ScoreInfo</a></li>
@ -43,6 +46,9 @@
<li><a href="#class_ba_StandLocation">ba.StandLocation</a></li>
<li><a href="#class_ba_Stats">ba.Stats</a></li>
<li><a href="#class_ba_Team">ba.Team</a></li>
<ul>
<li><a href="#class_ba_EmptyTeam">ba.EmptyTeam</a></li>
</ul>
<li><a href="#class_ba_TeamGameResults">ba.TeamGameResults</a></li>
</ul>
<h4><a name="function_category_Gameplay_Functions">Gameplay Functions</a></h4>
@ -424,7 +430,7 @@ regardless of the player count).</p>
<h5><a href="#method_ba_Activity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Activity__add_actor_weak_ref">add_actor_weak_ref()</a>, <a href="#method_ba_Activity__create_player">create_player()</a>, <a href="#method_ba_Activity__create_team">create_team()</a>, <a href="#method_ba_Activity__end">end()</a>, <a href="#method_ba_Activity__handlemessage">handlemessage()</a>, <a href="#method_ba_Activity__has_begun">has_begun()</a>, <a href="#method_ba_Activity__has_ended">has_ended()</a>, <a href="#method_ba_Activity__has_transitioned_in">has_transitioned_in()</a>, <a href="#method_ba_Activity__is_transitioning_out">is_transitioning_out()</a>, <a href="#method_ba_Activity__on_begin">on_begin()</a>, <a href="#method_ba_Activity__on_expire">on_expire()</a>, <a href="#method_ba_Activity__on_player_join">on_player_join()</a>, <a href="#method_ba_Activity__on_player_leave">on_player_leave()</a>, <a href="#method_ba_Activity__on_team_join">on_team_join()</a>, <a href="#method_ba_Activity__on_team_leave">on_team_leave()</a>, <a href="#method_ba_Activity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_Activity__on_transition_out">on_transition_out()</a>, <a href="#method_ba_Activity__retain_actor">retain_actor()</a>, <a href="#method_ba_Activity__transition_out">transition_out()</a></h5>
<dl>
<dt><h4><a name="method_ba_Activity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Activity(settings: Dict[str, Any])</span></p>
<p><span>ba.Activity(settings: dict)</span></p>
<p>Creates an Activity in the current <a href="#class_ba_Session">ba.Session</a>.</p>
@ -1616,7 +1622,7 @@ start_long_action(callback_when_done=<a href="#class_ba_ContextCall">ba.ContextC
<h5><a href="#method_ba_CoopGameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_CoopGameActivity__celebrate">celebrate()</a>, <a href="#method_ba_CoopGameActivity__fade_to_red">fade_to_red()</a>, <a href="#method_ba_CoopGameActivity__get_score_type">get_score_type()</a>, <a href="#method_ba_CoopGameActivity__on_begin">on_begin()</a>, <a href="#method_ba_CoopGameActivity__setup_low_life_warning_sound">setup_low_life_warning_sound()</a>, <a href="#method_ba_CoopGameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_CoopGameActivity__supports_session_type">supports_session_type()</a></h5>
<dl>
<dt><h4><a name="method_ba_CoopGameActivity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.CoopGameActivity(settings: Dict[str, Any])</span></p>
<p><span>ba.CoopGameActivity(settings: dict)</span></p>
<p>Instantiate the Activity.</p>
@ -2063,6 +2069,111 @@ its time with lingering corpses, sound effects, etc.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_EmptyPlayer">ba.EmptyPlayer</a></strong></h3>
<p>Inherits from: <a href="#class_ba_Player">ba.Player</a>, <a href="#class_typing_Generic">typing.Generic</a></p>
<p>An empty player for use by Activities that don't need to define one.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> <a href="#class_ba_Player">ba.Player</a> and <a href="#class_ba_Team">ba.Team</a> are 'Generic' types, and so passing them as
type arguments when defining a <a href="#class_ba_Activity">ba.Activity</a> reduces type safety.
For example, activity.teams[0].player will have type 'Any' in that case.
For that reason, it is better to pass EmptyPlayer and EmptyTeam when
defining a <a href="#class_ba_Activity">ba.Activity</a> that does not need custom types of its own.</p>
<p> Note that EmptyPlayer defines its team type as EmptyTeam and vice versa,
so if you want to define your own class for one of them you must do so
for both.
</p>
<h3>Attributes Inherited:</h3>
<h5><a href="#attr_ba_Player__actor">actor</a></h5>
<h3>Attributes Defined Here:</h3>
<h5><a href="#attr_ba_EmptyPlayer__customdata">customdata</a>, <a href="#attr_ba_EmptyPlayer__node">node</a>, <a href="#attr_ba_EmptyPlayer__position">position</a>, <a href="#attr_ba_EmptyPlayer__sessionplayer">sessionplayer</a>, <a href="#attr_ba_EmptyPlayer__team">team</a></h5>
<dl>
<dt><h4><a name="attr_ba_EmptyPlayer__customdata">customdata</a></h4></dt><dd>
<p><span>dict</span></p>
<p>Arbitrary values associated with the player.
Though it is encouraged that most player values be properly defined
on the <a href="#class_ba_Player">ba.Player</a> subclass, it may be useful for player-agnostic
objects to store values here. This dict is cleared when the player
leaves or expires so objects stored here will be disposed of at
the expected time, unlike the Player instance itself which may
continue to be referenced after it is no longer part of the game.</p>
</dd>
<dt><h4><a name="attr_ba_EmptyPlayer__node">node</a></h4></dt><dd>
<p><span><a href="#class_ba_Node">ba.Node</a></span></p>
<p>A <a href="#class_ba_Node">ba.Node</a> of type 'player' associated with this Player.</p>
<p> This node can be used to get a generic player position/etc.</p>
</dd>
<dt><h4><a name="attr_ba_EmptyPlayer__position">position</a></h4></dt><dd>
<p><span><a href="#class_ba_Vec3">ba.Vec3</a></span></p>
<p>The position of the player, as defined by its current <a href="#class_ba_Actor">ba.Actor</a>.</p>
<p> This value is undefined when the player has no Actor.</p>
</dd>
<dt><h4><a name="attr_ba_EmptyPlayer__sessionplayer">sessionplayer</a></h4></dt><dd>
<p><span><a href="#class_ba_SessionPlayer">ba.SessionPlayer</a></span></p>
<p>Return the <a href="#class_ba_SessionPlayer">ba.SessionPlayer</a> corresponding to this Player.</p>
<p> Throws a <a href="#class_ba_SessionPlayerNotFoundError">ba.SessionPlayerNotFoundError</a> if it does not exist.</p>
</dd>
<dt><h4><a name="attr_ba_EmptyPlayer__team">team</a></h4></dt><dd>
<p><span>TeamType</span></p>
<p>The <a href="#class_ba_Team">ba.Team</a> for this player.</p>
</dd>
</dl>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_Player">ba.Player</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_EmptyTeam">ba.EmptyTeam</a></strong></h3>
<p>Inherits from: <a href="#class_ba_Team">ba.Team</a>, <a href="#class_typing_Generic">typing.Generic</a></p>
<p>An empty player for use by Activities that don't need to define one.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p> <a href="#class_ba_Player">ba.Player</a> and <a href="#class_ba_Team">ba.Team</a> are 'Generic' types, and so passing them as
type arguments when defining a <a href="#class_ba_Activity">ba.Activity</a> reduces type safety.
For example, activity.teams[0].player will have type 'Any' in that case.
For that reason, it is better to pass EmptyPlayer and EmptyTeam when
defining a <a href="#class_ba_Activity">ba.Activity</a> that does not need custom types of its own.</p>
<p> Note that EmptyPlayer defines its team type as EmptyTeam and vice versa,
so if you want to define your own class for one of them you must do so
for both.
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_EmptyTeam__customdata">customdata</a>, <a href="#attr_ba_EmptyTeam__sessionteam">sessionteam</a></h5>
<dl>
<dt><h4><a name="attr_ba_EmptyTeam__customdata">customdata</a></h4></dt><dd>
<p><span>dict</span></p>
<p>Arbitrary values associated with the team.
Though it is encouraged that most player values be properly defined
on the <a href="#class_ba_Team">ba.Team</a> subclass, it may be useful for player-agnostic
objects to store values here. This dict is cleared when the team
leaves or expires so objects stored here will be disposed of at
the expected time, unlike the Team instance itself which may
continue to be referenced after it is no longer part of the game.</p>
</dd>
<dt><h4><a name="attr_ba_EmptyTeam__sessionteam">sessionteam</a></h4></dt><dd>
<p><span>SessionTeam</span></p>
<p>Return the <a href="#class_ba_SessionTeam">ba.SessionTeam</a> corresponding to this Team.</p>
<p> Throws a <a href="#class_ba_SessionTeamNotFoundError">ba.SessionTeamNotFoundError</a> if there is none.</p>
</dd>
</dl>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_Team">ba.Team</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_Existable">ba.Existable</a></strong></h3>
<p>Inherits from: <a href="#class_typing_extensions_Protocol">typing_extensions.Protocol</a></p>
<p>A Protocol for objects supporting an exists() method.</p>
@ -2209,7 +2320,7 @@ its time with lingering corpses, sound effects, etc.</p>
<h5><a href="#method_ba_GameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_GameActivity__continue_or_end_game">continue_or_end_game()</a>, <a href="#method_ba_GameActivity__create_settings_ui">create_settings_ui()</a>, <a href="#method_ba_GameActivity__end">end()</a>, <a href="#method_ba_GameActivity__end_game">end_game()</a>, <a href="#method_ba_GameActivity__get_description">get_description()</a>, <a href="#method_ba_GameActivity__get_description_display_string">get_description_display_string()</a>, <a href="#method_ba_GameActivity__get_display_string">get_display_string()</a>, <a href="#method_ba_GameActivity__get_game_settings">get_game_settings()</a>, <a href="#method_ba_GameActivity__get_instance_description">get_instance_description()</a>, <a href="#method_ba_GameActivity__get_instance_description_short">get_instance_description_short()</a>, <a href="#method_ba_GameActivity__get_instance_display_string">get_instance_display_string()</a>, <a href="#method_ba_GameActivity__get_instance_scoreboard_display_string">get_instance_scoreboard_display_string()</a>, <a href="#method_ba_GameActivity__get_score_info">get_score_info()</a>, <a href="#method_ba_GameActivity__get_settings_display_string">get_settings_display_string()</a>, <a href="#method_ba_GameActivity__get_supported_maps">get_supported_maps()</a>, <a href="#method_ba_GameActivity__get_team_display_string">get_team_display_string()</a>, <a href="#method_ba_GameActivity__getname">getname()</a>, <a href="#method_ba_GameActivity__handlemessage">handlemessage()</a>, <a href="#method_ba_GameActivity__is_waiting_for_continue">is_waiting_for_continue()</a>, <a href="#method_ba_GameActivity__on_begin">on_begin()</a>, <a href="#method_ba_GameActivity__on_continue">on_continue()</a>, <a href="#method_ba_GameActivity__on_player_join">on_player_join()</a>, <a href="#method_ba_GameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_GameActivity__respawn_player">respawn_player()</a>, <a href="#method_ba_GameActivity__setup_standard_powerup_drops">setup_standard_powerup_drops()</a>, <a href="#method_ba_GameActivity__setup_standard_time_limit">setup_standard_time_limit()</a>, <a href="#method_ba_GameActivity__show_zoom_message">show_zoom_message()</a>, <a href="#method_ba_GameActivity__spawn_player">spawn_player()</a>, <a href="#method_ba_GameActivity__spawn_player_if_exists">spawn_player_if_exists()</a>, <a href="#method_ba_GameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_GameActivity__supports_session_type">supports_session_type()</a></h5>
<dl>
<dt><h4><a name="method_ba_GameActivity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.GameActivity(settings: Dict[str, Any])</span></p>
<p><span>ba.GameActivity(settings: dict)</span></p>
<p>Instantiate the Activity.</p>
@ -2785,7 +2896,7 @@ prefs, etc.</p>
<h5><a href="#method_ba_Level____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Level__get_campaign">get_campaign()</a>, <a href="#method_ba_Level__get_high_scores">get_high_scores()</a>, <a href="#method_ba_Level__get_preview_texture">get_preview_texture()</a>, <a href="#method_ba_Level__get_score_version_string">get_score_version_string()</a>, <a href="#method_ba_Level__get_settings">get_settings()</a>, <a href="#method_ba_Level__set_complete">set_complete()</a>, <a href="#method_ba_Level__set_high_scores">set_high_scores()</a>, <a href="#method_ba_Level__set_rating">set_rating()</a></h5>
<dl>
<dt><h4><a name="method_ba_Level____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Level(name: str, gametype: Type[<a href="#class_ba_GameActivity">ba.GameActivity</a>], settings: Dict[str, Any], preview_texture_name: str, displayname: str = None)</span></p>
<p><span>ba.Level(name: str, gametype: Type[<a href="#class_ba_GameActivity">ba.GameActivity</a>], settings: dict, preview_texture_name: str, displayname: str = None)</span></p>
<p>Initializes a Level object with the provided values.</p>
@ -4557,8 +4668,13 @@ that a SessionPlayer is still present if retaining references to one
for any length of time.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_SessionPlayer__character">character</a>, <a href="#attr_ba_SessionPlayer__color">color</a>, <a href="#attr_ba_SessionPlayer__gameplayer">gameplayer</a>, <a href="#attr_ba_SessionPlayer__highlight">highlight</a>, <a href="#attr_ba_SessionPlayer__id">id</a>, <a href="#attr_ba_SessionPlayer__in_game">in_game</a>, <a href="#attr_ba_SessionPlayer__inputdevice">inputdevice</a>, <a href="#attr_ba_SessionPlayer__sessionteam">sessionteam</a></h5>
<h5><a href="#attr_ba_SessionPlayer__activityplayer">activityplayer</a>, <a href="#attr_ba_SessionPlayer__character">character</a>, <a href="#attr_ba_SessionPlayer__color">color</a>, <a href="#attr_ba_SessionPlayer__highlight">highlight</a>, <a href="#attr_ba_SessionPlayer__id">id</a>, <a href="#attr_ba_SessionPlayer__in_game">in_game</a>, <a href="#attr_ba_SessionPlayer__inputdevice">inputdevice</a>, <a href="#attr_ba_SessionPlayer__sessionteam">sessionteam</a></h5>
<dl>
<dt><h4><a name="attr_ba_SessionPlayer__activityplayer">activityplayer</a></h4></dt><dd>
<p><span> Optional[<a href="#class_ba_Player">ba.Player</a>]</span></p>
<p>The current game-specific instance for this player.</p>
</dd>
<dt><h4><a name="attr_ba_SessionPlayer__character">character</a></h4></dt><dd>
<p><span> str</span></p>
<p>The character this player has selected in their profile.</p>
@ -4569,11 +4685,6 @@ for any length of time.</p>
<p>The base color for this Player.
In team games this will match the <a href="#class_ba_SessionTeam">ba.SessionTeam</a>'s color.</p>
</dd>
<dt><h4><a name="attr_ba_SessionPlayer__gameplayer">gameplayer</a></h4></dt><dd>
<p><span> Optional[<a href="#class_ba_Player">ba.Player</a>]</span></p>
<p>The current game-specific instance for this player.</p>
</dd>
<dt><h4><a name="attr_ba_SessionPlayer__highlight">highlight</a></h4></dt><dd>
<p><span> Sequence[float]</span></p>
@ -5124,7 +5235,7 @@ of the session.</p>
<h5><a href="#method_ba_TeamGameActivity____init__">&lt;constructor&gt;</a>, <a href="#method_ba_TeamGameActivity__end">end()</a>, <a href="#method_ba_TeamGameActivity__on_begin">on_begin()</a>, <a href="#method_ba_TeamGameActivity__on_transition_in">on_transition_in()</a>, <a href="#method_ba_TeamGameActivity__spawn_player_spaz">spawn_player_spaz()</a>, <a href="#method_ba_TeamGameActivity__supports_session_type">supports_session_type()</a></h5>
<dl>
<dt><h4><a name="method_ba_TeamGameActivity____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.TeamGameActivity(settings: Dict[str, Any])</span></p>
<p><span>ba.TeamGameActivity(settings: dict)</span></p>
<p>Instantiate the Activity.</p>