language updates and game class bug fixes and tidying

This commit is contained in:
Eric Froemling 2020-04-02 23:45:51 -07:00
parent 60515d79b2
commit 98712b133e
29 changed files with 94 additions and 104 deletions

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) # (hash we can use to see if this file is out of date)
# SOURCES_HASH=237130603961569354119127975507628873256 # SOURCES_HASH=289136972904319905380913187760209000511
# I'm sorry Pylint. I know this file saddens you. Be strong. # I'm sorry Pylint. I know this file saddens you. Be strong.
# pylint: disable=useless-suppression # pylint: disable=useless-suppression

View File

@ -141,18 +141,19 @@ class ScoreScreenActivity(Activity):
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
super().__init__(settings) super().__init__(settings)
self.transition_time = 0.5 self.transition_time = 0.5
self._birth_time = _ba.time()
self._min_view_time = 5.0
self.inherits_tint = True self.inherits_tint = True
self.inherits_camera_vr_offset = True self.inherits_camera_vr_offset = True
self.use_fixed_vr_overlay = True self.use_fixed_vr_overlay = True
self.default_music: Optional[MusicType] = MusicType.SCORES
self._birth_time = _ba.time()
self._min_view_time = 5.0
self._allow_server_restart = False self._allow_server_restart = False
self._background: Optional[ba.Actor] = None self._background: Optional[ba.Actor] = None
self._tips_text: Optional[ba.Actor] = None self._tips_text: Optional[ba.Actor] = None
self._kicked_off_server_shutdown = False self._kicked_off_server_shutdown = False
self._kicked_off_server_restart = False self._kicked_off_server_restart = False
self._default_music: Optional[MusicType] = MusicType.SCORES
self._default_show_tips = True self._default_show_tips = True
self._custom_continue_message: Optional[ba.Lstr] = None
def on_player_join(self, player: ba.Player) -> None: def on_player_join(self, player: ba.Player) -> None:
from ba import _general from ba import _general
@ -174,11 +175,9 @@ class ScoreScreenActivity(Activity):
show_logo=True) show_logo=True)
if self._default_show_tips: if self._default_show_tips:
self._tips_text = TipsText() self._tips_text = TipsText()
setmusic(self._default_music) setmusic(self.default_music)
def on_begin(self, custom_continue_message: ba.Lstr = None) -> None: def on_begin(self) -> None:
# FIXME: Unify args.
# pylint: disable=arguments-differ
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from bastd.actor import text from bastd.actor import text
from ba import _lang from ba import _lang
@ -194,7 +193,8 @@ class ScoreScreenActivity(Activity):
else: else:
sval = _lang.Lstr(resource='pressAnyButtonText') sval = _lang.Lstr(resource='pressAnyButtonText')
text.Text(custom_continue_message if custom_continue_message else sval, text.Text(self._custom_continue_message
if self._custom_continue_message is not None else sval,
v_attach='bottom', v_attach='bottom',
h_align='center', h_align='center',
flash=True, flash=True,

View File

@ -73,7 +73,7 @@ def suppress_debug_reports() -> None:
This should be called in devel/debug situations to avoid spamming This should be called in devel/debug situations to avoid spamming
the master server with spurious logs. the master server with spurious logs.
""" """
_ba.screenmessage("Suppressing debug reports.", color=(1, 0, 0)) # _ba.screenmessage("Suppressing debug reports.", color=(1, 0, 0))
_ba.app.suppress_debug_reports = True _ba.app.suppress_debug_reports = True

View File

@ -306,9 +306,9 @@ class GameActivity(Activity):
# Whether to show points for kills. # Whether to show points for kills.
self._show_kill_points = True self._show_kill_points = True
# Music that should play in on_transition_in() # If not None, the music type that should play in on_transition_in()
# (unless overridden by the map). # (unless overridden by the map).
self._default_music: Optional[ba.MusicType] = None self.default_music: Optional[ba.MusicType] = None
# Go ahead and get our map loading. # Go ahead and get our map loading.
map_name: str map_name: str
@ -449,7 +449,7 @@ class GameActivity(Activity):
# Make our map. # Make our map.
self._map = self._map_type() self._map = self._map_type()
music = self._default_music music = self.default_music
# give our map a chance to override the music # give our map a chance to override the music
# (for happy-thoughts and other such themed maps) # (for happy-thoughts and other such themed maps)

View File

@ -38,13 +38,10 @@ class DrawScoreScreenActivity(TeamsScoreScreenActivity):
super().__init__(settings=settings) super().__init__(settings=settings)
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = None # Awkward silence... self.default_music = None # Awkward silence...
super().on_transition_in() super().on_transition_in()
# noinspection PyMethodOverriding def on_begin(self) -> None:
def on_begin(self) -> None: # type: ignore
# FIXME FIXME: unify args
# pylint: disable=arguments-differ
from bastd.actor.zoomtext import ZoomText from bastd.actor.zoomtext import ZoomText
ba.set_analytics_screen('Draw Score Screen') ba.set_analytics_screen('Draw Score Screen')
super().on_begin() super().on_begin()

View File

@ -38,10 +38,7 @@ class TeamVictoryScoreScreenActivity(TeamsScoreScreenActivity):
def __init__(self, settings: Dict[str, Any]): def __init__(self, settings: Dict[str, Any]):
super().__init__(settings=settings) super().__init__(settings=settings)
# noinspection PyMethodOverriding def on_begin(self) -> None:
def on_begin(self) -> None: # type: ignore
# FIXME: Unify args.
# pylint: disable=arguments-differ
from ba.deprecated import get_resource from ba.deprecated import get_resource
ba.set_analytics_screen('Teams Score Screen') ba.set_analytics_screen('Teams Score Screen')
super().on_begin() super().on_begin()

View File

@ -40,12 +40,9 @@ class FreeForAllVictoryScoreScreenActivity(TeamsScoreScreenActivity):
self.transition_time = 0.5 self.transition_time = 0.5
self._cymbal_sound = ba.getsound('cymbal') self._cymbal_sound = ba.getsound('cymbal')
# noinspection PyMethodOverriding def on_begin(self) -> None:
def on_begin(self) -> None: # type: ignore
# FIXME FIXME unify args
# pylint: disable=arguments-differ
# pylint: disable=too-many-statements
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=too-many-statements
from bastd.actor.text import Text from bastd.actor.text import Text
from bastd.actor import image from bastd.actor import image
ba.set_analytics_screen('FreeForAll Score Screen') ba.set_analytics_screen('FreeForAll Score Screen')

View File

@ -41,17 +41,13 @@ class TeamSeriesVictoryScoreScreenActivity(TeamsScoreScreenActivity):
self._allow_server_restart = True self._allow_server_restart = True
self._tips_text = None self._tips_text = None
# noinspection PyMethodOverriding
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
# We don't yet want music and whatnot... # We don't yet want music and whatnot...
self._default_music = None self.default_music = None
self._default_show_tips = False self._default_show_tips = False
super().on_transition_in() super().on_transition_in()
# noinspection PyMethodOverriding def on_begin(self) -> None:
def on_begin(self) -> None: # type: ignore
# FIXME FIXME: args differ
# pylint: disable=arguments-differ
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
@ -64,7 +60,9 @@ class TeamSeriesVictoryScoreScreenActivity(TeamsScoreScreenActivity):
sval = ba.Lstr(resource='pressAnyKeyButtonPlayAgainText') sval = ba.Lstr(resource='pressAnyKeyButtonPlayAgainText')
else: else:
sval = ba.Lstr(resource='pressAnyButtonPlayAgainText') sval = ba.Lstr(resource='pressAnyButtonPlayAgainText')
super().on_begin(show_up_next=False, custom_continue_message=sval) self._show_up_next = False
self._custom_continue_message = sval
super().on_begin()
winning_team = self.settings['winner'] winning_team = self.settings['winner']
# Pause a moment before playing victory music. # Pause a moment before playing victory music.

View File

@ -40,16 +40,13 @@ class TeamsScoreScreenActivity(ScoreScreenActivity):
self._score_display_sound = ba.getsound("scoreHit01") self._score_display_sound = ba.getsound("scoreHit01")
self._score_display_sound_small = ba.getsound("scoreHit02") self._score_display_sound_small = ba.getsound("scoreHit02")
def on_begin( # type: ignore self._show_up_next: bool = True
self,
show_up_next: bool = True, def on_begin(self) -> None:
custom_continue_message: ba.Lstr = None) -> None:
# FIXME FIXME unify args
# pylint: disable=arguments-differ
from bastd.actor.text import Text from bastd.actor.text import Text
super().on_begin(custom_continue_message=custom_continue_message) super().on_begin()
session = self.session session = self.session
if show_up_next and isinstance(session, ba.TeamBaseSession): if self._show_up_next and isinstance(session, ba.TeamBaseSession):
txt = ba.Lstr(value='${A} ${B}', txt = ba.Lstr(value='${A} ${B}',
subs=[ subs=[
('${A}', ('${A}',

View File

@ -94,8 +94,8 @@ class AssaultGame(ba.TeamGameActivity):
return 'touch ${ARG1} flags', self.settings['Score to Win'] return 'touch ${ARG1} flags', self.settings['Score to Win']
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = (ba.MusicType.EPIC if self.settings['Epic Mode'] self.default_music = (ba.MusicType.EPIC if self.settings['Epic Mode']
else ba.MusicType.FORWARD_MARCH) else ba.MusicType.FORWARD_MARCH)
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -104,7 +104,7 @@ class AssaultGame(ba.TeamGameActivity):
def on_begin(self) -> None: def on_begin(self) -> None:
from bastd.actor.flag import Flag from bastd.actor.flag import Flag
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
for team in self.teams: for team in self.teams:

View File

@ -52,7 +52,7 @@ class CTFFlag(stdflag.Flag):
'h_align': 'center' 'h_align': 'center'
}) })
self.reset_return_times() self.reset_return_times()
self.last_player_to_hold = None self.last_player_to_hold: Optional[ba.Player] = None
self.time_out_respawn_time: Optional[int] = None self.time_out_respawn_time: Optional[int] = None
self.touch_return_time: Optional[float] = None self.touch_return_time: Optional[float] = None
@ -135,8 +135,8 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
return 'return ${ARG1} flags', self.settings['Score to Win'] return 'return ${ARG1} flags', self.settings['Score to Win']
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = (ba.MusicType.EPIC if self.settings['Epic Mode'] self.default_music = (ba.MusicType.EPIC if self.settings['Epic Mode']
else ba.MusicType.FLAG_CATCHER) else ba.MusicType.FLAG_CATCHER)
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -208,7 +208,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
self._update_scoreboard() self._update_scoreboard()
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
ba.timer(1.0, call=self._tick, repeat=True) ba.timer(1.0, call=self._tick, repeat=True)
@ -222,6 +222,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
def _handle_flag_entered_base(self, team: ba.Team) -> None: def _handle_flag_entered_base(self, team: ba.Team) -> None:
flag = ba.get_collision_info("opposing_node").getdelegate() flag = ba.get_collision_info("opposing_node").getdelegate()
assert isinstance(flag, CTFFlag)
if flag.get_team() is team: if flag.get_team() is team:
team.gamedata['home_flag_at_base'] = True team.gamedata['home_flag_at_base'] = True
@ -234,7 +235,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
if team.gamedata['home_flag_at_base']: if team.gamedata['home_flag_at_base']:
# Award points to whoever was carrying the enemy flag. # Award points to whoever was carrying the enemy flag.
player = flag.last_player_to_hold player = flag.last_player_to_hold
if player and player.get_team() is team: if player and player.team is team:
assert self.stats assert self.stats
self.stats.player_scored(player, 50, big_message=True) self.stats.player_scored(player, 50, big_message=True)

View File

@ -118,8 +118,8 @@ class ChosenOneGame(ba.TeamGameActivity):
return 'There can be only one.' return 'There can be only one.'
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = (ba.MusicType.EPIC if self.settings['Epic Mode'] self.default_music = (ba.MusicType.EPIC if self.settings['Epic Mode']
else ba.MusicType.CHOSEN_ONE) else ba.MusicType.CHOSEN_ONE)
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -132,7 +132,7 @@ class ChosenOneGame(ba.TeamGameActivity):
self._set_chosen_one_player(None) self._set_chosen_one_player(None)
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
self._flag_spawn_pos = self.map.get_flag_position(None) self._flag_spawn_pos = self.map.get_flag_position(None)

View File

@ -123,8 +123,8 @@ class ConquestGame(ba.TeamGameActivity):
return 'secure all ${ARG1} flags', len(self.map.flag_points) return 'secure all ${ARG1} flags', len(self.map.flag_points)
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = (ba.MusicType.EPIC if self.settings['Epic Mode'] self.default_music = (ba.MusicType.EPIC if self.settings['Epic Mode']
else ba.MusicType.GRAND_ROMP) else ba.MusicType.GRAND_ROMP)
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -140,7 +140,7 @@ class ConquestGame(ba.TeamGameActivity):
self.spawn_player(player) self.spawn_player(player)
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()

View File

@ -115,8 +115,8 @@ class DeathMatchGame(ba.TeamGameActivity):
return 'kill ${ARG1} enemies', self._score_to_win return 'kill ${ARG1} enemies', self._score_to_win
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = (ba.MusicType.EPIC if self.settings['Epic Mode'] self.default_music = (ba.MusicType.EPIC if self.settings['Epic Mode']
else ba.MusicType.TO_THE_DEATH) else ba.MusicType.TO_THE_DEATH)
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -125,7 +125,7 @@ class DeathMatchGame(ba.TeamGameActivity):
self._update_scoreboard() self._update_scoreboard()
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
if self.teams: if self.teams:

View File

@ -97,7 +97,7 @@ class EasterEggHuntGame(ba.TeamGameActivity):
# ..we can go ahead and set our music and whatnot. # ..we can go ahead and set our music and whatnot.
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.FORWARD_MARCH self.default_music = ba.MusicType.FORWARD_MARCH
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -114,7 +114,7 @@ class EasterEggHuntGame(ba.TeamGameActivity):
gamemap = self.map gamemap = self.map
assert isinstance(gamemap, TowerD) assert isinstance(gamemap, TowerD)
gamemap.player_wall.delete() gamemap.player_wall.delete()
ba.TeamGameActivity.on_begin(self) super().on_begin()
self._update_scoreboard() self._update_scoreboard()
self._update_timer = ba.Timer(0.25, self._update, repeat=True) self._update_timer = ba.Timer(0.25, self._update, repeat=True)
self._countdown = OnScreenCountdown(60, endcall=self.end_game) self._countdown = OnScreenCountdown(60, endcall=self.end_game)

View File

@ -244,8 +244,8 @@ class EliminationGame(ba.TeamGameActivity):
self.session, ba.TeamsSession) else 'last one standing wins' self.session, ba.TeamsSession) else 'last one standing wins'
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = (ba.MusicType.EPIC if self.settings['Epic Mode'] self.default_music = (ba.MusicType.EPIC if self.settings['Epic Mode']
else ba.MusicType.SURVIVAL) else ba.MusicType.SURVIVAL)
super().on_transition_in() super().on_transition_in()
self._start_time = ba.time() self._start_time = ba.time()
@ -445,7 +445,7 @@ class EliminationGame(ba.TeamGameActivity):
ba.timer(0, self._update_icons) ba.timer(0, self._update_icons)
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
if self._solo_mode: if self._solo_mode:

View File

@ -146,11 +146,11 @@ class FootballTeamGame(ba.TeamGameActivity):
return 'score a touchdown' return 'score a touchdown'
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.FOOTBALL self.default_music = ba.MusicType.FOOTBALL
super().on_transition_in() super().on_transition_in()
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
self._flag_spawn_pos = (self.map.get_flag_position(None)) self._flag_spawn_pos = (self.map.get_flag_position(None))
@ -397,7 +397,7 @@ class FootballCoopGame(ba.CoopGameActivity):
self._flag: Optional[FootballFlag] = None self._flag: Optional[FootballFlag] = None
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.FOOTBALL self.default_music = ba.MusicType.FOOTBALL
super().on_transition_in() super().on_transition_in()
self._scoreboard = Scoreboard() self._scoreboard = Scoreboard()
self._flag_spawn_pos = self.map.get_flag_position(None) self._flag_spawn_pos = self.map.get_flag_position(None)
@ -429,7 +429,7 @@ class FootballCoopGame(ba.CoopGameActivity):
# FIXME: Split this up a bit. # FIXME: Split this up a bit.
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
from bastd.actor import controlsguide from bastd.actor import controlsguide
ba.CoopGameActivity.on_begin(self) super().on_begin()
# Show controls help in kiosk mode. # Show controls help in kiosk mode.
if ba.app.kiosk_mode: if ba.app.kiosk_mode:

View File

@ -207,11 +207,11 @@ class HockeyGame(ba.TeamGameActivity):
return 'score ${ARG1} goals', self.settings['Score to Win'] return 'score ${ARG1} goals', self.settings['Score to Win']
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.HOCKEY self.default_music = ba.MusicType.HOCKEY
super().on_transition_in() super().on_transition_in()
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()

View File

@ -124,7 +124,7 @@ class KeepAwayGame(ba.TeamGameActivity):
self.settings['Hold Time']) self.settings['Hold Time'])
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.KEEP_AWAY self.default_music = ba.MusicType.KEEP_AWAY
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -132,7 +132,7 @@ class KeepAwayGame(ba.TeamGameActivity):
self._update_scoreboard() self._update_scoreboard()
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
self._flag_spawn_pos = self.map.get_flag_position(None) self._flag_spawn_pos = self.map.get_flag_position(None)

