Added proper type for assigning input

This commit is contained in:
Eric Froemling 2020-06-02 22:35:34 -07:00
parent ed102842c5
commit 9c81450c92
40 changed files with 335 additions and 275 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/1f/1d/c3e431b8c9116fb76eb10c7c3351",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/66/b8/9cb66184745ef1d783af3f7d3f22",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/52/e8/4826278e2030d629a682a8de070f",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a5/8a/9e07236256d006f0357d5d1aa887",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/81/38/985294f68973344e2f012fe93c45",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d3/57/2cdf16147cdd25263ba76aa40198",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a7/ec/1d64c0c31d58ef530b6894fabf2a",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/4c/ea/c136ba4360d210842915c2f6c55e",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/35/06/d5ae11c90f89d1c10ca62a2b2f66",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/a1/e9/960e434759c45b623fba34725e64",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/dd/d0/f85582938a539d2d677d3e36b61b",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8d/e9/3685ecf7b07f3e3568867da5536f"
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6d/a5/bc48ad0c1b5757913b8d354e4302",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/94/e0/cd115dbd1ce795e9b6a2878e8912",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/44/78/d3166e9e3f2f443c13838768b4ee",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/79/af/4d26abbac53e9fc396d1fc5660ae",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e0/85/8d8d8d74685d0823bc341942c31c",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/34/81/06f6dff6c5686d1b2ffb1b44bb46",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/34/96/f1d361405a41d118016a576ef517",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/0c/7e/116fdd2bb269fd3c4c3826f526b9",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/75/a6/320d0a4b79a1e0c0cb8fecbc69e2",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/8a/de/f35f0be58d20cc58cf1ba078013a",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/2b/23/849c8e6286a8de4f6140f249c59a",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ba/fd/49fe8a41b0448e2fd81a462618cb"
}

View File