View File

@ -133,7 +133,7 @@ class KingOfTheHillGame(ba.TeamGameActivity):
self.settings['Hold Time']) self.settings['Hold Time'])
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.SCARY self.default_music = ba.MusicType.SCARY
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -145,7 +145,7 @@ class KingOfTheHillGame(ba.TeamGameActivity):
player.gamedata['at_flag'] = 0 player.gamedata['at_flag'] = 0
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
self._flag_pos = self.map.get_flag_position(None) self._flag_pos = self.map.get_flag_position(None)

View File

@ -91,15 +91,15 @@ class MeteorShowerGame(ba.TeamGameActivity):
# Called when our game is transitioning in but not ready to start; # Called when our game is transitioning in but not ready to start;
# ..we can go ahead and set our music and whatnot. # ..we can go ahead and set our music and whatnot.
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = (ba.MusicType.EPIC if self.settings['Epic Mode'] self.default_music = (ba.MusicType.EPIC if self.settings['Epic Mode']
else ba.MusicType.SURVIVAL) else ba.MusicType.SURVIVAL)
super().on_transition_in() super().on_transition_in()
# Called when our game actually starts. # Called when our game actually starts.
def on_begin(self) -> None: def on_begin(self) -> None:
from bastd.actor.onscreentimer import OnScreenTimer from bastd.actor.onscreentimer import OnScreenTimer
ba.TeamGameActivity.on_begin(self) super().on_begin()
# Drop a wave every few seconds.. and every so often drop the time # Drop a wave every few seconds.. and every so often drop the time
# between waves ..lets have things increase faster if we have fewer # between waves ..lets have things increase faster if we have fewer