@ -934,6 +934,7 @@
<w>instancer</w>
<w>interstitials</w>
<w>intex</w>
<w>intp</w>
<w>introspectable</w>
<w>ipaddress</w>
<w>ipos</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=48988468250135652281791058794704714718
# SOURCES_HASH=289441941088504861465847265420796017643
# I'm sorry Pylint. I know this file saddens you. Be strong.
# pylint: disable=useless-suppression
@ -855,18 +855,12 @@ class SessionPlayer:
character: str
activityplayer: Optional[ba.Player]
def assigninput(self, type: Union[str, Tuple[str, ...]],
def assigninput(self, type: Union[ba.InputType, Tuple[ba.InputType, ...]],
call: Callable) -> None:
"""assigninput(type: Union[str, Tuple[str, ...]],
"""assigninput(type: Union[ba.InputType, Tuple[ba.InputType, ...]],
call: Callable) -> None
Set the python callable to be run for one or more types of input.
Valid type values are: 'jumpPress', 'jumpRelease', 'punchPress',
'punchRelease','bombPress', 'bombRelease', 'pickUpPress',
'pickUpRelease', 'upDown','leftRight','upPress', 'upRelease',
'downPress', 'downRelease', 'leftPress','leftRelease','rightPress',
'rightRelease', 'run', 'flyPress', 'flyRelease', 'startPress',
'startRelease'
"""
return None
@ -2922,22 +2916,6 @@ def music_player_stop() -> None:
return None
def new_activity(activity_type: Type[ba.Activity],
settings: dict = None) -> ba.Activity:
"""new_activity(activity_type: Type[ba.Activity],
settings: dict = None) -> ba.Activity
Instantiates a ba.Activity given a type object.
Category: General Utility Functions
Activities require special setup and thus cannot be directly
instantiated; You must go through this function.
"""
import ba # pylint: disable=cyclic-import
return ba.Activity(settings={})
def new_host_session(sessiontype: Type[ba.Session],
benchmark_type: str = None) -> None:
"""new_host_session(sessiontype: Type[ba.Session],
@ -2956,6 +2934,22 @@ def new_replay_session(file_name: str) -> None:
return None
def newactivity(activity_type: Type[ba.Activity],
settings: dict = None) -> ba.Activity:
"""newactivity(activity_type: Type[ba.Activity],
settings: dict = None) -> ba.Activity
Instantiates a ba.Activity given a type object.
Category: General Utility Functions
Activities require special setup and thus cannot be directly
instantiated; You must go through this function.
"""
import ba # pylint: disable=cyclic-import
return ba.Activity(settings={})
def newnode(type: str,
owner: ba.Node = None,
attrs: dict = None,

View File

@ -32,7 +32,7 @@ from _ba import (CollideModel, Context, ContextCall, Data, InputDevice,
Vec3, Widget, buttonwidget, camerashake, checkboxwidget,
columnwidget, containerwidget, do_once, emitfx, getactivity,
getcollidemodel, getmodel, getnodes, getsession, getsound,
gettexture, hscrollwidget, imagewidget, log, new_activity,
gettexture, hscrollwidget, imagewidget, log, newactivity,
newnode, playsound, printnodes, printobjects, pushcall, quit,
rowwidget, safecolor, screenmessage, scrollwidget,
set_analytics_screen, charstr, textwidget, time, timer,
@ -46,7 +46,7 @@ from ba._coopgame import CoopGameActivity
from ba._coopsession import CoopSession
from ba._dependency import (Dependency, DependencyComponent, DependencySet,
AssetPackage)
from ba._enums import TimeType, Permission, TimeFormat, SpecialChar
from ba._enums import TimeType, Permission, TimeFormat, SpecialChar, InputType
from ba._error import (
print_exception, print_error, ContextError, NotFoundError,
PlayerNotFoundError, SessionPlayerNotFoundError, NodeNotFoundError,
@ -55,7 +55,7 @@ from ba._error import (
SessionNotFoundError, DelegateNotFoundError, DependencyError)
from ba._freeforallsession import FreeForAllSession
from ba._gameactivity import GameActivity
from ba._gameresults import TeamGameResults
from ba._gameresults import GameResults
from ba._gamesettings import (Setting, IntSetting, FloatSetting, ChoiceSetting,
BoolSetting, IntChoiceSetting,
FloatChoiceSetting)

View File

@ -26,6 +26,7 @@ from typing import TYPE_CHECKING
import _ba
from ba._activity import Activity
from ba._music import setmusic, MusicType
from ba._enums import InputType
# 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
@ -229,6 +230,6 @@ class ScoreScreenActivity(Activity[EmptyPlayer, EmptyTeam]):
# Just to be extra careful, don't assign if we're transitioning out.
# (though theoretically that would be ok).
if not self.is_transitioning_out() and player:
player.assigninput(
('jumpPress', 'punchPress', 'bombPress', 'pickUpPress'),
self._player_press)
player.assigninput((InputType.JUMP_PRESS, InputType.PUNCH_PRESS,
InputType.BOMB_PRESS, InputType.PICK_UP_PRESS),
self._player_press)

View File

@ -53,7 +53,7 @@ def run_cpu_benchmark() -> None:
cfg['Graphics Quality'] = 'Low'
cfg.apply()
self.benchmark_type = 'cpu'
self.setactivity(_ba.new_activity(tutorial.TutorialActivity))
self.setactivity(_ba.newactivity(tutorial.TutorialActivity))
def __del__(self) -> None:

View File

@ -98,7 +98,7 @@ class CoopSession(Session):
self._custom_menu_ui: List[Dict[str, Any]] = []
# Start our joining screen.
self.setactivity(_ba.new_activity(CoopJoinActivity))
self.setactivity(_ba.newactivity(CoopJoinActivity))
self._next_game_instance: Optional[ba.GameActivity] = None
self._next_game_level_name: Optional[str] = None
@ -126,7 +126,7 @@ class CoopSession(Session):
if setting.name not in settings:
settings[setting.name] = setting.default
newactivity = _ba.new_activity(gametype, settings)
newactivity = _ba.newactivity(gametype, settings)
assert isinstance(newactivity, GameActivity)
self._current_game_instance: GameActivity = newactivity
@ -150,7 +150,7 @@ class CoopSession(Session):
settings[setting.name] = setting.default
# We wanna be in the activity's context while taking it down.
newactivity = _ba.new_activity(gametype, settings)
newactivity = _ba.newactivity(gametype, settings)
assert isinstance(newactivity, GameActivity)
self._next_game_instance = newactivity
self._next_game_level_name = nextlevel.name
@ -165,7 +165,7 @@ class CoopSession(Session):
and self._tutorial_activity is None
and not self._ran_tutorial_activity):
from bastd.tutorial import TutorialActivity
self._tutorial_activity = _ba.new_activity(TutorialActivity)
self._tutorial_activity = _ba.newactivity(TutorialActivity)
def get_custom_menu_entries(self) -> List[Dict[str, Any]]:
return self._custom_menu_ui
@ -250,7 +250,7 @@ class CoopSession(Session):
from ba._lang import Lstr
from ba._general import WeakCall
from ba._coopgame import CoopGameActivity
from ba._gameresults import TeamGameResults
from ba._gameresults import GameResults
from ba._score import ScoreType
from ba._player import PlayerInfo
from bastd.tutorial import TutorialActivity
@ -258,10 +258,10 @@ class CoopSession(Session):
app = _ba.app
# If we're running a TeamGameActivity we'll have a TeamGameResults
# If we're running a TeamGameActivity we'll have a GameResults
# as results. Otherwise its an old CoopGameActivity so its giving
# us a dict of random stuff.
if isinstance(results, TeamGameResults):
if isinstance(results, GameResults):
outcome = 'defeat' # This can't be 'beaten'.
else:
try:
@ -338,13 +338,13 @@ class CoopSession(Session):
# If we were in a tutorial, just pop a transition to get to the
# actual round.
elif isinstance(activity, TutorialActivity):
self.setactivity(_ba.new_activity(TransitionActivity))
self.setactivity(_ba.newactivity(TransitionActivity))
else:
playerinfos: List[ba.PlayerInfo]
# Generic team games.
if isinstance(results, TeamGameResults):
if isinstance(results, GameResults):
playerinfos = results.playerinfos
score = results.get_team_score(results.sessionteams[0])
fail_message = None
@ -390,10 +390,10 @@ class CoopSession(Session):
if outcome == 'restart':
# This will pop up back in the same round.
self.setactivity(_ba.new_activity(TransitionActivity))
self.setactivity(_ba.newactivity(TransitionActivity))
else:
self.setactivity(
_ba.new_activity(
_ba.newactivity(
CoopScoreScreen, {
'playerinfos': playerinfos,
'score': score,

View File

@ -35,8 +35,11 @@ class DualTeamSession(MultiTeamSession):
Category: Gameplay Classes
"""
# Base class overrides:
use_teams = True
use_team_colors = True
_playlist_selection_var = 'Team Tournament Playlist Selection'
_playlist_randomize_var = 'Team Tournament Playlist Randomize'
_playlists_var = 'Team Tournament Playlists'
@ -45,28 +48,28 @@ class DualTeamSession(MultiTeamSession):
_ba.increment_analytics_count('Teams session start')
super().__init__()
def _switch_to_score_screen(self, results: ba.TeamGameResults) -> None:
def _switch_to_score_screen(self, results: ba.GameResults) -> None:
# pylint: disable=cyclic-import
from bastd.activity.drawscore import DrawScoreScreenActivity
from bastd.activity.dualteamscore import (
TeamVictoryScoreScreenActivity)
from bastd.activity.multiteamvictory import (
TeamSeriesVictoryScoreScreenActivity)
winners = results.winnergroups
winnergroups = results.winnergroups
# If everyone has the same score, call it a draw.
if len(winners) < 2:
self.setactivity(_ba.new_activity(DrawScoreScreenActivity))
if len(winnergroups) < 2:
self.setactivity(_ba.newactivity(DrawScoreScreenActivity))
else:
winner = winners[0].teams[0]
winner = winnergroups[0].teams[0]
winner.customdata['score'] += 1
# If a team has won, show final victory screen.
if winner.customdata['score'] >= (self._series_length - 1) / 2 + 1:
self.setactivity(
_ba.new_activity(TeamSeriesVictoryScoreScreenActivity,
{'winner': winner}))
_ba.newactivity(TeamSeriesVictoryScoreScreenActivity,
{'winner': winner}))
else:
self.setactivity(
_ba.new_activity(TeamVictoryScoreScreenActivity,
{'winner': winner}))
_ba.newactivity(TeamVictoryScoreScreenActivity,
{'winner': winner}))

View File

@ -23,6 +23,39 @@
from enum import Enum
class InputType(Enum):
"""Types of input a controller can send to the game.
Category: Enums
"""
UP_DOWN = 0
LEFT_RIGHT = 1
JUMP_PRESS = 2
JUMP_RELEASE = 3
PUNCH_PRESS = 4
PUNCH_RELEASE = 5
BOMB_PRESS = 6
BOMB_RELEASE = 7
PICK_UP_PRESS = 8
PICK_UP_RELEASE = 9
RUN = 10
FLY_PRESS = 11
FLY_RELEASE = 12
START_PRESS = 13
START_RELEASE = 14
HOLD_POSITION_PRESS = 15
HOLD_POSITION_RELEASE = 16
LEFT_PRESS = 17
LEFT_RELEASE = 18
RIGHT_PRESS = 19
RIGHT_RELEASE = 20
UP_PRESS = 21
UP_RELEASE = 22
DOWN_PRESS = 23
DOWN_RELEASE = 24
class TimeType(Enum):
"""Specifies the type of time for various operations to target/use.

View File

@ -69,7 +69,7 @@ class FreeForAllSession(MultiTeamSession):
_ba.increment_analytics_count('Free-for-all session start')
super().__init__()
def _switch_to_score_screen(self, results: ba.TeamGameResults) -> None:
def _switch_to_score_screen(self, results: ba.GameResults) -> None:
# pylint: disable=cyclic-import
from bastd.activity.drawscore import DrawScoreScreenActivity
from bastd.activity.multiteamvictory import (
@ -82,8 +82,7 @@ class FreeForAllSession(MultiTeamSession):
# call it a draw.
if len(self.players) > 1 and len(winners) < 2:
self.setactivity(
_ba.new_activity(DrawScoreScreenActivity,
{'results': results}))
_ba.newactivity(DrawScoreScreenActivity, {'results': results}))
else:
# Award different point amounts based on number of players.
point_awards = self.get_ffa_point_awards()
@ -106,9 +105,9 @@ class FreeForAllSession(MultiTeamSession):
and series_winners[0].customdata['score'] !=
series_winners[1].customdata['score'])):
self.setactivity(
_ba.new_activity(TeamSeriesVictoryScoreScreenActivity,
{'winner': series_winners[0]}))
_ba.newactivity(TeamSeriesVictoryScoreScreenActivity,
{'winner': series_winners[0]}))
else:
self.setactivity(
_ba.new_activity(FreeForAllVictoryScoreScreenActivity,
{'results': results}))
_ba.newactivity(FreeForAllVictoryScoreScreenActivity,
{'results': results}))

View File

@ -820,11 +820,11 @@ class GameActivity(Activity[PlayerType, TeamType]):
results: Any = None,
delay: float = 0.0,
force: bool = False) -> None:
from ba._gameresults import TeamGameResults
from ba._gameresults import GameResults
# If results is a standard team-game-results, associate it with us
# so it can grab our score prefs.
if isinstance(results, TeamGameResults):
if isinstance(results, GameResults):
results.set_game(self)
# If we had a standard time-limit that had not expired, stop it so

View File

@ -39,9 +39,9 @@ class WinnerGroup:
teams: Sequence[ba.SessionTeam]
class TeamGameResults:
class GameResults:
"""
Results for a completed ba.TeamGameActivity.
Results for a completed game.
Category: Gameplay Classes
@ -65,7 +65,7 @@ class TeamGameResults:
def set_game(self, game: ba.GameActivity) -> None:
"""Set the game instance these results are applying to."""
if self._game_set:
raise RuntimeError('Game set twice for TeamGameResults.')
raise RuntimeError('Game set twice for GameResults.')
self._game_set = True
self._sessionteams = [weakref.ref(team) for team in game.teams]
scoreconfig = game.getscoreconfig()

View File

@ -30,7 +30,7 @@ import _ba
from ba._error import print_exception, print_error, NotFoundError
from ba._gameutils import animate, animate_array
from ba._lang import Lstr
from ba._enums import SpecialChar
from ba._enums import SpecialChar, InputType
from ba._profile import get_player_profile_colors
if TYPE_CHECKING:
@ -515,32 +515,36 @@ class Chooser:
if not ready:
self._sessionplayer.assigninput(
'leftPress', Call(self.handlemessage,
ChangeMessage('team', -1)))
InputType.LEFT_PRESS,
Call(self.handlemessage, ChangeMessage('team', -1)))
self._sessionplayer.assigninput(
'rightPress', Call(self.handlemessage,
ChangeMessage('team', 1)))
InputType.RIGHT_PRESS,
Call(self.handlemessage, ChangeMessage('team', 1)))
self._sessionplayer.assigninput(
'bombPress',
InputType.BOMB_PRESS,
Call(self.handlemessage, ChangeMessage('character', 1)))
self._sessionplayer.assigninput(
'upPress',
InputType.UP_PRESS,
Call(self.handlemessage, ChangeMessage('profileindex', -1)))
self._sessionplayer.assigninput(
'downPress',
InputType.DOWN_PRESS,
Call(self.handlemessage, ChangeMessage('profileindex', 1)))
self._sessionplayer.assigninput(
('jumpPress', 'pickUpPress', 'punchPress'),
(InputType.JUMP_PRESS, InputType.PICK_UP_PRESS,
InputType.PUNCH_PRESS),
Call(self.handlemessage, ChangeMessage('ready', 1)))
self._ready = False
self._update_text()
self._sessionplayer.setname('untitled', real=False)
else:
self._sessionplayer.assigninput(
('leftPress', 'rightPress', 'upPress', 'downPress',
'jumpPress', 'bombPress', 'pickUpPress'), self._do_nothing)
(InputType.LEFT_PRESS, InputType.RIGHT_PRESS,
InputType.UP_PRESS, InputType.DOWN_PRESS,
InputType.JUMP_PRESS, InputType.BOMB_PRESS,
InputType.PICK_UP_PRESS), self._do_nothing)
self._sessionplayer.assigninput(
('jumpPress', 'bombPress', 'pickUpPress', 'punchPress'),
(InputType.JUMP_PRESS, InputType.BOMB_PRESS,
InputType.PICK_UP_PRESS, InputType.PUNCH_PRESS),
Call(self.handlemessage, ChangeMessage('ready', 0)))
# Store the last profile picked by this input for reuse.

View File

@ -85,7 +85,7 @@ class MultiTeamSession(Session):
from bastd.tutorial import TutorialActivity
# Get this loading.
self._tutorial_activity_instance = _ba.new_activity(
self._tutorial_activity_instance = _ba.newactivity(
TutorialActivity)
else:
self._tutorial_activity_instance = None
@ -133,7 +133,7 @@ class MultiTeamSession(Session):
self._instantiate_next_game()
# Start in our custom join screen.
self.setactivity(_ba.new_activity(MultiTeamJoinActivity))
self.setactivity(_ba.newactivity(MultiTeamJoinActivity))
def get_ffa_series_length(self) -> int:
"""Return free-for-all series length."""
@ -165,7 +165,7 @@ class MultiTeamSession(Session):
return _ba.app.config.get('Free-for-All Max Players', 8)
def _instantiate_next_game(self) -> None:
self._next_game_instance = _ba.new_activity(
self._next_game_instance = _ba.newactivity(
self._next_game_spec['resolved_type'],
self._next_game_spec['settings'])
@ -187,7 +187,7 @@ class MultiTeamSession(Session):
# to transition us into a round gracefully (otherwise we'd snap from
# one terrain to another instantly).
elif isinstance(activity, TutorialActivity):
self.setactivity(_ba.new_activity(TransitionActivity))
self.setactivity(_ba.newactivity(TransitionActivity))
# If we're in a between-round activity or a restart-activity, hop
# into a round.
@ -241,7 +241,7 @@ class MultiTeamSession(Session):
def announce_game_results(self,
activity: ba.GameActivity,
results: ba.TeamGameResults,
results: ba.GameResults,
delay: float,
announce_winning_team: bool = True) -> None:
"""Show basic game result at the end of a game.

View File

@ -269,18 +269,13 @@ class Player(Generic[TeamType]):
assert not self._expired
return self._sessionplayer.get_icon()
def assigninput(self, inputtype: Union[str, Tuple[str, ...]],
def assigninput(self, inputtype: Union[ba.InputType, Tuple[ba.InputType,
...]],
call: Callable) -> None:
"""assigninput(type: Union[str, Tuple[str, ...]],
"""assigninput(type: Union[ba.InputType, Tuple[ba.InputType, ...]],
call: Callable) -> None
Set the python callable to be run for one or more types of input.
Valid type values are: 'jumpPress', 'jumpRelease', 'punchPress',
'punchRelease','bombPress', 'bombRelease', 'pickUpPress',
'pickUpRelease', 'upDown','leftRight','upPress', 'upRelease',
'downPress', 'downRelease', 'leftPress','leftRelease','rightPress',
'rightRelease', 'run', 'flyPress', 'flyRelease', 'startPress',
'startRelease'
"""
assert self._postinited
assert not self._expired

View File

@ -177,7 +177,7 @@ class Session:
self._ending = False
self._activity_should_end_immediately = False
self._activity_should_end_immediately_results: (
Optional[ba.TeamGameResults]) = None
Optional[ba.GameResults]) = None
self._activity_should_end_immediately_delay = 0.0
# Create static teams if we're using them.
@ -348,7 +348,7 @@ class Session:
'_launch_end_session_activity called twice (since_last=' +
str(since_last) + ')')
self._launch_end_session_activity_time = curtime
self.setactivity(_ba.new_activity(EndSessionActivity))
self.setactivity(_ba.newactivity(EndSessionActivity))
self._wants_to_end = False
self._ending = True # Prevent further actions.

View File

@ -26,7 +26,7 @@ from typing import TYPE_CHECKING, TypeVar
from ba._freeforallsession import FreeForAllSession
from ba._gameactivity import GameActivity
from ba._gameresults import TeamGameResults
from ba._gameresults import GameResults
from ba._dualteamsession import DualTeamSession
import _ba
@ -152,7 +152,7 @@ class TeamGameActivity(GameActivity[PlayerType, TeamType]):
super().end(results, delay=2.0 + announce_delay, force=force)
# Need to do this *after* end end call so that results is valid.
assert isinstance(results, TeamGameResults)
assert isinstance(results, GameResults)
if do_announce and isinstance(session, MultiTeamSession):
session.announce_game_results(
self,

View File

@ -83,7 +83,7 @@ class FreeForAllVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
ba.timer(0.3, ba.Call(ba.playsound, self._score_display_sound))
results = self.settings_raw['results']
assert isinstance(results, ba.TeamGameResults)
assert isinstance(results, ba.GameResults)
self.show_player_scores(delay=0.001,
results=results,
scale=1.2,

View File

@ -70,7 +70,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
def show_player_scores(self,
delay: float = 2.5,
results: Optional[ba.TeamGameResults] = None,
results: Optional[ba.GameResults] = None,
scale: float = 1.0,
x_offset: float = 0.0,
y_offset: float = 0.0) -> None:
@ -87,7 +87,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
def _get_prec_score(p_rec: ba.PlayerRecord) -> Optional[int]:
if is_free_for_all and results is not None:
assert isinstance(results, ba.TeamGameResults)
assert isinstance(results, ba.GameResults)
assert p_rec.team.gameteam is not None
val = results.get_team_score(p_rec.team)
return val
@ -95,7 +95,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
def _get_prec_score_str(p_rec: ba.PlayerRecord) -> Union[str, ba.Lstr]:
if is_free_for_all and results is not None:
assert isinstance(results, ba.TeamGameResults)
assert isinstance(results, ba.GameResults)
assert p_rec.team.gameteam is not None
val = results.get_team_score_str(p_rec.team.gameteam)
assert val is not None
@ -107,7 +107,7 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
# (since they're not in results and that's where we pull their
# scores from)
if results is not None:
assert isinstance(results, ba.TeamGameResults)
assert isinstance(results, ba.GameResults)
player_records = []
assert self.stats
valid_players = list(self.stats.get_records().items())

View File

@ -143,28 +143,30 @@ class PlayerSpaz(Spaz):
else:
player.resetinput()
player.assigninput('upDown', self.on_move_up_down)
player.assigninput('leftRight', self.on_move_left_right)
player.assigninput('holdPositionPress', self.on_hold_position_press)
player.assigninput('holdPositionRelease',
player.assigninput(ba.InputType.UP_DOWN, self.on_move_up_down)
player.assigninput(ba.InputType.LEFT_RIGHT, self.on_move_left_right)
player.assigninput(ba.InputType.HOLD_POSITION_PRESS,
self.on_hold_position_press)
player.assigninput(ba.InputType.HOLD_POSITION_RELEASE,
self.on_hold_position_release)
intp = ba.InputType
if enable_jump:
player.assigninput('jumpPress', self.on_jump_press)
player.assigninput('jumpRelease', self.on_jump_release)
player.assigninput(intp.JUMP_PRESS, self.on_jump_press)
player.assigninput(intp.JUMP_RELEASE, self.on_jump_release)
if enable_pickup:
player.assigninput('pickUpPress', self.on_pickup_press)
player.assigninput('pickUpRelease', self.on_pickup_release)
player.assigninput(intp.PICK_UP_PRESS, self.on_pickup_press)
player.assigninput(intp.PICK_UP_RELEASE, self.on_pickup_release)
if enable_punch:
player.assigninput('punchPress', self.on_punch_press)
player.assigninput('punchRelease', self.on_punch_release)
player.assigninput(intp.PUNCH_PRESS, self.on_punch_press)
player.assigninput(intp.PUNCH_RELEASE, self.on_punch_release)
if enable_bomb:
player.assigninput('bombPress', self.on_bomb_press)
player.assigninput('bombRelease', self.on_bomb_release)
player.assigninput(intp.BOMB_PRESS, self.on_bomb_press)
player.assigninput(intp.BOMB_RELEASE, self.on_bomb_release)
if enable_run:
player.assigninput('run', self.on_run)
player.assigninput(intp.RUN, self.on_run)
if enable_fly:
player.assigninput('flyPress', self.on_fly_press)
player.assigninput('flyRelease', self.on_fly_release)
player.assigninput(intp.FLY_PRESS, self.on_fly_press)
player.assigninput(intp.FLY_RELEASE, self.on_fly_release)
self._connected_to_player = player

View File

@ -261,7 +261,7 @@ class AssaultGame(ba.TeamGameActivity[Player, Team]):
self.end_game()
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results=results)

View File

@ -388,7 +388,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity[Player, Team]):
self.end_game()
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results=results, announce_delay=0.8)

View File

@ -262,7 +262,7 @@ class ChosenOneGame(ba.TeamGameActivity[Player, Team]):
self._set_chosen_one_player(None)
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team,
self._chosen_one_time - team.time_remaining)

View File

@ -149,8 +149,10 @@ class ConquestGame(ba.TeamGameActivity[Player, Team]):
# We want flags to tell us they've been hit but not react physically.
self._extraflagmat.add_actions(
conditions=('they_have_material', shared.player_material),
actions=(('modify_part_collision', 'collide', True),
('call', 'at_connect', self._handle_flag_player_collide)))
actions=(
('modify_part_collision', 'collide', True),
('call', 'at_connect', self._handle_flag_player_collide),
))
def get_instance_description(self) -> Union[str, Sequence]:
return 'Secure all ${ARG1} flags.', len(self.map.flag_points)
@ -229,7 +231,7 @@ class ConquestGame(ba.TeamGameActivity[Player, Team]):
len(self._flags))
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, team.flags_held)
self.end(results=results)

View File

@ -211,7 +211,7 @@ class DeathMatchGame(ba.TeamGameActivity[Player, Team]):
self._score_to_win)
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results=results)

View File

@ -230,7 +230,7 @@ class EasterEggHuntGame(ba.TeamGameActivity[Player, Team]):
self._scoreboard.set_team_value(team, team.score)
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results)

View File

@ -575,7 +575,7 @@ class EliminationGame(ba.TeamGameActivity[Player, Team]):
def end_game(self) -> None:
if self.has_ended():
return
results = ba.TeamGameResults()
results = ba.GameResults()
self._vs_text = None # Kill our 'vs' if its there.
for team in self.teams:
results.set_team_score(team, team.survival_seconds)

View File

@ -266,7 +266,7 @@ class FootballTeamGame(ba.TeamGameActivity[Player, Team]):
self._update_scoreboard()
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results=results, announce_delay=0.8)

View File

@ -343,7 +343,7 @@ class HockeyGame(ba.TeamGameActivity[Player, Team]):
self._update_scoreboard()
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results=results)

View File

@ -190,7 +190,7 @@ class KeepAwayGame(ba.TeamGameActivity[Player, Team]):
self.end_game()
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, self._hold_time - team.timeremaining)
self.end(results=results, announce_delay=0)

View File

@ -227,7 +227,7 @@ class KingOfTheHillGame(ba.TeamGameActivity[Player, Team]):
self.end_game()
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, self._hold_time - team.time_remaining)
self.end(results=results, announce_delay=0)

View File

@ -263,7 +263,7 @@ class MeteorShowerGame(ba.TeamGameActivity[Player, Team]):
# Ok now calc game results: set a score for each team and then tell
# the game to end.
results = ba.TeamGameResults()
results = ba.GameResults()
# Remember that 'free-for-all' mode is simply a special form
# of 'teams' mode where each player gets their own team, so we can

View File

@ -172,7 +172,7 @@ class NinjaFightGame(ba.TeamGameActivity[Player, Team]):
assert self._timer is not None
self._timer.stop()
results = ba.TeamGameResults()
results = ba.GameResults()
# If we won, set our score to the elapsed time in milliseconds.
# (there should just be 1 team here since this is co-op).

View File

@ -712,7 +712,7 @@ class RaceGame(ba.TeamGameActivity[Player, Team]):
endtime=None if self._last_team_time is None else (
self._timer.getstarttime() + self._last_team_time))
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
if team.time is not None:

View File

@ -68,7 +68,7 @@ class Point(Enum):
@dataclass
class Spawn:
"""Defines a bot spawn."""
"""Defines a bot spawn event."""
type: Type[SpazBot]
path: int = 0
point: Optional[Point] = None

View File

@ -202,7 +202,7 @@ class TargetPracticeGame(ba.TeamGameActivity[Player, Team]):
self._scoreboard.set_team_value(team, team.score)
def end_game(self) -> None:
results = ba.TeamGameResults()
results = ba.GameResults()
for team in self.teams:
results.set_team_score(team, team.score)
self.end(results)

View File

@ -920,14 +920,14 @@ class MainMenuSession(ba.Session):
super().__init__([self._activity_deps])
self._locked = False
self.setactivity(ba.new_activity(MainMenuActivity))
self.setactivity(ba.newactivity(MainMenuActivity))
def on_activity_end(self, activity: ba.Activity, results: Any) -> None:
if self._locked:
_ba.unlock_all_input()
# Any ending activity leads us into the main menu one.
self.setactivity(ba.new_activity(MainMenuActivity))
self.setactivity(ba.newactivity(MainMenuActivity))
def on_player_request(self, player: ba.SessionPlayer) -> bool:
# Reject all player requests.

View File

@ -2413,7 +2413,8 @@ class TutorialActivity(ba.Activity[Player, Team]):
# We just wanna know if this player presses anything.
player.assigninput(
('jumpPress', 'punchPress', 'bombPress', 'pickUpPress'),
(ba.InputType.JUMP_PRESS, ba.InputType.PUNCH_PRESS,
ba.InputType.BOMB_PRESS, ba.InputType.PICK_UP_PRESS),
ba.Call(self._player_pressed_button, player))
def on_player_leave(self, player: Player) -> None:

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-06-02 for Ballistica version 1.5.0 build 20042</em></h4>
<h4><em>last updated on 2020-06-02 for Ballistica version 1.5.0 build 20043</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>
@ -20,6 +20,7 @@
<li><a href="#class_ba_NodeActor">ba.NodeActor</a></li>
</ul>
<li><a href="#class_ba_Chooser">ba.Chooser</a></li>
<li><a href="#class_ba_GameResults">ba.GameResults</a></li>
<li><a href="#class_ba_InputDevice">ba.InputDevice</a></li>
<li><a href="#class_ba_Level">ba.Level</a></li>
<li><a href="#class_ba_Lobby">ba.Lobby</a></li>
@ -50,7 +51,6 @@
<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>
<ul>
@ -87,7 +87,7 @@
<li><a href="#function_ba_is_browser_likely_available">ba.is_browser_likely_available()</a></li>
<li><a href="#function_ba_is_point_in_box">ba.is_point_in_box()</a></li>
<li><a href="#function_ba_log">ba.log()</a></li>
<li><a href="#function_ba_new_activity">ba.new_activity()</a></li>
<li><a href="#function_ba_newactivity">ba.newactivity()</a></li>
<li><a href="#function_ba_normalized_color">ba.normalized_color()</a></li>
<li><a href="#function_ba_open_url">ba.open_url()</a></li>
<li><a href="#function_ba_print_error">ba.print_error()</a></li>
@ -182,6 +182,7 @@
<h4><a name="class_category_Enums">Enums</a></h4>
<ul>
<li><a href="#class_ba_DeathType">ba.DeathType</a></li>
<li><a href="#class_ba_InputType">ba.InputType</a></li>
<li><a href="#class_ba_MusicPlayMode">ba.MusicPlayMode</a></li>
<li><a href="#class_ba_MusicType">ba.MusicType</a></li>
<li><a href="#class_ba_Permission">ba.Permission</a></li>
@ -2757,6 +2758,102 @@ If the time-limit expires, end_game() will be called.</p>
<p>Return whether this game supports the provided Session type.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_GameResults">ba.GameResults</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>
Results for a completed game.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p>Upon completion, a game should fill one of these out and pass it to its
<a href="#method_ba_Activity__end">ba.Activity.end</a>() call.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_GameResults__lower_is_better">lower_is_better</a>, <a href="#attr_ba_GameResults__playerinfos">playerinfos</a>, <a href="#attr_ba_GameResults__score_label">score_label</a>, <a href="#attr_ba_GameResults__scoretype">scoretype</a>, <a href="#attr_ba_GameResults__sessionteams">sessionteams</a>, <a href="#attr_ba_GameResults__winnergroups">winnergroups</a>, <a href="#attr_ba_GameResults__winning_team">winning_team</a></h5>
<dl>
<dt><h4><a name="attr_ba_GameResults__lower_is_better">lower_is_better</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether lower scores are better.</p>
</dd>
<dt><h4><a name="attr_ba_GameResults__playerinfos">playerinfos</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_PlayerInfo">ba.PlayerInfo</a>]</span></p>
<p>Get info about the players represented by the results.</p>
</dd>
<dt><h4><a name="attr_ba_GameResults__score_label">score_label</a></h4></dt><dd>
<p><span>str</span></p>
<p>The label associated with scores ('points', etc).</p>
</dd>
<dt><h4><a name="attr_ba_GameResults__scoretype">scoretype</a></h4></dt><dd>
<p><span><a href="#class_ba_ScoreType">ba.ScoreType</a></span></p>
<p>The type of score.</p>
</dd>
<dt><h4><a name="attr_ba_GameResults__sessionteams">sessionteams</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_SessionTeam">ba.SessionTeam</a>]</span></p>
<p>Return all <a href="#class_ba_SessionTeam">ba.SessionTeams</a> in the results.</p>
</dd>
<dt><h4><a name="attr_ba_GameResults__winnergroups">winnergroups</a></h4></dt><dd>
<p><span>List[WinnerGroup]</span></p>
<p>Get an ordered list of winner groups.</p>
</dd>
<dt><h4><a name="attr_ba_GameResults__winning_team">winning_team</a></h4></dt><dd>
<p><span>Optional[<a href="#class_ba_SessionTeam">ba.SessionTeam</a>]</span></p>
<p>The winning <a href="#class_ba_SessionTeam">ba.SessionTeam</a> if there is exactly one, or else None.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_GameResults____init__">&lt;constructor&gt;</a>, <a href="#method_ba_GameResults__get_team_score">get_team_score()</a>, <a href="#method_ba_GameResults__get_team_score_str">get_team_score_str()</a>, <a href="#method_ba_GameResults__has_score_for_team">has_score_for_team()</a>, <a href="#method_ba_GameResults__set_game">set_game()</a>, <a href="#method_ba_GameResults__set_team_score">set_team_score()</a></h5>
<dl>
<dt><h4><a name="method_ba_GameResults____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.GameResults()</span></p>
<p>Instantiate a results instance.</p>
</dd>
<dt><h4><a name="method_ba_GameResults__get_team_score">get_team_score()</a></dt></h4><dd>
<p><span>get_team_score(self, sessionteam: Union[<a href="#class_ba_SessionTeam">ba.SessionTeam</a>]) -&gt; Optional[int]</span></p>
<p>Return the score for a given <a href="#class_ba_SessionTeam">ba.SessionTeam</a>.</p>
</dd>
<dt><h4><a name="method_ba_GameResults__get_team_score_str">get_team_score_str()</a></dt></h4><dd>
<p><span>get_team_score_str(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return the score for the given <a href="#class_ba_Team">ba.Team</a> as an Lstr.</p>
<p>(properly formatted for the score type.)</p>
</dd>
<dt><h4><a name="method_ba_GameResults__has_score_for_team">has_score_for_team()</a></dt></h4><dd>
<p><span>has_score_for_team(self, sessionteam: <a href="#class_ba_SessionTeam">ba.SessionTeam</a>) -&gt; bool</span></p>
<p>Return whether there is a score for a given team.</p>
</dd>
<dt><h4><a name="method_ba_GameResults__set_game">set_game()</a></dt></h4><dd>
<p><span>set_game(self, game: <a href="#class_ba_GameActivity">ba.GameActivity</a>) -&gt; None</span></p>
<p>Set the game instance these results are applying to.</p>
</dd>
<dt><h4><a name="method_ba_GameResults__set_team_score">set_team_score()</a></dt></h4><dd>
<p><span>set_team_score(self, team: <a href="#class_ba_Team">ba.Team</a>, score: Optional[int]) -&gt; None</span></p>
<p>Set the score for a given <a href="#class_ba_Team">ba.Team</a>.</p>
<p>This can be a number or None.
(see the none_is_winner arg in the constructor)</p>
</dd>
</dl>
<hr>
@ -2914,6 +3011,43 @@ prefs, etc.</p>
<h3>Methods:</h3>
<p>&lt;all methods inherited from <a href="#class_ba_NotFoundError">ba.NotFoundError</a>&gt;</p>
<hr>
<h2><strong><a name="class_ba_InputType">ba.InputType</a></strong></h3>
<p>Inherits from: enum.Enum</p>
<p>Types of input a controller can send to the game.</p>
<p>Category: <a href="#class_category_Enums">Enums</a></p>
<p></p>
<h3>Values:</h3>
<ul>
<li>UP_DOWN</li>
<li>LEFT_RIGHT</li>
<li>JUMP_PRESS</li>
<li>JUMP_RELEASE</li>
<li>PUNCH_PRESS</li>
<li>PUNCH_RELEASE</li>
<li>BOMB_PRESS</li>
<li>BOMB_RELEASE</li>
<li>PICK_UP_PRESS</li>
<li>PICK_UP_RELEASE</li>
<li>RUN</li>
<li>FLY_PRESS</li>
<li>FLY_RELEASE</li>
<li>START_PRESS</li>
<li>START_RELEASE</li>
<li>HOLD_POSITION_PRESS</li>
<li>HOLD_POSITION_RELEASE</li>
<li>LEFT_PRESS</li>
<li>LEFT_RELEASE</li>
<li>RIGHT_PRESS</li>
<li>RIGHT_RELEASE</li>
<li>UP_PRESS</li>
<li>UP_RELEASE</li>
<li>DOWN_PRESS</li>
<li>DOWN_RELEASE</li>
</ul>
<hr>
<h2><strong><a name="class_ba_IntChoiceSetting">ba.IntChoiceSetting</a></strong></h3>
<p>Inherits from: <a href="#class_ba_ChoiceSetting">ba.ChoiceSetting</a>, <a href="#class_ba_Setting">ba.Setting</a></p>
<p>An int setting with multiple choices.</p>
@ -3615,7 +3749,7 @@ Use <a href="#function_ba_getmodel">ba.getmodel</a>() to instantiate one.</p>
</dd>
<dt><h4><a name="method_ba_MultiTeamSession__announce_game_results">announce_game_results()</a></dt></h4><dd>
<p><span>announce_game_results(self, activity: <a href="#class_ba_GameActivity">ba.GameActivity</a>, results: <a href="#class_ba_TeamGameResults">ba.TeamGameResults</a>, delay: float, announce_winning_team: bool = True) -&gt; None</span></p>
<p><span>announce_game_results(self, activity: <a href="#class_ba_GameActivity">ba.GameActivity</a>, results: <a href="#class_ba_GameResults">ba.GameResults</a>, delay: float, announce_winning_team: bool = True) -&gt; None</span></p>
<p>Show basic game result at the end of a game.</p>
@ -4134,18 +4268,12 @@ even if myactor is set to None.</p>
<h5><a href="#method_ba_Player__assigninput">assigninput()</a>, <a href="#method_ba_Player__exists">exists()</a>, <a href="#method_ba_Player__get_icon">get_icon()</a>, <a href="#method_ba_Player__getname">getname()</a>, <a href="#method_ba_Player__is_alive">is_alive()</a>, <a href="#method_ba_Player__on_expire">on_expire()</a>, <a href="#method_ba_Player__resetinput">resetinput()</a></h5>
<dl>
<dt><h4><a name="method_ba_Player__assigninput">assigninput()</a></dt></h4><dd>
<p><span>assigninput(self, inputtype: Union[str, Tuple[str, ...]], call: Callable) -&gt; None</span></p>
<p><span>assigninput(self, inputtype: Union[<a href="#class_ba_InputType">ba.InputType</a>, Tuple[<a href="#class_ba_InputType">ba.InputType</a>, ...]], call: Callable) -&gt; None</span></p>
<p>assigninput(type: Union[str, Tuple[str, ...]],
<p>assigninput(type: Union[<a href="#class_ba_InputType">ba.InputType</a>, Tuple[<a href="#class_ba_InputType">ba.InputType</a>, ...]],
call: Callable) -&gt; None</p>
<p>Set the python callable to be run for one or more types of input.
Valid type values are: 'jumpPress', 'jumpRelease', 'punchPress',
'punchRelease','bombPress', 'bombRelease', 'pickUpPress',
'pickUpRelease', 'upDown','leftRight','upPress', 'upRelease',
'downPress', 'downRelease', 'leftPress','leftRelease','rightPress',
'rightRelease', 'run', 'flyPress', 'flyRelease', 'startPress',
'startRelease'</p>
<p>Set the python callable to be run for one or more types of input.</p>
</dd>
<dt><h4><a name="method_ba_Player__exists">exists()</a></dt></h4><dd>
@ -4828,16 +4956,10 @@ is still in its lobby selecting a team/etc. then a
<h5><a href="#method_ba_SessionPlayer__assigninput">assigninput()</a>, <a href="#method_ba_SessionPlayer__exists">exists()</a>, <a href="#method_ba_SessionPlayer__get_account_id">get_account_id()</a>, <a href="#method_ba_SessionPlayer__get_icon">get_icon()</a>, <a href="#method_ba_SessionPlayer__getname">getname()</a>, <a href="#method_ba_SessionPlayer__remove_from_game">remove_from_game()</a>, <a href="#method_ba_SessionPlayer__resetinput">resetinput()</a>, <a href="#method_ba_SessionPlayer__setname">setname()</a></h5>
<dl>
<dt><h4><a name="method_ba_SessionPlayer__assigninput">assigninput()</a></dt></h4><dd>
<p><span>assigninput(type: Union[str, Tuple[str, ...]],
<p><span>assigninput(type: Union[<a href="#class_ba_InputType">ba.InputType</a>, Tuple[<a href="#class_ba_InputType">ba.InputType</a>, ...]],
call: Callable) -&gt; None</span></p>
<p>Set the python callable to be run for one or more types of input.
Valid type values are: 'jumpPress', 'jumpRelease', 'punchPress',
'punchRelease','bombPress', 'bombRelease', 'pickUpPress',
'pickUpRelease', 'upDown','leftRight','upPress', 'upRelease',
'downPress', 'downRelease', 'leftPress','leftRelease','rightPress',
'rightRelease', 'run', 'flyPress', 'flyRelease', 'startPress',
'startRelease'</p>
<p>Set the python callable to be run for one or more types of input.</p>
</dd>
<dt><h4><a name="method_ba_SessionPlayer__exists">exists()</a></dt></h4><dd>
@ -5404,102 +5526,6 @@ on the <a href="#class_ba_Player">ba.Player</a> and their <a href="#class_ba_Tea
returns True for <a href="#class_ba_DualTeamSession">ba.DualTeamSessions</a> and <a href="#class_ba_FreeForAllSession">ba.FreeForAllSessions</a>;
False otherwise.</p>
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_TeamGameResults">ba.TeamGameResults</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>
<p>
Results for a completed <a href="#class_ba_TeamGameActivity">ba.TeamGameActivity</a>.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<p>Upon completion, a game should fill one of these out and pass it to its
<a href="#method_ba_Activity__end">ba.Activity.end</a>() call.</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_TeamGameResults__lower_is_better">lower_is_better</a>, <a href="#attr_ba_TeamGameResults__playerinfos">playerinfos</a>, <a href="#attr_ba_TeamGameResults__score_label">score_label</a>, <a href="#attr_ba_TeamGameResults__scoretype">scoretype</a>, <a href="#attr_ba_TeamGameResults__sessionteams">sessionteams</a>, <a href="#attr_ba_TeamGameResults__winnergroups">winnergroups</a>, <a href="#attr_ba_TeamGameResults__winning_team">winning_team</a></h5>
<dl>
<dt><h4><a name="attr_ba_TeamGameResults__lower_is_better">lower_is_better</a></h4></dt><dd>
<p><span>bool</span></p>
<p>Whether lower scores are better.</p>
</dd>
<dt><h4><a name="attr_ba_TeamGameResults__playerinfos">playerinfos</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_PlayerInfo">ba.PlayerInfo</a>]</span></p>
<p>Get info about the players represented by the results.</p>
</dd>
<dt><h4><a name="attr_ba_TeamGameResults__score_label">score_label</a></h4></dt><dd>
<p><span>str</span></p>
<p>The label associated with scores ('points', etc).</p>
</dd>
<dt><h4><a name="attr_ba_TeamGameResults__scoretype">scoretype</a></h4></dt><dd>
<p><span><a href="#class_ba_ScoreType">ba.ScoreType</a></span></p>
<p>The type of score.</p>
</dd>
<dt><h4><a name="attr_ba_TeamGameResults__sessionteams">sessionteams</a></h4></dt><dd>
<p><span>List[<a href="#class_ba_SessionTeam">ba.SessionTeam</a>]</span></p>
<p>Return all <a href="#class_ba_SessionTeam">ba.SessionTeams</a> in the results.</p>
</dd>
<dt><h4><a name="attr_ba_TeamGameResults__winnergroups">winnergroups</a></h4></dt><dd>
<p><span>List[WinnerGroup]</span></p>
<p>Get an ordered list of winner groups.</p>
</dd>
<dt><h4><a name="attr_ba_TeamGameResults__winning_team">winning_team</a></h4></dt><dd>
<p><span>Optional[<a href="#class_ba_SessionTeam">ba.SessionTeam</a>]</span></p>
<p>The winning <a href="#class_ba_SessionTeam">ba.SessionTeam</a> if there is exactly one, or else None.</p>
</dd>
</dl>
<h3>Methods:</h3>
<h5><a href="#method_ba_TeamGameResults____init__">&lt;constructor&gt;</a>, <a href="#method_ba_TeamGameResults__get_team_score">get_team_score()</a>, <a href="#method_ba_TeamGameResults__get_team_score_str">get_team_score_str()</a>, <a href="#method_ba_TeamGameResults__has_score_for_team">has_score_for_team()</a>, <a href="#method_ba_TeamGameResults__set_game">set_game()</a>, <a href="#method_ba_TeamGameResults__set_team_score">set_team_score()</a></h5>
<dl>
<dt><h4><a name="method_ba_TeamGameResults____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.TeamGameResults()</span></p>
<p>Instantiate a results instance.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_team_score">get_team_score()</a></dt></h4><dd>
<p><span>get_team_score(self, sessionteam: Union[<a href="#class_ba_SessionTeam">ba.SessionTeam</a>]) -&gt; Optional[int]</span></p>
<p>Return the score for a given <a href="#class_ba_SessionTeam">ba.SessionTeam</a>.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__get_team_score_str">get_team_score_str()</a></dt></h4><dd>
<p><span>get_team_score_str(self, team: <a href="#class_ba_Team">ba.Team</a>) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Return the score for the given <a href="#class_ba_Team">ba.Team</a> as an Lstr.</p>
<p>(properly formatted for the score type.)</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__has_score_for_team">has_score_for_team()</a></dt></h4><dd>
<p><span>has_score_for_team(self, sessionteam: <a href="#class_ba_SessionTeam">ba.SessionTeam</a>) -&gt; bool</span></p>
<p>Return whether there is a score for a given team.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__set_game">set_game()</a></dt></h4><dd>
<p><span>set_game(self, game: <a href="#class_ba_GameActivity">ba.GameActivity</a>) -&gt; None</span></p>
<p>Set the game instance these results are applying to.</p>
</dd>
<dt><h4><a name="method_ba_TeamGameResults__set_team_score">set_team_score()</a></dt></h4><dd>
<p><span>set_team_score(self, team: <a href="#class_ba_Team">ba.Team</a>, score: Optional[int]) -&gt; None</span></p>
<p>Set the score for a given <a href="#class_ba_Team">ba.Team</a>.</p>
<p>This can be a number or None.
(see the none_is_winner arg in the constructor)</p>
</dd>
</dl>
<hr>
@ -6375,8 +6401,8 @@ issues unless to_server is False.</p>
so in most cases you can just use that.</p>
<hr>
<h2><strong><a name="function_ba_new_activity">ba.new_activity()</a></strong></h3>
<p><span>new_activity(activity_type: Type[<a href="#class_ba_Activity">ba.Activity</a>],
<h2><strong><a name="function_ba_newactivity">ba.newactivity()</a></strong></h3>
<p><span>newactivity(activity_type: Type[<a href="#class_ba_Activity">ba.Activity</a>],
settings: dict = None) -&gt; <a href="#class_ba_Activity">ba.Activity</a></span></p>
<p>Instantiates a <a href="#class_ba_Activity">ba.Activity</a> given a type object.</p>

View File

@ -145,7 +145,7 @@ class App:
if os.path.exists('tools/gendummymodule.py'):
if os.system('tools/gendummymodule.py' + self._checkarg) != 0:
print(
f'{Clr.RED}Error checking/updating dummy module{Clr.RST}')
f'{Clr.RED}Error checking/updating dummy module.{Clr.RST}')
sys.exit(255)
def _update_docs_md(self) -> None:
@ -636,33 +636,32 @@ class App:
def _update_assets_makefile(self) -> None:
assert os.path.exists('tools/update_assets_makefile')
if os.system('tools/update_assets_makefile' + self._checkarg) != 0:
print(Clr.RED + 'Error checking/updating assets Makefile' +
Clr.RST)
print(
f'{Clr.RED}Error checking/updating assets Makefile.f{Clr.RST}')
sys.exit(255)
def _update_generated_code_makefile(self) -> None:
if os.path.exists('tools/update_generated_code_makefile'):
if os.system('tools/update_generated_code_makefile' +
self._checkarg) != 0:
print(Clr.RED +
'Error checking/updating generated-code Makefile' +
Clr.RST)
print(f'{Clr.RED}Error checking/updating'
f' generated-code Makefile{Clr.RED}')
sys.exit(255)
def _update_resources_makefile(self) -> None:
if os.path.exists('tools/update_resources_makefile'):
if os.system('tools/update_resources_makefile' +
self._checkarg) != 0:
print(Clr.RED + 'Error checking/updating resources Makefile' +
Clr.RST)
print(f'{Clr.RED}Error checking/updating'
f' resources Makefile.{Clr.RST}')
sys.exit(255)
def _update_python_enums_module(self) -> None:
if os.path.exists('tools/update_python_enums_module'):
if os.system('tools/update_python_enums_module' +
self._checkarg) != 0:
print(Clr.RED + 'Error checking/updating python enums module' +
Clr.RST)
print(f'{Clr.RED}Error checking/updating'
f' python enums module.{Clr.RST}')
sys.exit(255)