View File

@ -84,12 +84,12 @@ class NinjaFightGame(ba.TeamGameActivity):
# Called when our game is transitioning in but not ready to begin; # Called when our game is transitioning in but not ready to begin;
# we can go ahead and start creating stuff, playing music, etc. # we can go ahead and start creating stuff, playing music, etc.
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.TO_THE_DEATH self.default_music = ba.MusicType.TO_THE_DEATH
super().on_transition_in() super().on_transition_in()
# Called when our game actually begins. # Called when our game actually begins.
def on_begin(self) -> None: def on_begin(self) -> None:
ba.TeamGameActivity.on_begin(self) super().on_begin()
is_pro = self.settings.get('preset') == 'pro' is_pro = self.settings.get('preset') == 'pro'
# In pro mode there's no powerups. # In pro mode there's no powerups.

View File

@ -172,9 +172,9 @@ class RaceGame(ba.TeamGameActivity):
return 'run 1 lap' return 'run 1 lap'
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = (ba.MusicType.EPIC_RACE self.default_music = (ba.MusicType.EPIC_RACE
if self.settings['Epic Mode'] else if self.settings['Epic Mode'] else
ba.MusicType.RACE) ba.MusicType.RACE)
super().on_transition_in() super().on_transition_in()
pts = self.map.get_def_points('race_point') pts = self.map.get_def_points('race_point')
@ -400,7 +400,7 @@ class RaceGame(ba.TeamGameActivity):
def on_begin(self) -> None: def on_begin(self) -> None:
from bastd.actor.onscreentimer import OnScreenTimer from bastd.actor.onscreentimer import OnScreenTimer
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.setup_standard_time_limit(self.settings['Time Limit']) self.setup_standard_time_limit(self.settings['Time Limit'])
self.setup_standard_powerup_drops() self.setup_standard_powerup_drops()
self._team_finish_pts = 100 self._team_finish_pts = 100

View File

@ -130,7 +130,7 @@ class RunaroundGame(ba.CoopGameActivity):
self._wave_update_timer: Optional[ba.Timer] = None self._wave_update_timer: Optional[ba.Timer] = None
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.MARCHING self.default_music = ba.MusicType.MARCHING
super().on_transition_in() super().on_transition_in()
self._scoreboard = Scoreboard(label=ba.Lstr(resource='scoreText'), self._scoreboard = Scoreboard(label=ba.Lstr(resource='scoreText'),
score_split=0.5) score_split=0.5)
@ -145,7 +145,7 @@ class RunaroundGame(ba.CoopGameActivity):
})) }))
def on_begin(self) -> None: def on_begin(self) -> None:
ba.CoopGameActivity.on_begin(self) super().on_begin()
player_count = len(self.players) player_count = len(self.players)
hard = self._preset not in ['pro_easy', 'uber_easy'] hard = self._preset not in ['pro_easy', 'uber_easy']

View File

@ -81,7 +81,7 @@ class TargetPracticeGame(ba.TeamGameActivity):
self._countdown: Optional[OnScreenCountdown] = None self._countdown: Optional[OnScreenCountdown] = None
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
self._default_music = ba.MusicType.FORWARD_MARCH self.default_music = ba.MusicType.FORWARD_MARCH
super().on_transition_in() super().on_transition_in()
def on_team_join(self, team: ba.Team) -> None: def on_team_join(self, team: ba.Team) -> None:
@ -91,7 +91,7 @@ class TargetPracticeGame(ba.TeamGameActivity):
def on_begin(self) -> None: def on_begin(self) -> None:
from bastd.actor.onscreencountdown import OnScreenCountdown from bastd.actor.onscreencountdown import OnScreenCountdown
ba.TeamGameActivity.on_begin(self) super().on_begin()
self.update_scoreboard() self.update_scoreboard()
# Number of targets is based on player count. # Number of targets is based on player count.

View File

@ -98,14 +98,14 @@ class TheLastStandGame(ba.CoopGameActivity):
def on_transition_in(self) -> None: def on_transition_in(self) -> None:
from bastd.actor.scoreboard import Scoreboard from bastd.actor.scoreboard import Scoreboard
self._default_music = ba.MusicType.EPIC self.default_music = ba.MusicType.EPIC
super().on_transition_in() super().on_transition_in()
ba.timer(1.3, ba.Call(ba.playsound, self._new_wave_sound)) ba.timer(1.3, ba.Call(ba.playsound, self._new_wave_sound))
self._scoreboard = Scoreboard(label=ba.Lstr(resource='scoreText'), self._scoreboard = Scoreboard(label=ba.Lstr(resource='scoreText'),
score_split=0.5) score_split=0.5)
def on_begin(self) -> None: def on_begin(self) -> None:
ba.CoopGameActivity.on_begin(self) super().on_begin()
# Spit out a few powerups and start dropping more shortly. # Spit out a few powerups and start dropping more shortly.
self._drop_powerups(standard_points=True) self._drop_powerups(standard_points=True)

View File

@ -242,6 +242,7 @@ class MainMenuActivity(ba.Activity):
'background': True, 'background': True,
'color_texture': bgtex 'color_texture': bgtex
})) }))
self._ts = 0.86 self._ts = 0.86
self._language: Optional[str] = None self._language: Optional[str] = None

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND --> <!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-04-01 for Ballistica version 1.5.0 build 20001</em></h4> <h4><em>last updated on 2020-04-02 for Ballistica version 1.5.0 build 20001</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module, <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> 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> <hr>

View File

@ -40,20 +40,22 @@ if TYPE_CHECKING:
def test_assetmanager() -> None: def test_assetmanager() -> None:
"""Testing.""" """Testing."""
with tempfile.TemporaryDirectory() as tmpdir: # Disabling for now...
if bool(False):
with tempfile.TemporaryDirectory() as tmpdir:
manager = AssetManager(rootdir=Path(tmpdir)) manager = AssetManager(rootdir=Path(tmpdir))
wref = weakref.ref(manager) wref = weakref.ref(manager)
manager.start() manager.start()
gather = manager.launch_gather(packages=['a@2'], gather = manager.launch_gather(packages=['a@2'],
flavor=AssetPackageFlavor.DESKTOP, flavor=AssetPackageFlavor.DESKTOP,
account_token='dummytoken') account_token='dummytoken')
wref2 = weakref.ref(gather) wref2 = weakref.ref(gather)
manager.stop() manager.stop()
# Make sure nothing is keeping itself alive. # Make sure nothing is keeping itself alive.
del manager del manager
del gather del gather
assert wref() is None assert wref() is None
assert wref2() is None assert wref2() is None