mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-30 11:13:17 +08:00
Enabled pylint quote consistency check
This commit is contained in:
parent
952f9c0dae
commit
96abee0c9f
6
Makefile
6
Makefile
@ -625,6 +625,9 @@ TOOL_CFG_INST = tools/snippets tool_config_install
|
||||
# Anything that affects tool-config generation.
|
||||
TOOL_CFG_SRC = tools/efrotools/snippets.py config/config.json
|
||||
|
||||
# Anything that should trigger an environment-check when changed.
|
||||
ENV_SRC = tools/snippets tools/batools/build.py
|
||||
|
||||
.clang-format: config/toolconfigsrc/clang-format ${TOOL_CFG_SRC}
|
||||
${TOOL_CFG_INST} $< $@
|
||||
|
||||
@ -649,7 +652,8 @@ TOOL_CFG_SRC = tools/efrotools/snippets.py config/config.json
|
||||
.pycheckers: config/toolconfigsrc/pycheckers ${TOOL_CFG_SRC}
|
||||
${TOOL_CFG_INST} $< $@
|
||||
|
||||
.cache/checkenv: tools/snippets
|
||||
# Include anything as sources here that should require
|
||||
.cache/checkenv: ${ENV_SRC}
|
||||
@tools/snippets checkenv
|
||||
@mkdir -p .cache
|
||||
@touch .cache/checkenv
|
||||
|
||||
@ -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=166094941497544152153395869789035079688
|
||||
# SOURCES_HASH=98939788916547368271598516749611571784
|
||||
|
||||
# I'm sorry Pylint. I know this file saddens you. Be strong.
|
||||
# pylint: disable=useless-suppression
|
||||
@ -575,7 +575,7 @@ class Node:
|
||||
name_color: Sequence[float] = (0.0, 0.0, 0.0)
|
||||
tint_color: Sequence[float] = (0.0, 0.0, 0.0)
|
||||
tint2_color: Sequence[float] = (0.0, 0.0, 0.0)
|
||||
text: Union[ba.Lstr, str] = ""
|
||||
text: Union[ba.Lstr, str] = ''
|
||||
texture: Optional[ba.Texture] = None
|
||||
tint_texture: Optional[ba.Texture] = None
|
||||
times: Sequence[int] = (1, 2, 3, 4, 5)
|
||||
@ -595,7 +595,7 @@ class Node:
|
||||
client_only: bool = False
|
||||
materials: Sequence[Material] = ()
|
||||
roller_materials: Sequence[Material] = ()
|
||||
name: str = ""
|
||||
name: str = ''
|
||||
punch_materials: Sequence[ba.Material] = ()
|
||||
pickup_materials: Sequence[ba.Material] = ()
|
||||
extras_material: Sequence[ba.Material] = ()
|
||||
@ -642,7 +642,7 @@ class Node:
|
||||
boxing_gloves_flashing: bool = False
|
||||
dead: bool = False
|
||||
frozen: bool = False
|
||||
counter_text: str = ""
|
||||
counter_text: str = ''
|
||||
counter_texture: Optional[ba.Texture] = None
|
||||
shattered: int = 0
|
||||
billboard_texture: Optional[ba.Texture] = None
|
||||
@ -846,14 +846,14 @@ class Player:
|
||||
|
||||
Returns the character's icon (images, colors, etc contained in a dict)
|
||||
"""
|
||||
return {"foo": "bar"}
|
||||
return {'foo': 'bar'}
|
||||
|
||||
def get_icon_info(self) -> Dict[str, Any]:
|
||||
"""get_icon_info() -> Dict[str, Any]
|
||||
|
||||
(internal)
|
||||
"""
|
||||
return {"foo": "bar"}
|
||||
return {'foo': 'bar'}
|
||||
|
||||
def get_id(self) -> int:
|
||||
"""get_id() -> int
|
||||
@ -1935,7 +1935,7 @@ def get_appconfig_builtin_keys() -> List[str]:
|
||||
|
||||
(internal)
|
||||
"""
|
||||
return ["blah", "blah2"]
|
||||
return ['blah', 'blah2']
|
||||
|
||||
|
||||
def get_appconfig_default_value(key: str) -> Any:
|
||||
@ -1951,7 +1951,7 @@ def get_chat_messages() -> List[str]:
|
||||
|
||||
(internal)
|
||||
"""
|
||||
return ["blah", "blah2"]
|
||||
return ['blah', 'blah2']
|
||||
|
||||
|
||||
def get_collision_info(*args: Any) -> Any:
|
||||
@ -2037,7 +2037,7 @@ def get_game_roster() -> List[Dict[str, Any]]:
|
||||
|
||||
(internal)
|
||||
"""
|
||||
return [{"foo": "bar"}]
|
||||
return [{'foo': 'bar'}]
|
||||
|
||||
|
||||
def get_google_play_party_client_count() -> int:
|
||||
@ -2188,7 +2188,7 @@ def get_price(item: str) -> Optional[str]:
|
||||
|
||||
(internal)
|
||||
"""
|
||||
return ""
|
||||
return ''
|
||||
|
||||
|
||||
def get_public_login_id() -> Optional[str]:
|
||||
@ -2196,7 +2196,7 @@ def get_public_login_id() -> Optional[str]:
|
||||
|
||||
(internal)
|
||||
"""
|
||||
return ""
|
||||
return ''
|
||||
|
||||
|
||||
def get_public_party_enabled() -> bool:
|
||||
@ -2787,7 +2787,7 @@ def mac_music_app_get_playlists() -> List[str]:
|
||||
|
||||
(internal)
|
||||
"""
|
||||
return ["blah", "blah2"]
|
||||
return ['blah', 'blah2']
|
||||
|
||||
|
||||
def mac_music_app_get_volume() -> int:
|
||||
|
||||
@ -83,7 +83,7 @@ def get_league_rank_points(data: Optional[Dict[str, Any]],
|
||||
assert isinstance(trophies_total, int)
|
||||
return trophies_total
|
||||
if subset is not None:
|
||||
raise Exception("invalid subset value: " + str(subset))
|
||||
raise Exception('invalid subset value: ' + str(subset))
|
||||
|
||||
if data['p']:
|
||||
pro_mult = 1.0 + float(
|
||||
|
||||
@ -180,7 +180,7 @@ def _display_next_achievement() -> None:
|
||||
ach.show_completion_banner(sound)
|
||||
except Exception:
|
||||
from ba import _error
|
||||
_error.print_exception("error showing next achievement")
|
||||
_error.print_exception('error showing next achievement')
|
||||
app.achievements_to_display = []
|
||||
app.achievement_display_timer = None
|
||||
else:
|
||||
@ -409,7 +409,7 @@ class Achievement:
|
||||
hmo = (self._hard_mode_only and campaign.name == 'Easy')
|
||||
except Exception:
|
||||
from ba import _error
|
||||
_error.print_exception("unable to determine campaign")
|
||||
_error.print_exception('unable to determine campaign')
|
||||
hmo = False
|
||||
|
||||
objs: List[ba.Actor]
|
||||
|
||||
@ -91,14 +91,14 @@ class Activity(DependencyComponent):
|
||||
|
||||
session = _ba.getsession()
|
||||
if session is None:
|
||||
raise Exception("No current session")
|
||||
raise Exception('No current session')
|
||||
self._session = weakref.ref(session)
|
||||
|
||||
# Preloaded data for actors, maps, etc; indexed by type.
|
||||
self.preloads: Dict[Type, Any] = {}
|
||||
|
||||
if not isinstance(settings, dict):
|
||||
raise Exception("expected dict for settings")
|
||||
raise Exception('expected dict for settings')
|
||||
if _ba.getactivity(doraise=False) is not self:
|
||||
raise Exception('invalid context state')
|
||||
|
||||
@ -308,7 +308,7 @@ class Activity(DependencyComponent):
|
||||
with _ba.Context('empty'):
|
||||
self._expire()
|
||||
else:
|
||||
raise Exception("_destroy() called multiple times")
|
||||
raise Exception('_destroy() called multiple times')
|
||||
|
||||
@classmethod
|
||||
def _check_activity_death(cls, activity_ref: ReferenceType[Activity],
|
||||
@ -420,7 +420,7 @@ class Activity(DependencyComponent):
|
||||
from ba import _actor as bsactor
|
||||
from ba import _error
|
||||
if not isinstance(actor, bsactor.Actor):
|
||||
raise Exception("non-actor passed to _retain_actor")
|
||||
raise Exception('non-actor passed to _retain_actor')
|
||||
if (self.has_transitioned_in()
|
||||
and _ba.time() - self._last_dead_object_prune_time > 10.0):
|
||||
_error.print_error('it looks like nodes/actors are not'
|
||||
@ -438,7 +438,7 @@ class Activity(DependencyComponent):
|
||||
from ba import _actor as bsactor
|
||||
from ba import _error
|
||||
if not isinstance(actor, bsactor.Actor):
|
||||
raise Exception("non-actor passed to _add_actor_weak_ref")
|
||||
raise Exception('non-actor passed to _add_actor_weak_ref')
|
||||
if (self.has_transitioned_in()
|
||||
and _ba.time() - self._last_dead_object_prune_time > 10.0):
|
||||
_error.print_error('it looks like nodes/actors are '
|
||||
@ -603,12 +603,12 @@ class Activity(DependencyComponent):
|
||||
chooser_players.append(player)
|
||||
else:
|
||||
_error.print_error(
|
||||
"got nonexistent player in Activity._begin()")
|
||||
'got nonexistent player in Activity._begin()')
|
||||
|
||||
# Add teams in one by one and send team-joined messages for each.
|
||||
for team in session.teams:
|
||||
if team in self.teams:
|
||||
raise Exception("Duplicate Team Entry")
|
||||
raise Exception('Duplicate Team Entry')
|
||||
self.teams.append(team)
|
||||
try:
|
||||
with _ba.Context(self):
|
||||
@ -639,15 +639,15 @@ class Activity(DependencyComponent):
|
||||
# at some point.
|
||||
if not self._called_activity_on_transition_in:
|
||||
_error.print_error(
|
||||
"ba.Activity.on_transition_in() never got called for " +
|
||||
str(self) + "; did you forget to call it"
|
||||
" in your on_transition_in override?")
|
||||
'ba.Activity.on_transition_in() never got called for ' +
|
||||
str(self) + '; did you forget to call it'
|
||||
' in your on_transition_in override?')
|
||||
|
||||
# Make sure that ba.Activity.on_begin() got called at some point.
|
||||
if not self._called_activity_on_begin:
|
||||
_error.print_error(
|
||||
"ba.Activity.on_begin() never got called for " + str(self) +
|
||||
"; did you forget to call it in your on_begin override?")
|
||||
'ba.Activity.on_begin() never got called for ' + str(self) +
|
||||
'; did you forget to call it in your on_begin override?')
|
||||
|
||||
# If the whole session wants to die and was waiting on us, can get
|
||||
# that going now.
|
||||
|
||||
@ -558,14 +558,14 @@ class App:
|
||||
server_addr = _ba.get_master_server_address()
|
||||
if 'localhost' in server_addr:
|
||||
_ba.timer(2.0,
|
||||
lambda: _ba.screenmessage("Note: using local server",
|
||||
lambda: _ba.screenmessage('Note: using local server',
|
||||
(1, 1, 0),
|
||||
log=True),
|
||||
timetype=TimeType.REAL)
|
||||
elif 'test' in server_addr:
|
||||
_ba.timer(
|
||||
2.0,
|
||||
lambda: _ba.screenmessage("Note: using test server-module",
|
||||
lambda: _ba.screenmessage('Note: using test server-module',
|
||||
(1, 1, 0),
|
||||
log=True),
|
||||
timetype=TimeType.REAL)
|
||||
@ -729,7 +729,7 @@ class App:
|
||||
if args is None:
|
||||
args = {}
|
||||
if game == '':
|
||||
raise Exception("empty game name")
|
||||
raise Exception('empty game name')
|
||||
campaignname, levelname = game.split(':')
|
||||
campaign = get_campaign(campaignname)
|
||||
levels = campaign.get_levels()
|
||||
@ -839,6 +839,6 @@ class App:
|
||||
import urllib.request
|
||||
try:
|
||||
val = urllib.request.urlopen('https://example.com').read()
|
||||
print("HTTPS TEST SUCCESS", len(val))
|
||||
print('HTTPS TEST SUCCESS', len(val))
|
||||
except Exception as exc:
|
||||
print("HTTPS TEST FAIL:", exc)
|
||||
print('HTTPS TEST FAIL:', exc)
|
||||
|
||||
@ -178,7 +178,7 @@ def commit_app_config(force: bool = False) -> None:
|
||||
(internal)
|
||||
"""
|
||||
if not _ba.app.config_file_healthy and not force:
|
||||
print("Current config file is broken; "
|
||||
"skipping write to avoid losing settings.")
|
||||
print('Current config file is broken; '
|
||||
'skipping write to avoid losing settings.')
|
||||
return
|
||||
_ba.mark_config_dirty()
|
||||
|
||||
@ -50,7 +50,7 @@ def run_cpu_benchmark() -> None:
|
||||
# Store old graphics settings.
|
||||
self._old_quality = _ba.app.config.resolve('Graphics Quality')
|
||||
cfg = _ba.app.config
|
||||
cfg['Graphics Quality'] = "Low"
|
||||
cfg['Graphics Quality'] = 'Low'
|
||||
cfg.apply()
|
||||
self.benchmark_type = 'cpu'
|
||||
self.set_activity(_ba.new_activity(tutorial.TutorialActivity))
|
||||
@ -100,7 +100,7 @@ def stop_stress_test() -> None:
|
||||
_ba.set_stress_testing(False, 0)
|
||||
try:
|
||||
if _ba.app.stress_test_reset_timer is not None:
|
||||
_ba.screenmessage("Ending stress test...", color=(1, 1, 0))
|
||||
_ba.screenmessage('Ending stress test...', color=(1, 1, 0))
|
||||
except Exception:
|
||||
pass
|
||||
_ba.app.stress_test_reset_timer = None
|
||||
@ -156,7 +156,7 @@ def _reset_stress_test(args: Dict[str, Any]) -> None:
|
||||
|
||||
def run_gpu_benchmark() -> None:
|
||||
"""Kick off a benchmark to test gpu speeds."""
|
||||
_ba.screenmessage("FIXME: Not wired up yet.", color=(1, 0, 0))
|
||||
_ba.screenmessage('FIXME: Not wired up yet.', color=(1, 0, 0))
|
||||
|
||||
|
||||
def run_media_reload_benchmark() -> None:
|
||||
@ -174,7 +174,7 @@ def run_media_reload_benchmark() -> None:
|
||||
_lang.get_resource('debugWindow.totalReloadTimeText').replace(
|
||||
'${TIME}', str(_ba.time(TimeType.REAL) - start_time_2)))
|
||||
_ba.print_load_info()
|
||||
if _ba.app.config.resolve("Texture Quality") != 'High':
|
||||
if _ba.app.config.resolve('Texture Quality') != 'High':
|
||||
_ba.screenmessage(_lang.get_resource(
|
||||
'debugWindow.reloadBenchmarkBestResultsText'),
|
||||
color=(1, 1, 0))
|
||||
|
||||
@ -64,7 +64,7 @@ class Campaign:
|
||||
def add_level(self, level: ba.Level) -> None:
|
||||
"""Adds a ba.Level to the Campaign."""
|
||||
if level.get_campaign() is not None:
|
||||
raise Exception("level already belongs to a campaign")
|
||||
raise Exception('level already belongs to a campaign')
|
||||
level.set_campaign(self, len(self._levels))
|
||||
self._levels.append(level)
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ class CoopGameActivity(GameActivity):
|
||||
levelname = self._get_coop_level_name()
|
||||
campaign = self.session.campaign
|
||||
assert campaign is not None
|
||||
config_str = (str(len(self.players)) + "p" + campaign.get_level(
|
||||
config_str = (str(len(self.players)) + 'p' + campaign.get_level(
|
||||
self.settings['name']).get_score_version_string().replace(
|
||||
' ', '_'))
|
||||
_ba.get_scores_to_beat(levelname, config_str,
|
||||
@ -126,7 +126,7 @@ class CoopGameActivity(GameActivity):
|
||||
|
||||
def _get_coop_level_name(self) -> str:
|
||||
assert self.session.campaign is not None
|
||||
return self.session.campaign.name + ":" + str(self.settings['name'])
|
||||
return self.session.campaign.name + ':' + str(self.settings['name'])
|
||||
|
||||
def celebrate(self, duration: float) -> None:
|
||||
"""Tells all existing player-controlled characters to celebrate.
|
||||
@ -244,7 +244,7 @@ class CoopGameActivity(GameActivity):
|
||||
"""Fade the screen to red; (such as when the good guys have lost)."""
|
||||
from ba import _gameutils
|
||||
c_existing = _gameutils.sharedobj('globals').tint
|
||||
cnode = _ba.newnode("combine",
|
||||
cnode = _ba.newnode('combine',
|
||||
attrs={
|
||||
'input0': c_existing[0],
|
||||
'input1': c_existing[1],
|
||||
|
||||
@ -31,7 +31,7 @@ if TYPE_CHECKING:
|
||||
import ba
|
||||
|
||||
TEAM_COLORS = ((0.2, 0.4, 1.6), )
|
||||
TEAM_NAMES = ("Good Guys", )
|
||||
TEAM_NAMES = ('Good Guys', )
|
||||
|
||||
|
||||
class CoopSession(Session):
|
||||
@ -298,7 +298,7 @@ class CoopSession(Session):
|
||||
and self.campaign_state['level'] == 'Onslaught Training'
|
||||
and not app.kiosk_mode):
|
||||
if self._tutorial_activity is None:
|
||||
raise Exception("tutorial not preloaded properly")
|
||||
raise Exception('tutorial not preloaded properly')
|
||||
self.set_activity(self._tutorial_activity)
|
||||
self._tutorial_activity = None
|
||||
self._ran_tutorial_activity = True
|
||||
|
||||
@ -71,10 +71,10 @@ class Dependency(Generic[T]):
|
||||
if not isinstance(obj, DependencyComponent):
|
||||
if obj is None:
|
||||
raise TypeError(
|
||||
"Dependency must be accessed through an instance.")
|
||||
'Dependency must be accessed through an instance.')
|
||||
raise TypeError(
|
||||
f"Dependency cannot be added to class of type {type(obj)}"
|
||||
" (class must inherit from ba.DependencyComponent).")
|
||||
f'Dependency cannot be added to class of type {type(obj)}'
|
||||
' (class must inherit from ba.DependencyComponent).')
|
||||
|
||||
# We expect to be instantiated from an already living
|
||||
# DependencyComponent with valid dep-data in place..
|
||||
@ -84,7 +84,7 @@ class Dependency(Generic[T]):
|
||||
# there get back to the DependencySet
|
||||
entry = getattr(obj, '_dep_entry')
|
||||
if entry is None:
|
||||
raise RuntimeError("Invalid dependency access.")
|
||||
raise RuntimeError('Invalid dependency access.')
|
||||
entry = entry()
|
||||
assert isinstance(entry, DependencyEntry)
|
||||
depset = entry.depset()
|
||||
@ -211,7 +211,7 @@ class DependencySet(Generic[T]):
|
||||
"""
|
||||
|
||||
if self._resolved:
|
||||
raise Exception("DependencySet has already been resolved.")
|
||||
raise Exception('DependencySet has already been resolved.')
|
||||
|
||||
# print('RESOLVING DEP SET')
|
||||
|
||||
@ -273,7 +273,7 @@ class DependencySet(Generic[T]):
|
||||
def root(self) -> T:
|
||||
"""The instantiated root DependencyComponent instance for the set."""
|
||||
if not self._loaded:
|
||||
raise RuntimeError("DependencySet is not loaded.")
|
||||
raise RuntimeError('DependencySet is not loaded.')
|
||||
|
||||
rootdata = self.entries[self._root_dependency.get_hash()].component
|
||||
assert isinstance(rootdata, self._root_dependency.cls)
|
||||
@ -377,7 +377,7 @@ class TestClassFactory(DependencyComponent):
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
print("Instantiating TestClassFactory")
|
||||
print('Instantiating TestClassFactory')
|
||||
self.tex = self._assets.gettexture('black')
|
||||
self.model = self._assets.getmodel('landMine')
|
||||
self.sound = self._assets.getsound('error')
|
||||
@ -396,7 +396,7 @@ class TestClass(DependencyComponent):
|
||||
_factoryclass2 = Dependency(TestClassFactory, 123)
|
||||
|
||||
def __del__(self) -> None:
|
||||
print("~TestClass()")
|
||||
print('~TestClass()')
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
@ -430,7 +430,7 @@ def test_depset() -> None:
|
||||
depset.load()
|
||||
testobj = depset.root
|
||||
# instance = testclass(123)
|
||||
print("INSTANTIATED ROOT:", testobj)
|
||||
print('INSTANTIATED ROOT:', testobj)
|
||||
|
||||
doit()
|
||||
|
||||
|
||||
@ -150,7 +150,7 @@ def print_exception(*args: Any, **keywds: Any) -> None:
|
||||
if keywds:
|
||||
allowed_keywds = ['once']
|
||||
if any(keywd not in allowed_keywds for keywd in keywds):
|
||||
raise Exception("invalid keyword(s)")
|
||||
raise Exception('invalid keyword(s)')
|
||||
try:
|
||||
# If we're only printing once and already have, bail.
|
||||
if keywds.get('once', False):
|
||||
|
||||
@ -255,7 +255,7 @@ class GameActivity(Activity):
|
||||
"""
|
||||
from ba import _map
|
||||
del sessiontype # unused arg
|
||||
return _map.getmaps("melee")
|
||||
return _map.getmaps('melee')
|
||||
|
||||
@classmethod
|
||||
def get_config_display_string(cls, config: Dict[str, Any]) -> ba.Lstr:
|
||||
@ -270,14 +270,14 @@ class GameActivity(Activity):
|
||||
# In newer configs, map is in settings; it used to be in the
|
||||
# config root.
|
||||
if 'map' in config['settings']:
|
||||
sval = Lstr(value="${NAME} @ ${MAP}",
|
||||
sval = Lstr(value='${NAME} @ ${MAP}',
|
||||
subs=[('${NAME}', name),
|
||||
('${MAP}',
|
||||
_map.get_map_display_string(
|
||||
_map.get_filtered_map_name(
|
||||
config['settings']['map'])))])
|
||||
elif 'map' in config:
|
||||
sval = Lstr(value="${NAME} @ ${MAP}",
|
||||
sval = Lstr(value='${NAME} @ ${MAP}',
|
||||
subs=[('${NAME}', name),
|
||||
('${MAP}',
|
||||
_map.get_map_display_string(
|
||||
@ -327,7 +327,7 @@ class GameActivity(Activity):
|
||||
]
|
||||
if not valid_maps:
|
||||
_ba.screenmessage(Lstr(resource='noValidMapsErrorText'))
|
||||
raise Exception("No valid maps")
|
||||
raise Exception('No valid maps')
|
||||
map_name = valid_maps[random.randrange(len(valid_maps))]
|
||||
self._map_type = _map.get_map_class(map_name)
|
||||
self._map_type.preload()
|
||||
@ -544,7 +544,7 @@ class GameActivity(Activity):
|
||||
|
||||
except Exception:
|
||||
from ba import _error
|
||||
_error.print_exception("error continuing game")
|
||||
_error.print_exception('error continuing game')
|
||||
|
||||
self.end_game()
|
||||
|
||||
@ -613,7 +613,7 @@ class GameActivity(Activity):
|
||||
self._game_begin_analytics()
|
||||
except Exception:
|
||||
from ba import _error
|
||||
_error.print_exception("error in game-begin-analytics")
|
||||
_error.print_exception('error in game-begin-analytics')
|
||||
|
||||
# We don't do this in on_transition_in because it may depend on
|
||||
# players/teams which aren't available until now.
|
||||
@ -720,7 +720,7 @@ class GameActivity(Activity):
|
||||
else:
|
||||
sb_desc_l = sb_desc_in
|
||||
if not isinstance(sb_desc_l[0], str):
|
||||
raise Exception("Invalid format for instance description")
|
||||
raise Exception('Invalid format for instance description')
|
||||
|
||||
is_empty = (sb_desc_l[0] == '')
|
||||
subs = []
|
||||
@ -737,14 +737,14 @@ class GameActivity(Activity):
|
||||
sbpos = ((15, yval) if isinstance(self.session, FreeForAllSession) else
|
||||
(15, yval))
|
||||
self._game_scoreboard_name_text = NodeActor(
|
||||
_ba.newnode("text",
|
||||
_ba.newnode('text',
|
||||
attrs={
|
||||
'text': sb_name,
|
||||
'maxwidth': 300,
|
||||
'position': sbpos,
|
||||
'h_attach': "left",
|
||||
'h_attach': 'left',
|
||||
'vr_depth': 10,
|
||||
'v_attach': "top",
|
||||
'v_attach': 'top',
|
||||
'v_align': 'bottom',
|
||||
'color': (1.0, 1.0, 1.0, 1.0),
|
||||
'shadow': 1.0 if vrmode else 0.6,
|
||||
@ -763,14 +763,14 @@ class GameActivity(Activity):
|
||||
(17, -44 + 10)))
|
||||
self._game_scoreboard_description_text = NodeActor(
|
||||
_ba.newnode(
|
||||
"text",
|
||||
'text',
|
||||
attrs={
|
||||
'text': sb_desc,
|
||||
'maxwidth': 480,
|
||||
'position': descpos,
|
||||
'scale': 0.7,
|
||||
'h_attach': "left",
|
||||
'v_attach': "top",
|
||||
'h_attach': 'left',
|
||||
'v_attach': 'top',
|
||||
'v_align': 'top',
|
||||
'shadow': 1.0 if vrmode else 0.7,
|
||||
'flatness': 1.0 if vrmode else 0.8,
|
||||
@ -808,7 +808,7 @@ class GameActivity(Activity):
|
||||
else:
|
||||
desc_l = desc_in
|
||||
if not isinstance(desc_l[0], str):
|
||||
raise Exception("Invalid format for instance description")
|
||||
raise Exception('Invalid format for instance description')
|
||||
subs = []
|
||||
for i in range(len(desc_l) - 1):
|
||||
subs.append(('${ARG' + str(i + 1) + '}', str(desc_l[i + 1])))
|
||||
@ -834,7 +834,7 @@ class GameActivity(Activity):
|
||||
'maxwidth': 700,
|
||||
'text': translation
|
||||
})
|
||||
cnode = _ba.newnode("combine",
|
||||
cnode = _ba.newnode('combine',
|
||||
owner=dnode,
|
||||
attrs={
|
||||
'input0': 1.0,
|
||||
@ -844,7 +844,7 @@ class GameActivity(Activity):
|
||||
})
|
||||
cnode.connectattr('output', dnode, 'color')
|
||||
keys = {0.5: 0, 1.0: 1.0, 2.5: 1.0, 4.0: 0.0}
|
||||
animate(cnode, "input3", keys)
|
||||
animate(cnode, 'input3', keys)
|
||||
_ba.timer(4.0, dnode.delete)
|
||||
|
||||
def _show_tip(self) -> None:
|
||||
@ -924,7 +924,7 @@ class GameActivity(Activity):
|
||||
if sound is not None:
|
||||
_ba.playsound(sound)
|
||||
|
||||
combine = _ba.newnode("combine",
|
||||
combine = _ba.newnode('combine',
|
||||
owner=tnode,
|
||||
attrs={
|
||||
'input0': 1.0,
|
||||
@ -1201,9 +1201,9 @@ class GameActivity(Activity):
|
||||
attrs={'size': 4})
|
||||
cnode.connectattr('output',
|
||||
self._standard_time_limit_text.node, 'color')
|
||||
animate(cnode, "input0", {0: 1, 0.15: 1}, loop=True)
|
||||
animate(cnode, "input1", {0: 1, 0.15: 0.5}, loop=True)
|
||||
animate(cnode, "input2", {0: 0.1, 0.15: 0.0}, loop=True)
|
||||
animate(cnode, 'input0', {0: 1, 0.15: 1}, loop=True)
|
||||
animate(cnode, 'input1', {0: 1, 0.15: 0.5}, loop=True)
|
||||
animate(cnode, 'input2', {0: 0.1, 0.15: 0.0}, loop=True)
|
||||
cnode.input3 = 1.0
|
||||
_ba.playsound(_ba.getsound('tick'))
|
||||
if self._standard_time_limit_time <= 0:
|
||||
@ -1220,7 +1220,7 @@ class GameActivity(Activity):
|
||||
'text': Lstr(resource='timeExpiredText')
|
||||
})
|
||||
_ba.playsound(_ba.getsound('refWhistle'))
|
||||
animate(node, "scale", {0.0: 0.0, 0.1: 1.4, 0.15: 1.2})
|
||||
animate(node, 'scale', {0.0: 0.0, 0.1: 1.4, 0.15: 1.2})
|
||||
|
||||
def _setup_tournament_time_limit(self, duration: float) -> None:
|
||||
"""
|
||||
@ -1308,9 +1308,9 @@ class GameActivity(Activity):
|
||||
cnode.connectattr('output',
|
||||
self._tournament_time_limit_text.node,
|
||||
'color')
|
||||
animate(cnode, "input0", {0: 1, 0.15: 1}, loop=True)
|
||||
animate(cnode, "input1", {0: 1, 0.15: 0.5}, loop=True)
|
||||
animate(cnode, "input2", {0: 0.1, 0.15: 0.0}, loop=True)
|
||||
animate(cnode, 'input0', {0: 1, 0.15: 1}, loop=True)
|
||||
animate(cnode, 'input1', {0: 1, 0.15: 0.5}, loop=True)
|
||||
animate(cnode, 'input2', {0: 0.1, 0.15: 0.0}, loop=True)
|
||||
cnode.input3 = 1.0
|
||||
_ba.playsound(_ba.getsound('tick'))
|
||||
if self._tournament_time_limit <= 0:
|
||||
@ -1329,7 +1329,7 @@ class GameActivity(Activity):
|
||||
'text': tval
|
||||
})
|
||||
_ba.playsound(_ba.getsound('refWhistle'))
|
||||
animate(node, "scale", {0: 0.0, 0.1: 1.4, 0.15: 1.2})
|
||||
animate(node, 'scale', {0: 0.0, 0.1: 1.4, 0.15: 1.2})
|
||||
|
||||
# Normally we just connect this to time, but since this is a bit of a
|
||||
# funky setup we just update it manually once per second.
|
||||
|
||||
@ -64,7 +64,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 TeamGameResults.')
|
||||
self._game_set = True
|
||||
self._teams = [weakref.ref(team) for team in game.teams]
|
||||
score_info = game.get_resolved_score_info()
|
||||
|
||||
@ -156,10 +156,10 @@ def sharedobj(name: str) -> Any:
|
||||
if name == 'globals':
|
||||
obj = _ba.newnode('sessionglobals')
|
||||
else:
|
||||
raise Exception("unrecognized shared object "
|
||||
raise Exception('unrecognized shared object '
|
||||
"(session context): '" + name + "'")
|
||||
else:
|
||||
raise Exception("no current activity or session context")
|
||||
raise Exception('no current activity or session context')
|
||||
|
||||
# Ok, got a shiny new shared obj; store it for quick access next time.
|
||||
sharedobjs[name] = obj
|
||||
@ -188,7 +188,7 @@ def animate(node: ba.Node,
|
||||
if timetype is TimeType.SIM:
|
||||
driver = 'time'
|
||||
else:
|
||||
raise Exception("FIXME; only SIM timetype is supported currently.")
|
||||
raise Exception('FIXME; only SIM timetype is supported currently.')
|
||||
items = list(keys.items())
|
||||
items.sort()
|
||||
|
||||
@ -200,7 +200,7 @@ def animate(node: ba.Node,
|
||||
# noinspection PyUnresolvedReferences
|
||||
_ba.time_format_check(timeformat, item[0])
|
||||
|
||||
curve = _ba.newnode("animcurve",
|
||||
curve = _ba.newnode('animcurve',
|
||||
owner=node,
|
||||
name='Driving ' + str(node) + ' \'' + attr + '\'')
|
||||
|
||||
@ -230,8 +230,8 @@ def animate(node: ba.Node,
|
||||
|
||||
# Do the connects last so all our attrs are in place when we push initial
|
||||
# values through.
|
||||
sharedobj('globals').connectattr(driver, curve, "in")
|
||||
curve.connectattr("out", node, attr)
|
||||
sharedobj('globals').connectattr(driver, curve, 'in')
|
||||
curve.connectattr('out', node, attr)
|
||||
return curve
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ def animate_array(node: ba.Node,
|
||||
if timetype is TimeType.SIM:
|
||||
driver = 'time'
|
||||
else:
|
||||
raise Exception("FIXME: Only SIM timetype is supported currently.")
|
||||
raise Exception('FIXME: Only SIM timetype is supported currently.')
|
||||
items = list(keys.items())
|
||||
items.sort()
|
||||
|
||||
@ -275,17 +275,17 @@ def animate_array(node: ba.Node,
|
||||
raise Exception('invalid timeformat value: "' + str(timeformat) + '"')
|
||||
|
||||
for i in range(size):
|
||||
curve = _ba.newnode("animcurve",
|
||||
curve = _ba.newnode('animcurve',
|
||||
owner=node,
|
||||
name=('Driving ' + str(node) + ' \'' + attr +
|
||||
'\' member ' + str(i)))
|
||||
sharedobj('globals').connectattr(driver, curve, "in")
|
||||
sharedobj('globals').connectattr(driver, curve, 'in')
|
||||
curve.times = [int(mult * time) for time, val in items]
|
||||
curve.values = [val[i] for time, val in items]
|
||||
curve.offset = _ba.time(timeformat=TimeFormat.MILLISECONDS) + int(
|
||||
mult * offset)
|
||||
curve.loop = loop
|
||||
curve.connectattr("out", combine, 'input' + str(i))
|
||||
curve.connectattr('out', combine, 'input' + str(i))
|
||||
|
||||
# If we're not looping, set a timer to kill this
|
||||
# curve after its done its job.
|
||||
@ -333,7 +333,7 @@ def show_damage_count(damage: str, position: Sequence[float],
|
||||
'scale': 0.015 if do_big else 0.01
|
||||
})
|
||||
# Translate upward.
|
||||
tcombine = _ba.newnode("combine", owner=txtnode, attrs={'size': 3})
|
||||
tcombine = _ba.newnode('combine', owner=txtnode, attrs={'size': 3})
|
||||
tcombine.connectattr('output', txtnode, 'position')
|
||||
v_vals = []
|
||||
pval = 0.0
|
||||
@ -345,17 +345,17 @@ def show_damage_count(damage: str, position: Sequence[float],
|
||||
vval *= 0.5
|
||||
p_start = position[0]
|
||||
p_dir = direction[0]
|
||||
animate(tcombine, "input0",
|
||||
animate(tcombine, 'input0',
|
||||
{i[0] * lifespan: p_start + p_dir * i[1]
|
||||
for i in v_vals})
|
||||
p_start = position[1]
|
||||
p_dir = direction[1]
|
||||
animate(tcombine, "input1",
|
||||
animate(tcombine, 'input1',
|
||||
{i[0] * lifespan: p_start + p_dir * i[1]
|
||||
for i in v_vals})
|
||||
p_start = position[2]
|
||||
p_dir = direction[2]
|
||||
animate(tcombine, "input2",
|
||||
animate(tcombine, 'input2',
|
||||
{i[0] * lifespan: p_start + p_dir * i[1]
|
||||
for i in v_vals})
|
||||
animate(txtnode, 'opacity', {0.7 * lifespan: 1.0, lifespan: 0.0})
|
||||
@ -456,7 +456,7 @@ def cameraflash(duration: float = 999.0) -> None:
|
||||
activity.camera_flash_data = [] # type: ignore
|
||||
for i in range(6):
|
||||
light = NodeActor(
|
||||
_ba.newnode("light",
|
||||
_ba.newnode('light',
|
||||
attrs={
|
||||
'position': (positions[i][0], 0, positions[i][1]),
|
||||
'radius': 1.0,
|
||||
@ -466,7 +466,7 @@ def cameraflash(duration: float = 999.0) -> None:
|
||||
}))
|
||||
sval = 1.87
|
||||
iscale = 1.3
|
||||
tcombine = _ba.newnode("combine",
|
||||
tcombine = _ba.newnode('combine',
|
||||
owner=light.node,
|
||||
attrs={
|
||||
'size': 3,
|
||||
@ -497,7 +497,7 @@ def cameraflash(duration: float = 999.0) -> None:
|
||||
},
|
||||
loop=True)
|
||||
animate(light.node,
|
||||
"intensity", {
|
||||
'intensity', {
|
||||
0.0: 0,
|
||||
0.02 * sval: 0,
|
||||
0.05 * sval: 0.8 * iscale,
|
||||
|
||||
@ -269,7 +269,7 @@ def read_config() -> None:
|
||||
def ui_remote_press() -> None:
|
||||
"""Handle a press by a remote device that is only usable for nav."""
|
||||
from ba._lang import Lstr
|
||||
_ba.screenmessage(Lstr(resource="internal.controllerForMenusOnlyText"),
|
||||
_ba.screenmessage(Lstr(resource='internal.controllerForMenusOnlyText'),
|
||||
color=(1, 0, 0))
|
||||
_ba.playsound(_ba.getsound('error'))
|
||||
|
||||
|
||||
@ -48,14 +48,14 @@ def get_device_value(device: ba.InputDevice, name: str) -> Any:
|
||||
bs_config = _ba.app.config
|
||||
|
||||
# If there's an entry in our config for this controller, use it.
|
||||
if "Controllers" in bs_config:
|
||||
ccfgs = bs_config["Controllers"]
|
||||
if 'Controllers' in bs_config:
|
||||
ccfgs = bs_config['Controllers']
|
||||
if devicename in ccfgs:
|
||||
mapping = None
|
||||
if unique_id in ccfgs[devicename]:
|
||||
mapping = ccfgs[devicename][unique_id]
|
||||
elif "default" in ccfgs[devicename]:
|
||||
mapping = ccfgs[devicename]["default"]
|
||||
elif 'default' in ccfgs[devicename]:
|
||||
mapping = ccfgs[devicename]['default']
|
||||
if mapping is not None:
|
||||
return mapping.get(name, -1)
|
||||
|
||||
@ -375,7 +375,7 @@ def get_device_value(device: ba.InputDevice, name: str) -> Any:
|
||||
'triggerRun1': 18
|
||||
}.get(name, -1)
|
||||
|
||||
if devicename == "virtual-remote":
|
||||
if devicename == 'virtual-remote':
|
||||
return {
|
||||
'triggerRun2': 19,
|
||||
'unassignedButtonsRun': False,
|
||||
@ -602,7 +602,7 @@ def get_input_device_config(device: ba.InputDevice,
|
||||
"""
|
||||
cfg = _ba.app.config
|
||||
name = device.name
|
||||
ccfgs: Dict[str, Any] = cfg.setdefault("Controllers", {})
|
||||
ccfgs: Dict[str, Any] = cfg.setdefault('Controllers', {})
|
||||
ccfgs.setdefault(name, {})
|
||||
unique_id = device.unique_identifier
|
||||
if default:
|
||||
|
||||
@ -466,5 +466,5 @@ def is_custom_unicode_char(char: str) -> bool:
|
||||
"""Return whether a char is in the custom unicode range we use."""
|
||||
assert isinstance(char, str)
|
||||
if len(char) != 1:
|
||||
raise Exception("Invalid Input; must be length 1")
|
||||
raise Exception('Invalid Input; must be length 1')
|
||||
return 0xE000 <= ord(char) <= 0xF8FF
|
||||
|
||||
@ -105,7 +105,7 @@ class Level:
|
||||
Campaign.
|
||||
"""
|
||||
if self._index is None:
|
||||
raise RuntimeError("Level is not part of a Campaign")
|
||||
raise RuntimeError('Level is not part of a Campaign')
|
||||
return self._index
|
||||
|
||||
@property
|
||||
@ -170,7 +170,7 @@ class Level:
|
||||
can be modified in place."""
|
||||
campaign = self.get_campaign()
|
||||
if campaign is None:
|
||||
raise Exception("level is not in a campaign")
|
||||
raise Exception('level is not in a campaign')
|
||||
campaign_config = campaign.get_config_dict()
|
||||
val: Dict[str,
|
||||
Any] = campaign_config.setdefault(self._name, {
|
||||
|
||||
@ -669,7 +669,7 @@ class Chooser:
|
||||
# If we've been removed from the lobby, ignore this stuff.
|
||||
if self._dead:
|
||||
from ba import _error
|
||||
_error.print_error("chooser got ChangeMessage after dying")
|
||||
_error.print_error('chooser got ChangeMessage after dying')
|
||||
return
|
||||
|
||||
if not self._text_node:
|
||||
|
||||
@ -156,7 +156,7 @@ class Map(Actor):
|
||||
functionality comprising a game map.
|
||||
"""
|
||||
defs: Any = None
|
||||
name = "Map"
|
||||
name = 'Map'
|
||||
_playtypes: List[str] = []
|
||||
|
||||
@classmethod
|
||||
@ -226,14 +226,14 @@ class Map(Actor):
|
||||
gnode = _gameutils.sharedobj('globals')
|
||||
|
||||
# Set area-of-interest bounds.
|
||||
aoi_bounds = self.get_def_bound_box("area_of_interest_bounds")
|
||||
aoi_bounds = self.get_def_bound_box('area_of_interest_bounds')
|
||||
if aoi_bounds is None:
|
||||
print('WARNING: no "aoi_bounds" found for map:', self.get_name())
|
||||
aoi_bounds = (-1, -1, -1, 1, 1, 1)
|
||||
gnode.area_of_interest_bounds = aoi_bounds
|
||||
|
||||
# Set map bounds.
|
||||
map_bounds = self.get_def_bound_box("map_bounds")
|
||||
map_bounds = self.get_def_bound_box('map_bounds')
|
||||
if map_bounds is None:
|
||||
print('WARNING: no "map_bounds" found for map:', self.get_name())
|
||||
map_bounds = (-30, -10, -30, 30, 100, 30)
|
||||
@ -268,7 +268,7 @@ class Map(Actor):
|
||||
or [(0, 0, 0, 0, 0, 0)])
|
||||
self.spawn_by_flag_points = (self.get_def_points('spawn_by_flag')
|
||||
or [(0, 0, 0, 0, 0, 0)])
|
||||
self.flag_points = self.get_def_points("flag") or [(0, 0, 0)]
|
||||
self.flag_points = self.get_def_points('flag') or [(0, 0, 0)]
|
||||
|
||||
# We just want points.
|
||||
self.flag_points = [p[:3] for p in self.flag_points]
|
||||
@ -282,7 +282,7 @@ class Map(Actor):
|
||||
self.powerup_spawn_points = ([
|
||||
p[:3] for p in self.powerup_spawn_points
|
||||
])
|
||||
self.tnt_points = self.get_def_points("tnt") or []
|
||||
self.tnt_points = self.get_def_points('tnt') or []
|
||||
|
||||
# We just want points.
|
||||
self.tnt_points = [p[:3] for p in self.tnt_points]
|
||||
@ -331,7 +331,7 @@ class Map(Actor):
|
||||
If none are defined, returns an empty list.
|
||||
"""
|
||||
point_list = []
|
||||
if self.defs and name + "1" in self.defs.points:
|
||||
if self.defs and name + '1' in self.defs.points:
|
||||
i = 1
|
||||
while name + str(i) in self.defs.points:
|
||||
pts = self.defs.points[name + str(i)]
|
||||
@ -339,7 +339,7 @@ class Map(Actor):
|
||||
point_list.append(pts)
|
||||
else:
|
||||
if len(pts) != 3:
|
||||
raise Exception("invalid point")
|
||||
raise Exception('invalid point')
|
||||
point_list.append(pts + (0, 0, 0))
|
||||
i += 1
|
||||
return point_list
|
||||
@ -427,5 +427,5 @@ class Map(Actor):
|
||||
def register_map(maptype: Type[Map]) -> None:
|
||||
"""Register a map class with the game."""
|
||||
if maptype.name in _ba.app.maps:
|
||||
raise Exception("map \"" + maptype.name + "\" already registered")
|
||||
raise Exception('map "' + maptype.name + '" already registered')
|
||||
_ba.app.maps[maptype.name] = maptype
|
||||
|
||||
@ -360,5 +360,5 @@ def get_unowned_game_types() -> Set[Type[ba.GameActivity]]:
|
||||
return unowned_games
|
||||
except Exception:
|
||||
from ba import _error
|
||||
_error.print_exception("error calcing un-owned games")
|
||||
_error.print_exception('error calcing un-owned games')
|
||||
return set()
|
||||
|
||||
@ -112,22 +112,22 @@ def create_user_system_scripts() -> None:
|
||||
path = (app.python_directory_user + '/sys/' + app.version)
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
if os.path.exists(path + "_tmp"):
|
||||
shutil.rmtree(path + "_tmp")
|
||||
if os.path.exists(path + '_tmp'):
|
||||
shutil.rmtree(path + '_tmp')
|
||||
os.makedirs(path + '_tmp', exist_ok=True)
|
||||
|
||||
# Hmm; shutil.copytree doesn't seem to work nicely on android,
|
||||
# so lets do it manually.
|
||||
# NOTE: Should retry this now that we have 3.7 (this note was for 2.7)
|
||||
src_dir = app.python_directory_ba
|
||||
dst_dir = path + "_tmp"
|
||||
dst_dir = path + '_tmp'
|
||||
filenames = os.listdir(app.python_directory_ba)
|
||||
for fname in filenames:
|
||||
print('COPYING', src_dir + '/' + fname, '->', dst_dir)
|
||||
shutil.copyfile(src_dir + '/' + fname, dst_dir + '/' + fname)
|
||||
|
||||
print('MOVING', path + "_tmp", path)
|
||||
shutil.move(path + "_tmp", path)
|
||||
print('MOVING', path + '_tmp', path)
|
||||
shutil.move(path + '_tmp', path)
|
||||
print(
|
||||
('Created system scripts at :\'' + path +
|
||||
'\'\nRestart Ballistica to use them. (use ba.quit() to exit the game)'
|
||||
|
||||
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||
import ba
|
||||
|
||||
DEFAULT_TEAM_COLORS = ((0.1, 0.25, 1.0), (1.0, 0.25, 0.2))
|
||||
DEFAULT_TEAM_NAMES = ("Blue", "Red")
|
||||
DEFAULT_TEAM_NAMES = ('Blue', 'Red')
|
||||
|
||||
|
||||
class MultiTeamSession(Session):
|
||||
@ -117,7 +117,7 @@ class MultiTeamSession(Session):
|
||||
add_resolved_type=True)
|
||||
|
||||
if not playlist_resolved:
|
||||
raise RuntimeError("Playlist contains no valid games.")
|
||||
raise RuntimeError('Playlist contains no valid games.')
|
||||
|
||||
self._playlist = ShuffleList(playlist_resolved,
|
||||
shuffle=self._playlist_randomize)
|
||||
@ -263,7 +263,7 @@ class MultiTeamSession(Session):
|
||||
from ba._freeforallsession import FreeForAllSession
|
||||
from ba._messages import CelebrateMessage
|
||||
_ba.timer(delay,
|
||||
_general.Call(_ba.playsound, _ba.getsound("boxingBell")))
|
||||
_general.Call(_ba.playsound, _ba.getsound('boxingBell')))
|
||||
if announce_winning_team:
|
||||
winning_team = results.get_winning_team()
|
||||
if winning_team is not None:
|
||||
|
||||
@ -191,7 +191,7 @@ class MusicController:
|
||||
"""Returns the system music player, instantiating if necessary."""
|
||||
if self._music_player is None:
|
||||
if self._music_player_type is None:
|
||||
raise Exception("no music player type set")
|
||||
raise Exception('no music player type set')
|
||||
self._music_player = self._music_player_type()
|
||||
return self._music_player
|
||||
|
||||
@ -248,11 +248,11 @@ class MusicController:
|
||||
and isinstance(entry['name'], str)):
|
||||
entry_type = entry['type']
|
||||
else:
|
||||
raise Exception("invalid soundtrack entry: " + str(entry) +
|
||||
" (type " + str(type(entry)) + ")")
|
||||
raise Exception('invalid soundtrack entry: ' + str(entry) +
|
||||
' (type ' + str(type(entry)) + ')')
|
||||
if self.supports_soundtrack_entry_type(entry_type):
|
||||
return entry_type
|
||||
raise Exception("invalid soundtrack entry:" + str(entry))
|
||||
raise Exception('invalid soundtrack entry:' + str(entry))
|
||||
except Exception as exc:
|
||||
print('EXC on get_soundtrack_entry_type', exc)
|
||||
return 'default'
|
||||
@ -272,7 +272,7 @@ class MusicController:
|
||||
and isinstance(entry['type'], str) and 'name' in entry
|
||||
and isinstance(entry['name'], str)):
|
||||
return entry['name']
|
||||
raise Exception("invalid soundtrack entry:" + str(entry))
|
||||
raise Exception('invalid soundtrack entry:' + str(entry))
|
||||
except Exception:
|
||||
from ba import _error
|
||||
_error.print_exception()
|
||||
@ -352,7 +352,7 @@ class MusicController:
|
||||
try:
|
||||
soundtrack = cfg.get('Soundtracks', {})[soundtrackname]
|
||||
except Exception as exc:
|
||||
print(f"Error looking up user soundtrack: {exc}")
|
||||
print(f'Error looking up user soundtrack: {exc}')
|
||||
soundtrack = {}
|
||||
return soundtrack
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ def get_ip_address_type(addr: str) -> socket.AddressFamily:
|
||||
except OSError:
|
||||
pass
|
||||
if socket_type is None:
|
||||
raise Exception("addr seems to be neither v4 or v6: " + str(addr))
|
||||
raise Exception('addr seems to be neither v4 or v6: ' + str(addr))
|
||||
return socket_type
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ class ServerCallThread(threading.Thread):
|
||||
from ba import _general
|
||||
try:
|
||||
self._data = _general.utf8_all(self._data)
|
||||
_ba.set_thread_name("BA_ServerCallThread")
|
||||
_ba.set_thread_name('BA_ServerCallThread')
|
||||
|
||||
# Seems pycharm doesn't know about urllib.parse.
|
||||
# noinspection PyUnresolvedReferences
|
||||
@ -129,7 +129,7 @@ class ServerCallThread(threading.Thread):
|
||||
parse.urlencode(self._data).encode(),
|
||||
{'User-Agent': _ba.app.user_agent_string}))
|
||||
else:
|
||||
raise Exception("Invalid request_type: " + self._request_type)
|
||||
raise Exception('Invalid request_type: ' + self._request_type)
|
||||
|
||||
# If html request failed.
|
||||
if response.getcode() != 200:
|
||||
|
||||
@ -80,7 +80,7 @@ def filter_playlist(playlist: PlaylistType,
|
||||
# the actual game class. add successful ones to our initial list
|
||||
# to present to the user.
|
||||
if not isinstance(entry['type'], str):
|
||||
raise Exception("invalid entry format")
|
||||
raise Exception('invalid entry format')
|
||||
try:
|
||||
# Do some type filters for backwards compat.
|
||||
if entry['type'] in ('Assault.AssaultGame',
|
||||
|
||||
@ -179,7 +179,7 @@ class Session:
|
||||
self._activity_weak: ReferenceType[ba.Activity]
|
||||
self._activity_weak = weakref.ref(_EmptyObj()) # type: ignore
|
||||
if self._activity_weak() is not None:
|
||||
raise Exception("Error creating empty activity weak ref.")
|
||||
raise Exception('Error creating empty activity weak ref.')
|
||||
|
||||
self._next_activity: Optional[ba.Activity] = None
|
||||
self.wants_to_end = False
|
||||
@ -299,7 +299,7 @@ class Session:
|
||||
# Testing; can remove this eventually.
|
||||
if isinstance(self, FreeForAllSession):
|
||||
if len(team.players) != 1:
|
||||
_error.print_error("expected 1 player in FFA team")
|
||||
_error.print_error('expected 1 player in FFA team')
|
||||
team.players.remove(player)
|
||||
|
||||
# Remove player from any current activity.
|
||||
@ -316,7 +316,7 @@ class Session:
|
||||
'exception in on_player_leave for activity',
|
||||
activity)
|
||||
else:
|
||||
_error.print_error("expired activity in on_player_leave;"
|
||||
_error.print_error('expired activity in on_player_leave;'
|
||||
" shouldn't happen")
|
||||
|
||||
player.set_activity(None)
|
||||
@ -350,7 +350,7 @@ class Session:
|
||||
activity)
|
||||
else:
|
||||
_error.print_error(
|
||||
"expired activity in on_player_leave p2"
|
||||
'expired activity in on_player_leave p2'
|
||||
"; shouldn't happen")
|
||||
|
||||
# Clear the team's game-data (so dying stuff will
|
||||
@ -413,8 +413,8 @@ class Session:
|
||||
if since_last < 30.0:
|
||||
return
|
||||
_error.print_error(
|
||||
"launch_end_session_activity called twice (since_last=" +
|
||||
str(since_last) + ")")
|
||||
'launch_end_session_activity called twice (since_last=' +
|
||||
str(since_last) + ')')
|
||||
self.launch_end_session_activity_time = curtime
|
||||
self.set_activity(_ba.new_activity(EndSessionActivity))
|
||||
self.wants_to_end = False
|
||||
@ -505,7 +505,7 @@ class Session:
|
||||
# Sanity test: make sure this doesn't get called recursively.
|
||||
if self._in_set_activity:
|
||||
raise Exception(
|
||||
"Session.set_activity() cannot be called recursively.")
|
||||
'Session.set_activity() cannot be called recursively.')
|
||||
|
||||
if activity.session is not _ba.getsession():
|
||||
raise Exception("Provided Activity's Session is not current.")
|
||||
@ -515,12 +515,12 @@ class Session:
|
||||
return
|
||||
|
||||
if activity is self._activity_retained:
|
||||
_error.print_error("activity set to already-current activity")
|
||||
_error.print_error('activity set to already-current activity')
|
||||
return
|
||||
|
||||
if self._next_activity is not None:
|
||||
raise Exception("Activity switch already in progress (to " +
|
||||
str(self._next_activity) + ")")
|
||||
raise Exception('Activity switch already in progress (to ' +
|
||||
str(self._next_activity) + ')')
|
||||
|
||||
self._in_set_activity = True
|
||||
|
||||
@ -781,7 +781,7 @@ class Session:
|
||||
if pass_to_activity:
|
||||
if team in activity.teams:
|
||||
_error.print_error(
|
||||
"Duplicate team ID in ba.Session._add_chosen_player")
|
||||
'Duplicate team ID in ba.Session._add_chosen_player')
|
||||
activity.teams.append(team)
|
||||
try:
|
||||
with _ba.Context(activity):
|
||||
@ -799,7 +799,7 @@ class Session:
|
||||
if pass_to_activity:
|
||||
if isinstance(self, _freeforallsession.FreeForAllSession):
|
||||
if player.team.players:
|
||||
_error.print_error("expected 0 players in FFA team")
|
||||
_error.print_error('expected 0 players in FFA team')
|
||||
|
||||
# Don't actually add the player to their team list if we're not
|
||||
# in an activity. (players get (re)added to their team lists
|
||||
|
||||
@ -69,7 +69,7 @@ class Team:
|
||||
|
||||
def __init__(self,
|
||||
team_id: int = 0,
|
||||
name: Union[ba.Lstr, str] = "",
|
||||
name: Union[ba.Lstr, str] = '',
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0)):
|
||||
"""Instantiate a ba.Team.
|
||||
|
||||
|
||||
@ -165,5 +165,5 @@ class TeamGameActivity(GameActivity):
|
||||
delay = 0.0
|
||||
else:
|
||||
delay = 2.0
|
||||
_ba.timer(0.1, Call(_ba.playsound, _ba.getsound("boxingBell")))
|
||||
_ba.timer(0.1, Call(_ba.playsound, _ba.getsound('boxingBell')))
|
||||
super().end(results, delay=delay, force=force)
|
||||
|
||||
@ -88,7 +88,7 @@ class _MacMusicAppThread(threading.Thread):
|
||||
from ba._general import Call
|
||||
from ba._lang import Lstr
|
||||
from ba._enums import TimeType
|
||||
_ba.set_thread_name("BA_MacMusicAppThread")
|
||||
_ba.set_thread_name('BA_MacMusicAppThread')
|
||||
_ba.mac_music_app_init()
|
||||
|
||||
# Let's mention to the user we're launching Music.app in case
|
||||
@ -244,7 +244,7 @@ class _MacMusicAppThread(threading.Thread):
|
||||
except Exception:
|
||||
from ba import _error
|
||||
_error.print_exception(
|
||||
f"error playing playlist {self._current_playlist}")
|
||||
f'error playing playlist {self._current_playlist}')
|
||||
|
||||
def _update_mac_music_app_volume(self) -> None:
|
||||
_ba.mac_music_app_set_volume(
|
||||
|
||||
@ -124,7 +124,7 @@ class _PickFolderSongThread(threading.Thread):
|
||||
from ba import _lang
|
||||
from ba._general import Call
|
||||
try:
|
||||
_ba.set_thread_name("BA_PickFolderSongThread")
|
||||
_ba.set_thread_name('BA_PickFolderSongThread')
|
||||
all_files: List[str] = []
|
||||
valid_extensions = ['.' + x for x in self._valid_extensions]
|
||||
for root, _subdirs, filenames in os.walk(self._path):
|
||||
|
||||
@ -41,10 +41,10 @@ class CoopJoinActivity(JoinActivity):
|
||||
|
||||
# Let's show a list of scores-to-beat for 1 player at least.
|
||||
assert session.campaign is not None
|
||||
level_name_full = (session.campaign.name + ":" +
|
||||
level_name_full = (session.campaign.name + ':' +
|
||||
session.campaign_state['level'])
|
||||
config_str = (
|
||||
"1p" + session.campaign.get_level(session.campaign_state['level']).
|
||||
'1p' + session.campaign.get_level(session.campaign_state['level']).
|
||||
get_score_version_string().replace(' ', '_'))
|
||||
_ba.get_scores_to_beat(level_name_full, config_str,
|
||||
ba.WeakCall(self._on_got_scores_to_beat))
|
||||
@ -163,7 +163,7 @@ class CoopJoinActivity(JoinActivity):
|
||||
|
||||
# Now list our remaining achievements for this level.
|
||||
assert self.session.campaign is not None
|
||||
levelname = (self.session.campaign.name + ":" +
|
||||
levelname = (self.session.campaign.name + ':' +
|
||||
self.session.campaign_state['level'])
|
||||
ts_h_offs = 60
|
||||
|
||||
|
||||
@ -54,8 +54,8 @@ class CoopScoreScreen(ba.Activity):
|
||||
|
||||
self._do_new_rating: bool = self.session.tournament_id is not None
|
||||
|
||||
self._score_display_sound = ba.getsound("scoreHit01")
|
||||
self._score_display_sound_small = ba.getsound("scoreHit02")
|
||||
self._score_display_sound = ba.getsound('scoreHit01')
|
||||
self._score_display_sound_small = ba.getsound('scoreHit02')
|
||||
self.drum_roll_sound = ba.getsound('drumRoll')
|
||||
self.cymbal_sound = ba.getsound('cymbal')
|
||||
|
||||
@ -68,7 +68,7 @@ class CoopScoreScreen(ba.Activity):
|
||||
self._campaign: ba.Campaign = settings['campaign']
|
||||
|
||||
self._have_achievements = bool(
|
||||
get_achievements_for_coop_level(self._campaign.name + ":" +
|
||||
get_achievements_for_coop_level(self._campaign.name + ':' +
|
||||
settings['level']))
|
||||
|
||||
self._account_type = (_ba.get_account_type() if
|
||||
@ -149,7 +149,7 @@ class CoopScoreScreen(ba.Activity):
|
||||
self._score_order: str
|
||||
if 'score_order' in settings:
|
||||
if not settings['score_order'] in ['increasing', 'decreasing']:
|
||||
raise Exception("Invalid score order: " +
|
||||
raise Exception('Invalid score order: ' +
|
||||
settings['score_order'])
|
||||
self._score_order = settings['score_order']
|
||||
else:
|
||||
@ -159,7 +159,7 @@ class CoopScoreScreen(ba.Activity):
|
||||
self._score_type: str
|
||||
if 'score_type' in settings:
|
||||
if not settings['score_type'] in ['points', 'time']:
|
||||
raise Exception("Invalid score type: " +
|
||||
raise Exception('Invalid score type: ' +
|
||||
settings['score_type'])
|
||||
self._score_type = settings['score_type']
|
||||
else:
|
||||
@ -169,9 +169,9 @@ class CoopScoreScreen(ba.Activity):
|
||||
self._level_name: str = settings['level']
|
||||
assert isinstance(self._level_name, str)
|
||||
|
||||
self._game_name_str = self._campaign.name + ":" + self._level_name
|
||||
self._game_name_str = self._campaign.name + ':' + self._level_name
|
||||
self._game_config_str = str(len(
|
||||
self._player_info)) + "p" + self._campaign.get_level(
|
||||
self._player_info)) + 'p' + self._campaign.get_level(
|
||||
self._level_name).get_score_version_string().replace(' ', '_')
|
||||
|
||||
# If game-center/etc scores are available we show our friends'
|
||||
@ -540,7 +540,7 @@ class CoopScoreScreen(ba.Activity):
|
||||
# as current.
|
||||
if self._newly_complete:
|
||||
cfg = ba.app.config
|
||||
cfg['Selected Coop Game'] = (self._campaign.name + ":" +
|
||||
cfg['Selected Coop Game'] = (self._campaign.name + ':' +
|
||||
self._next_level_name)
|
||||
cfg.commit()
|
||||
self._campaign.set_selected_level(self._next_level_name)
|
||||
@ -660,10 +660,10 @@ class CoopScoreScreen(ba.Activity):
|
||||
self._level_name).get_high_scores()
|
||||
try:
|
||||
our_high_scores = our_high_scores_all[str(len(self._player_info)) +
|
||||
" Player"]
|
||||
' Player']
|
||||
except Exception:
|
||||
our_high_scores = our_high_scores_all[str(len(self._player_info)) +
|
||||
" Player"] = []
|
||||
' Player'] = []
|
||||
|
||||
if self._score is not None:
|
||||
our_score: Optional[list] = [
|
||||
@ -1027,7 +1027,7 @@ class CoopScoreScreen(ba.Activity):
|
||||
self._score_link = results['link']
|
||||
assert self._score_link is not None
|
||||
if not self._score_link.startswith('http://'):
|
||||
self._score_link = (_ba.get_master_server_address() + "/" +
|
||||
self._score_link = (_ba.get_master_server_address() + '/' +
|
||||
self._score_link)
|
||||
self._score_loading_status = None
|
||||
if 'tournamentSecondsRemaining' in results:
|
||||
@ -1250,7 +1250,7 @@ class CoopScoreScreen(ba.Activity):
|
||||
transition_delay=2.0).autoretain()
|
||||
vval -= 35
|
||||
except Exception:
|
||||
ba.print_exception("error showing prize ranges")
|
||||
ba.print_exception('error showing prize ranges')
|
||||
|
||||
if self._do_new_rating:
|
||||
if error:
|
||||
|
||||
@ -37,8 +37,8 @@ class MultiTeamScoreScreenActivity(ScoreScreenActivity):
|
||||
|
||||
def __init__(self, settings: Dict[str, Any]):
|
||||
super().__init__(settings=settings)
|
||||
self._score_display_sound = ba.getsound("scoreHit01")
|
||||
self._score_display_sound_small = ba.getsound("scoreHit02")
|
||||
self._score_display_sound = ba.getsound('scoreHit01')
|
||||
self._score_display_sound_small = ba.getsound('scoreHit02')
|
||||
|
||||
self._show_up_next: bool = True
|
||||
|
||||
|
||||
@ -109,13 +109,13 @@ class Background(ba.Actor):
|
||||
for _i in range(10):
|
||||
keys[timeval] = (random.random() - 0.5) * 0.0015
|
||||
timeval += random.random() * 0.1
|
||||
ba.animate(cmb, "input0", keys, loop=True)
|
||||
ba.animate(cmb, 'input0', keys, loop=True)
|
||||
keys = {}
|
||||
timeval = 0.0
|
||||
for _i in range(10):
|
||||
keys[timeval] = (random.random() - 0.5) * 0.0015 + 0.05
|
||||
timeval += random.random() * 0.1
|
||||
ba.animate(cmb, "input1", keys, loop=True)
|
||||
ba.animate(cmb, 'input1', keys, loop=True)
|
||||
|
||||
def __del__(self) -> None:
|
||||
# Normal actors don't get sent DieMessages when their
|
||||
@ -132,8 +132,8 @@ class Background(ba.Actor):
|
||||
# since it was part of the session's scene.
|
||||
# Let's make sure that's the case.
|
||||
# (since otherwise we have no way to kill it)
|
||||
ba.print_error("got None session on Background _die"
|
||||
" (and node still exists!)")
|
||||
ba.print_error('got None session on Background _die'
|
||||
' (and node still exists!)')
|
||||
elif session is not None:
|
||||
with ba.Context(session):
|
||||
if not self._dying and self.node:
|
||||
@ -142,7 +142,7 @@ class Background(ba.Actor):
|
||||
self.node.delete()
|
||||
else:
|
||||
ba.animate(self.node,
|
||||
"opacity", {
|
||||
'opacity', {
|
||||
0.0: 1.0,
|
||||
self.fade_time: 0.0
|
||||
},
|
||||
|
||||
@ -318,7 +318,7 @@ class Blast(ba.Actor):
|
||||
position: Sequence[float] = (0.0, 1.0, 0.0),
|
||||
velocity: Sequence[float] = (0.0, 0.0, 0.0),
|
||||
blast_radius: float = 2.0,
|
||||
blast_type: str = "normal",
|
||||
blast_type: str = 'normal',
|
||||
source_player: ba.Player = None,
|
||||
hit_type: str = 'explosion',
|
||||
hit_subtype: str = 'normal'):
|
||||
@ -355,14 +355,14 @@ class Blast(ba.Actor):
|
||||
|
||||
# throw in an explosion and flash
|
||||
evel = (velocity[0], max(-1.0, velocity[1]), velocity[2])
|
||||
explosion = ba.newnode("explosion",
|
||||
explosion = ba.newnode('explosion',
|
||||
attrs={
|
||||
'position': position,
|
||||
'velocity': evel,
|
||||
'radius': self.radius,
|
||||
'big': (self.blast_type == 'tnt')
|
||||
})
|
||||
if self.blast_type == "ice":
|
||||
if self.blast_type == 'ice':
|
||||
explosion.color = (0, 0.05, 0.4)
|
||||
|
||||
ba.timer(1.0, explosion.delete)
|
||||
@ -535,7 +535,7 @@ class Blast(ba.Actor):
|
||||
|
||||
iscale = 1.6
|
||||
ba.animate(
|
||||
light, "intensity", {
|
||||
light, 'intensity', {
|
||||
0: 2.0 * iscale,
|
||||
scl * 0.02: 0.1 * iscale,
|
||||
scl * 0.025: 0.2 * iscale,
|
||||
@ -547,7 +547,7 @@ class Blast(ba.Actor):
|
||||
scl * 3.0: 0.0
|
||||
})
|
||||
ba.animate(
|
||||
light, "radius", {
|
||||
light, 'radius', {
|
||||
0: light_radius * 0.2,
|
||||
scl * 0.05: light_radius * 0.55,
|
||||
scl * 0.1: light_radius * 0.3,
|
||||
@ -566,7 +566,7 @@ class Blast(ba.Actor):
|
||||
if self.blast_type == 'ice':
|
||||
scorch.color = (1, 1, 1.5)
|
||||
|
||||
ba.animate(scorch, "presence", {3.000: 1, 13.000: 0})
|
||||
ba.animate(scorch, 'presence', {3.000: 1, 13.000: 0})
|
||||
ba.timer(13.0, scorch.delete)
|
||||
|
||||
if self.blast_type == 'ice':
|
||||
@ -602,7 +602,7 @@ class Blast(ba.Actor):
|
||||
self.node.delete()
|
||||
|
||||
elif isinstance(msg, ExplodeHitMessage):
|
||||
node = ba.get_collision_info("opposing_node")
|
||||
node = ba.get_collision_info('opposing_node')
|
||||
if node:
|
||||
assert self.node
|
||||
nodepos = self.node.position
|
||||
@ -624,7 +624,7 @@ class Blast(ba.Actor):
|
||||
hit_subtype=self.hit_subtype,
|
||||
radius=self.radius,
|
||||
source_player=self.source_player))
|
||||
if self.blast_type == "ice":
|
||||
if self.blast_type == 'ice':
|
||||
ba.playsound(get_factory().freeze_sound,
|
||||
10,
|
||||
position=nodepos)
|
||||
@ -664,7 +664,7 @@ class Bomb(ba.Actor):
|
||||
|
||||
if bomb_type not in ('ice', 'impact', 'land_mine', 'normal', 'sticky',
|
||||
'tnt'):
|
||||
raise Exception("invalid bomb type: " + bomb_type)
|
||||
raise Exception('invalid bomb type: ' + bomb_type)
|
||||
self.bomb_type = bomb_type
|
||||
|
||||
self._exploded = False
|
||||
@ -828,7 +828,7 @@ class Bomb(ba.Actor):
|
||||
ba.timer(fuse_time,
|
||||
ba.WeakCall(self.handlemessage, ExplodeMessage()))
|
||||
|
||||
ba.animate(self.node, "model_scale", {0: 0, 0.2: 1.3, 0.26: 1})
|
||||
ba.animate(self.node, 'model_scale', {0: 0, 0.2: 1.3, 0.26: 1})
|
||||
|
||||
def get_source_player(self) -> Optional[ba.Player]:
|
||||
"""Returns a ba.Player representing the source of this bomb.
|
||||
@ -849,7 +849,7 @@ class Bomb(ba.Actor):
|
||||
self.handlemessage(ba.DieMessage())
|
||||
|
||||
def _handle_impact(self) -> None:
|
||||
node = ba.get_collision_info("opposing_node")
|
||||
node = ba.get_collision_info('opposing_node')
|
||||
# if we're an impact bomb and we came from this node, don't explode...
|
||||
# alternately if we're hitting another impact-bomb from the same
|
||||
# source, don't explode...
|
||||
@ -882,7 +882,7 @@ class Bomb(ba.Actor):
|
||||
lambda: _safesetattr(self.node, 'stick_to_owner', True))
|
||||
|
||||
def _handle_splat(self) -> None:
|
||||
node = ba.get_collision_info("opposing_node")
|
||||
node = ba.get_collision_info('opposing_node')
|
||||
if (node is not self.owner
|
||||
and ba.time() - self._last_sticky_sound_time > 1.0):
|
||||
self._last_sticky_sound_time = ba.time()
|
||||
@ -1001,7 +1001,7 @@ class Bomb(ba.Actor):
|
||||
ba.WeakCall(self.handlemessage, ExplodeMessage()),
|
||||
timeformat=ba.TimeFormat.MILLISECONDS)
|
||||
assert self.node
|
||||
self.node.handlemessage("impulse", msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
self.node.handlemessage('impulse', msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
msg.velocity[0], msg.velocity[1],
|
||||
msg.velocity[2], msg.magnitude,
|
||||
msg.velocity_magnitude, msg.radius, 0,
|
||||
|
||||
@ -214,7 +214,7 @@ class Flag(ba.Actor):
|
||||
finalmaterials = (
|
||||
[ba.sharedobj('object_material'), factory.flagmaterial] +
|
||||
materials)
|
||||
self.node = ba.newnode("flag",
|
||||
self.node = ba.newnode('flag',
|
||||
attrs={
|
||||
'position':
|
||||
(position[0], position[1] + 0.75,
|
||||
@ -340,7 +340,7 @@ class Flag(ba.Actor):
|
||||
assert self.node
|
||||
assert msg.force_direction is not None
|
||||
self.node.handlemessage(
|
||||
"impulse", msg.pos[0], msg.pos[1], msg.pos[2], msg.velocity[0],
|
||||
'impulse', msg.pos[0], msg.pos[1], msg.pos[2], msg.velocity[0],
|
||||
msg.velocity[1], msg.velocity[2], msg.magnitude,
|
||||
msg.velocity_magnitude, msg.radius, 0, msg.force_direction[0],
|
||||
msg.force_direction[1], msg.force_direction[2])
|
||||
|
||||
@ -105,9 +105,9 @@ class OnScreenCountdown(ba.Actor):
|
||||
self.node.scale *= 1.2
|
||||
cmb = ba.newnode('combine', owner=self.node, attrs={'size': 4})
|
||||
cmb.connectattr('output', self.node, 'color')
|
||||
ba.animate(cmb, "input0", {0: 1.0, 0.15: 1.0}, loop=True)
|
||||
ba.animate(cmb, "input1", {0: 1.0, 0.15: 0.5}, loop=True)
|
||||
ba.animate(cmb, "input2", {0: 0.1, 0.15: 0.0}, loop=True)
|
||||
ba.animate(cmb, 'input0', {0: 1.0, 0.15: 1.0}, loop=True)
|
||||
ba.animate(cmb, 'input1', {0: 1.0, 0.15: 0.5}, loop=True)
|
||||
ba.animate(cmb, 'input2', {0: 0.1, 0.15: 0.0}, loop=True)
|
||||
cmb.input3 = 1.0
|
||||
if tval <= 10 and not self._ended:
|
||||
ba.playsound(ba.getsound('tick'))
|
||||
|
||||
@ -93,7 +93,7 @@ class PlayerSpaz(Spaz):
|
||||
def __init__(self,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
highlight: Sequence[float] = (0.5, 0.5, 0.5),
|
||||
character: str = "Spaz",
|
||||
character: str = 'Spaz',
|
||||
player: ba.Player = None,
|
||||
powerups_expire: bool = True):
|
||||
"""Create a spaz for the provided ba.Player.
|
||||
@ -233,7 +233,7 @@ class PlayerSpaz(Spaz):
|
||||
super().handlemessage(msg) # Augment standard behavior.
|
||||
self.held_count -= 1
|
||||
if self.held_count < 0:
|
||||
print("ERROR: spaz held_count < 0")
|
||||
print('ERROR: spaz held_count < 0')
|
||||
|
||||
# Let's count someone dropping us as an attack.
|
||||
try:
|
||||
|
||||
@ -105,21 +105,21 @@ class PowerupBoxFactory:
|
||||
"""
|
||||
from ba.internal import get_default_powerup_distribution
|
||||
self._lastpoweruptype: Optional[str] = None
|
||||
self.model = ba.getmodel("powerup")
|
||||
self.model_simple = ba.getmodel("powerupSimple")
|
||||
self.tex_bomb = ba.gettexture("powerupBomb")
|
||||
self.tex_punch = ba.gettexture("powerupPunch")
|
||||
self.tex_ice_bombs = ba.gettexture("powerupIceBombs")
|
||||
self.tex_sticky_bombs = ba.gettexture("powerupStickyBombs")
|
||||
self.tex_shield = ba.gettexture("powerupShield")
|
||||
self.tex_impact_bombs = ba.gettexture("powerupImpactBombs")
|
||||
self.tex_health = ba.gettexture("powerupHealth")
|
||||
self.tex_land_mines = ba.gettexture("powerupLandMines")
|
||||
self.tex_curse = ba.gettexture("powerupCurse")
|
||||
self.health_powerup_sound = ba.getsound("healthPowerup")
|
||||
self.powerup_sound = ba.getsound("powerup01")
|
||||
self.powerdown_sound = ba.getsound("powerdown01")
|
||||
self.drop_sound = ba.getsound("boxDrop")
|
||||
self.model = ba.getmodel('powerup')
|
||||
self.model_simple = ba.getmodel('powerupSimple')
|
||||
self.tex_bomb = ba.gettexture('powerupBomb')
|
||||
self.tex_punch = ba.gettexture('powerupPunch')
|
||||
self.tex_ice_bombs = ba.gettexture('powerupIceBombs')
|
||||
self.tex_sticky_bombs = ba.gettexture('powerupStickyBombs')
|
||||
self.tex_shield = ba.gettexture('powerupShield')
|
||||
self.tex_impact_bombs = ba.gettexture('powerupImpactBombs')
|
||||
self.tex_health = ba.gettexture('powerupHealth')
|
||||
self.tex_land_mines = ba.gettexture('powerupLandMines')
|
||||
self.tex_curse = ba.gettexture('powerupCurse')
|
||||
self.health_powerup_sound = ba.getsound('healthPowerup')
|
||||
self.powerup_sound = ba.getsound('powerup01')
|
||||
self.powerdown_sound = ba.getsound('powerdown01')
|
||||
self.drop_sound = ba.getsound('boxDrop')
|
||||
|
||||
# Material for powerups.
|
||||
self.powerup_material = ba.Material()
|
||||
@ -129,20 +129,20 @@ class PowerupBoxFactory:
|
||||
|
||||
# Pass a powerup-touched message to applicable stuff.
|
||||
self.powerup_material.add_actions(
|
||||
conditions=("they_have_material", self.powerup_accept_material),
|
||||
actions=(("modify_part_collision", "collide",
|
||||
True), ("modify_part_collision", "physical", False),
|
||||
("message", "our_node", "at_connect", _TouchedMessage())))
|
||||
conditions=('they_have_material', self.powerup_accept_material),
|
||||
actions=(('modify_part_collision', 'collide',
|
||||
True), ('modify_part_collision', 'physical', False),
|
||||
('message', 'our_node', 'at_connect', _TouchedMessage())))
|
||||
|
||||
# We don't wanna be picked up.
|
||||
self.powerup_material.add_actions(
|
||||
conditions=("they_have_material", ba.sharedobj('pickup_material')),
|
||||
actions=("modify_part_collision", "collide", False))
|
||||
conditions=('they_have_material', ba.sharedobj('pickup_material')),
|
||||
actions=('modify_part_collision', 'collide', False))
|
||||
|
||||
self.powerup_material.add_actions(
|
||||
conditions=("they_have_material",
|
||||
conditions=('they_have_material',
|
||||
ba.sharedobj('footing_material')),
|
||||
actions=("impact_sound", self.drop_sound, 0.5, 0.1))
|
||||
actions=('impact_sound', self.drop_sound, 0.5, 0.1))
|
||||
|
||||
self._powerupdist: List[str] = []
|
||||
for powerup, freq in get_default_powerup_distribution():
|
||||
@ -187,7 +187,7 @@ def get_factory() -> PowerupBoxFactory:
|
||||
"""Return a shared ba.PowerupBoxFactory object, creating if necessary."""
|
||||
activity = ba.getactivity()
|
||||
if activity is None:
|
||||
raise Exception("no current activity")
|
||||
raise Exception('no current activity')
|
||||
try:
|
||||
# FIXME: et better way to store stuff with activity
|
||||
# pylint: disable=protected-access
|
||||
@ -252,10 +252,10 @@ class PowerupBox(ba.Actor):
|
||||
elif poweruptype == 'curse':
|
||||
tex = factory.tex_curse
|
||||
else:
|
||||
raise Exception("invalid poweruptype: " + str(poweruptype))
|
||||
raise Exception('invalid poweruptype: ' + str(poweruptype))
|
||||
|
||||
if len(position) != 3:
|
||||
raise Exception("expected 3 floats for position")
|
||||
raise Exception('expected 3 floats for position')
|
||||
|
||||
self.node = ba.newnode(
|
||||
'prop',
|
||||
@ -274,7 +274,7 @@ class PowerupBox(ba.Actor):
|
||||
}) # yapf: disable
|
||||
|
||||
# Animate in.
|
||||
curve = ba.animate(self.node, "model_scale", {0: 0, 0.14: 1.6, 0.2: 1})
|
||||
curve = ba.animate(self.node, 'model_scale', {0: 0, 0.14: 1.6, 0.2: 1})
|
||||
ba.timer(0.2, curve.delete)
|
||||
|
||||
if expire:
|
||||
@ -305,7 +305,7 @@ class PowerupBox(ba.Actor):
|
||||
|
||||
elif isinstance(msg, _TouchedMessage):
|
||||
if not self._powersgiven:
|
||||
node = ba.get_collision_info("opposing_node")
|
||||
node = ba.get_collision_info('opposing_node')
|
||||
if node:
|
||||
node.handlemessage(
|
||||
ba.PowerupMessage(self.poweruptype,
|
||||
@ -316,7 +316,7 @@ class PowerupBox(ba.Actor):
|
||||
if msg.immediate:
|
||||
self.node.delete()
|
||||
else:
|
||||
ba.animate(self.node, "model_scale", {0: 1, 0.1: 0})
|
||||
ba.animate(self.node, 'model_scale', {0: 1, 0.1: 0})
|
||||
ba.timer(0.1, self.node.delete)
|
||||
|
||||
elif isinstance(msg, ba.OutOfBoundsMessage):
|
||||
|
||||
@ -232,22 +232,22 @@ class _Entry:
|
||||
if flash:
|
||||
scale = 2.0
|
||||
_safesetattr(
|
||||
self._backing.node, "color",
|
||||
self._backing.node, 'color',
|
||||
(self._backing_color[0] * scale, self._backing_color[1] *
|
||||
scale, self._backing_color[2] * scale))
|
||||
_safesetattr(self._bar.node, "color",
|
||||
_safesetattr(self._bar.node, 'color',
|
||||
(self._barcolor[0] * scale, self._barcolor[1] * scale,
|
||||
self._barcolor[2] * scale))
|
||||
if self._do_cover:
|
||||
_safesetattr(
|
||||
self._cover.node, "color",
|
||||
self._cover.node, 'color',
|
||||
(self._cover_color[0] * scale, self._cover_color[1] *
|
||||
scale, self._cover_color[2] * scale))
|
||||
else:
|
||||
_safesetattr(self._backing.node, "color", self._backing_color)
|
||||
_safesetattr(self._bar.node, "color", self._barcolor)
|
||||
_safesetattr(self._backing.node, 'color', self._backing_color)
|
||||
_safesetattr(self._bar.node, 'color', self._barcolor)
|
||||
if self._do_cover:
|
||||
_safesetattr(self._cover.node, "color", self._cover_color)
|
||||
_safesetattr(self._cover.node, 'color', self._cover_color)
|
||||
|
||||
def _do_flash(self) -> None:
|
||||
assert self._flash_counter is not None
|
||||
@ -338,7 +338,7 @@ class Scoreboard:
|
||||
Label can be something like 'points' and will
|
||||
show up on boards if provided.
|
||||
"""
|
||||
self._flat_tex = ba.gettexture("null")
|
||||
self._flat_tex = ba.gettexture('null')
|
||||
self._entries: Dict[int, _Entry] = {}
|
||||
self._label = label
|
||||
self.score_split = score_split
|
||||
@ -371,7 +371,7 @@ class Scoreboard:
|
||||
# create a proxy in the team which will kill
|
||||
# our entry when it dies (for convenience)
|
||||
if '_scoreboard_entry' in team.gamedata:
|
||||
raise Exception("existing _EntryProxy found")
|
||||
raise Exception('existing _EntryProxy found')
|
||||
team.gamedata['_scoreboard_entry'] = _EntryProxy(self, team)
|
||||
# now set the entry..
|
||||
self._entries[team.get_id()].set_value(score=score,
|
||||
|
||||
@ -99,7 +99,7 @@ class Spaz(ba.Actor):
|
||||
def __init__(self,
|
||||
color: Sequence[float] = (1.0, 1.0, 1.0),
|
||||
highlight: Sequence[float] = (0.5, 0.5, 0.5),
|
||||
character: str = "Spaz",
|
||||
character: str = 'Spaz',
|
||||
source_player: ba.Player = None,
|
||||
start_invincible: bool = True,
|
||||
can_accept_powerups: bool = True,
|
||||
@ -156,7 +156,7 @@ class Spaz(ba.Actor):
|
||||
punchmats = (factory.punch_material, ba.sharedobj('attack_material'))
|
||||
pickupmats = (factory.pickup_material, ba.sharedobj('pickup_material'))
|
||||
self.node: ba.Node = ba.newnode(
|
||||
type="spaz",
|
||||
type='spaz',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'color': color,
|
||||
@ -311,7 +311,7 @@ class Spaz(ba.Actor):
|
||||
if self._turbo_filter_counts[source] == 15:
|
||||
# Knock 'em out. That'll learn 'em.
|
||||
assert self.node
|
||||
self.node.handlemessage("knockout", 500.0)
|
||||
self.node.handlemessage('knockout', 500.0)
|
||||
|
||||
# Also issue periodic notices about who is turbo-ing.
|
||||
now = ba.time(ba.TimeType.REAL)
|
||||
@ -368,7 +368,7 @@ class Spaz(ba.Actor):
|
||||
start_scale = self._score_text.scale
|
||||
self._score_text.text = text
|
||||
if flash:
|
||||
combine = ba.newnode("combine",
|
||||
combine = ba.newnode('combine',
|
||||
owner=self._score_text,
|
||||
attrs={'size': 3})
|
||||
scl = 1.8
|
||||
@ -566,7 +566,7 @@ class Spaz(ba.Actor):
|
||||
"""
|
||||
if not self.node:
|
||||
return
|
||||
self.node.handlemessage("move", x, y)
|
||||
self.node.handlemessage('move', x, y)
|
||||
|
||||
def on_move_up_down(self, value: float) -> None:
|
||||
"""
|
||||
@ -703,8 +703,8 @@ class Spaz(ba.Actor):
|
||||
|
||||
if isinstance(msg, ba.PickedUpMessage):
|
||||
if self.node:
|
||||
self.node.handlemessage("hurt_sound")
|
||||
self.node.handlemessage("picked_up")
|
||||
self.node.handlemessage('hurt_sound')
|
||||
self.node.handlemessage('picked_up')
|
||||
|
||||
# This counts as a hit.
|
||||
self._num_times_hit += 1
|
||||
@ -851,7 +851,7 @@ class Spaz(ba.Actor):
|
||||
self._last_hit_time = None
|
||||
self._num_times_hit = 0
|
||||
|
||||
self.node.handlemessage("flash")
|
||||
self.node.handlemessage('flash')
|
||||
if msg.source_node:
|
||||
msg.source_node.handlemessage(ba.PowerupAcceptMessage())
|
||||
return True
|
||||
@ -912,7 +912,7 @@ class Spaz(ba.Actor):
|
||||
# theoretical damage; not apply the impulse.
|
||||
assert msg.force_direction is not None
|
||||
self.node.handlemessage(
|
||||
"impulse", msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
'impulse', msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
msg.velocity[0], msg.velocity[1], msg.velocity[2], mag,
|
||||
velocity_mag, msg.radius, 1, msg.force_direction[0],
|
||||
msg.force_direction[1], msg.force_direction[2])
|
||||
@ -984,13 +984,13 @@ class Spaz(ba.Actor):
|
||||
# Hit it with an impulse and get the resulting damage.
|
||||
assert msg.force_direction is not None
|
||||
self.node.handlemessage(
|
||||
"impulse", msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
'impulse', msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
msg.velocity[0], msg.velocity[1], msg.velocity[2], mag,
|
||||
velocity_mag, msg.radius, 0, msg.force_direction[0],
|
||||
msg.force_direction[1], msg.force_direction[2])
|
||||
|
||||
damage = int(damage_scale * self.node.damage)
|
||||
self.node.handlemessage("hurt_sound")
|
||||
self.node.handlemessage('hurt_sound')
|
||||
|
||||
# Play punch impact sound based on damage if it was a punch.
|
||||
if msg.hit_type == 'punch':
|
||||
@ -999,7 +999,7 @@ class Spaz(ba.Actor):
|
||||
# If damage was significant, lets show it.
|
||||
if damage > 350:
|
||||
assert msg.force_direction is not None
|
||||
ba.show_damage_count('-' + str(int(damage / 10)) + "%",
|
||||
ba.show_damage_count('-' + str(int(damage / 10)) + '%',
|
||||
msg.pos, msg.force_direction)
|
||||
|
||||
# Let's always add in a super-punch sound with boxing
|
||||
@ -1041,7 +1041,7 @@ class Spaz(ba.Actor):
|
||||
msg.pos[2] + msg.force_direction[2] * 0.02)
|
||||
flash_color = (1.0, 0.8, 0.4)
|
||||
light = ba.newnode(
|
||||
"light",
|
||||
'light',
|
||||
attrs={
|
||||
'position': punchpos,
|
||||
'radius': 0.12 + hurtiness * 0.12,
|
||||
@ -1051,7 +1051,7 @@ class Spaz(ba.Actor):
|
||||
})
|
||||
ba.timer(0.06, light.delete)
|
||||
|
||||
flash = ba.newnode("flash",
|
||||
flash = ba.newnode('flash',
|
||||
attrs={
|
||||
'position': punchpos,
|
||||
'size': 0.17 + 0.17 * hurtiness,
|
||||
@ -1078,7 +1078,7 @@ class Spaz(ba.Actor):
|
||||
# (so it *can* still kill us if its high enough)
|
||||
newdamage = max(damage - 200, self.hitpoints - 10)
|
||||
damage = newdamage
|
||||
self.node.handlemessage("flash")
|
||||
self.node.handlemessage('flash')
|
||||
|
||||
# If we're holding something, drop it.
|
||||
if damage > 0.0 and self.node.hold_node:
|
||||
@ -1132,7 +1132,7 @@ class Spaz(ba.Actor):
|
||||
self._last_stand_pos = (msg.position[0], msg.position[1],
|
||||
msg.position[2])
|
||||
if self.node:
|
||||
self.node.handlemessage("stand", msg.position[0],
|
||||
self.node.handlemessage('stand', msg.position[0],
|
||||
msg.position[1], msg.position[2],
|
||||
msg.angle)
|
||||
|
||||
@ -1142,7 +1142,7 @@ class Spaz(ba.Actor):
|
||||
elif isinstance(msg, PunchHitMessage):
|
||||
if not self.node:
|
||||
return None
|
||||
node = ba.get_collision_info("opposing_node")
|
||||
node = ba.get_collision_info('opposing_node')
|
||||
|
||||
# only allow one hit per node per punch
|
||||
if node and (node not in self._punched_nodes):
|
||||
@ -1194,7 +1194,7 @@ class Spaz(ba.Actor):
|
||||
if self._hockey:
|
||||
mag *= 0.5
|
||||
if len(self._punched_nodes) == 1:
|
||||
self.node.handlemessage("kick_back", ppos[0], ppos[1],
|
||||
self.node.handlemessage('kick_back', ppos[0], ppos[1],
|
||||
ppos[2], punchdir[0], punchdir[1],
|
||||
punchdir[2], mag)
|
||||
elif isinstance(msg, PickupMessage):
|
||||
@ -1365,7 +1365,7 @@ class Spaz(ba.Actor):
|
||||
pos=pos,
|
||||
force_direction=self.node.velocity,
|
||||
hit_type='impact'))
|
||||
self.node.handlemessage("knockout", max(0.0, 50.0 * intensity))
|
||||
self.node.handlemessage('knockout', max(0.0, 50.0 * intensity))
|
||||
sounds: Sequence[ba.Sound]
|
||||
if intensity > 5.0:
|
||||
sounds = get_factory().impact_sounds_harder
|
||||
@ -1390,7 +1390,7 @@ class Spaz(ba.Actor):
|
||||
assert self.node
|
||||
self.node.billboard_texture = tex
|
||||
self.node.billboard_cross_out = False
|
||||
ba.animate(self.node, "billboard_opacity", {
|
||||
ba.animate(self.node, 'billboard_opacity', {
|
||||
0.0: 0.0,
|
||||
0.1: 1.0,
|
||||
0.4: 1.0,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -526,7 +526,7 @@ class SpazBot(basespaz.Spaz):
|
||||
super().handlemessage(msg) # Augment standard behavior.
|
||||
self.held_count -= 1
|
||||
if self.held_count < 0:
|
||||
print("ERROR: spaz held_count < 0")
|
||||
print('ERROR: spaz held_count < 0')
|
||||
|
||||
# Let's count someone dropping us as an attack.
|
||||
try:
|
||||
@ -938,7 +938,7 @@ class BotSet:
|
||||
spaz = bot_type()
|
||||
ba.playsound(self._spawn_sound, position=pos)
|
||||
assert spaz.node
|
||||
spaz.node.handlemessage("flash")
|
||||
spaz.node.handlemessage('flash')
|
||||
spaz.node.is_area_of_interest = False
|
||||
spaz.handlemessage(ba.StandMessage(pos, random.uniform(0, 360)))
|
||||
self.add_bot(spaz)
|
||||
@ -972,7 +972,7 @@ class BotSet:
|
||||
])
|
||||
except Exception:
|
||||
bot_list = []
|
||||
ba.print_exception("error updating bot list: " +
|
||||
ba.print_exception('error updating bot list: ' +
|
||||
str(self._bot_lists[self._bot_update_list]))
|
||||
self._bot_update_list = (self._bot_update_list +
|
||||
1) % self._bot_list_count
|
||||
|
||||
@ -111,8 +111,8 @@ class Text(ba.Actor):
|
||||
|
||||
if transition is self.Transition.FADE_IN:
|
||||
if flash:
|
||||
raise Exception("fixme: flash and fade-in"
|
||||
" currently cant both be on")
|
||||
raise Exception('fixme: flash and fade-in'
|
||||
' currently cant both be on')
|
||||
cmb = ba.newnode('combine',
|
||||
owner=self.node,
|
||||
attrs={
|
||||
@ -125,7 +125,7 @@ class Text(ba.Actor):
|
||||
if transition_out_delay is not None:
|
||||
keys[transition_delay + transition_out_delay] = color[3]
|
||||
keys[transition_delay + transition_out_delay + 0.5] = 0.0
|
||||
ba.animate(cmb, "input3", keys)
|
||||
ba.animate(cmb, 'input3', keys)
|
||||
cmb.connectattr('output', self.node, 'color')
|
||||
|
||||
if flash:
|
||||
@ -134,21 +134,21 @@ class Text(ba.Actor):
|
||||
tm2 = 0.3
|
||||
cmb = ba.newnode('combine', owner=self.node, attrs={'size': 4})
|
||||
ba.animate(cmb,
|
||||
"input0", {
|
||||
'input0', {
|
||||
0.0: color[0] * mult,
|
||||
tm1: color[0],
|
||||
tm2: color[0] * mult
|
||||
},
|
||||
loop=True)
|
||||
ba.animate(cmb,
|
||||
"input1", {
|
||||
'input1', {
|
||||
0.0: color[1] * mult,
|
||||
tm1: color[1],
|
||||
tm2: color[1] * mult
|
||||
},
|
||||
loop=True)
|
||||
ba.animate(cmb,
|
||||
"input2", {
|
||||
'input2', {
|
||||
0.0: color[2] * mult,
|
||||
tm1: color[2],
|
||||
tm2: color[2] * mult
|
||||
|
||||
@ -68,7 +68,7 @@ class TipsText(ba.Actor):
|
||||
0.001 * (self._message_duration + self._message_spacing),
|
||||
ba.WeakCall(self.change_phrase),
|
||||
repeat=True)
|
||||
self._combine = ba.newnode("combine",
|
||||
self._combine = ba.newnode('combine',
|
||||
owner=self.node,
|
||||
attrs={
|
||||
'input0': 1.0,
|
||||
@ -97,7 +97,7 @@ class TipsText(ba.Actor):
|
||||
spc + self._message_duration: 0.0
|
||||
}
|
||||
ba.animate(self._combine,
|
||||
"input3", {k: v * 0.5
|
||||
'input3', {k: v * 0.5
|
||||
for k, v in list(keys.items())},
|
||||
timeformat=ba.TimeFormat.MILLISECONDS)
|
||||
self.node.text = next_tip
|
||||
|
||||
@ -47,7 +47,7 @@ class ZoomText(ba.Actor):
|
||||
lifespan: float = None,
|
||||
flash: bool = True,
|
||||
trail: bool = True,
|
||||
h_align: str = "center",
|
||||
h_align: str = 'center',
|
||||
color: Sequence[float] = (0.9, 0.4, 0.0),
|
||||
jitter: float = 0.0,
|
||||
trailcolor: Sequence[float] = (1.0, 0.35, 0.1, 0.0),
|
||||
|
||||
@ -79,7 +79,7 @@ class AssaultGame(ba.TeamGameActivity):
|
||||
if self.settings['Epic Mode']:
|
||||
self.slow_motion = True
|
||||
self._last_score_time = 0.0
|
||||
self._score_sound = ba.getsound("score")
|
||||
self._score_sound = ba.getsound('score')
|
||||
self._base_region_materials: Dict[int, ba.Material] = {}
|
||||
|
||||
def get_instance_description(self) -> Union[str, Sequence]:
|
||||
@ -163,7 +163,7 @@ class AssaultGame(ba.TeamGameActivity):
|
||||
'radius': 0.3,
|
||||
'color': team.color
|
||||
})
|
||||
ba.animate(light, "intensity", {0: 0, 0.25: 2.0, 0.5: 0}, loop=True)
|
||||
ba.animate(light, 'intensity', {0: 0, 0.25: 2.0, 0.5: 0}, loop=True)
|
||||
ba.timer(length, light.delete)
|
||||
|
||||
def _handle_base_collide(self, team: ba.Team) -> None:
|
||||
|
||||
@ -171,7 +171,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
|
||||
base_region_mat = team.gamedata['base_region_material'] = ba.Material()
|
||||
pos = team.gamedata['base_pos']
|
||||
team.gamedata['base_region'] = ba.newnode(
|
||||
"region",
|
||||
'region',
|
||||
attrs={
|
||||
'position': (pos[0], pos[1] + 0.75, pos[2]),
|
||||
'scale': (0.5, 0.5, 0.5),
|
||||
@ -230,7 +230,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
|
||||
ba.playsound(self._swipsound, position=flag.node.position)
|
||||
|
||||
def _handle_flag_entered_base(self, team: ba.Team) -> None:
|
||||
node = ba.get_collision_info("opposing_node")
|
||||
node = ba.get_collision_info('opposing_node')
|
||||
assert isinstance(node, (ba.Node, type(None)))
|
||||
flag = CTFFlag.from_node(node)
|
||||
if not flag:
|
||||
@ -341,7 +341,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
|
||||
|
||||
def _handle_flag_left_base(self, team: ba.Team) -> None:
|
||||
cur_time = ba.time()
|
||||
op_node = ba.get_collision_info("opposing_node")
|
||||
op_node = ba.get_collision_info('opposing_node')
|
||||
assert isinstance(op_node, (ba.Node, type(None)))
|
||||
flag = CTFFlag.from_node(op_node)
|
||||
if not flag:
|
||||
@ -378,7 +378,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
|
||||
flag = team.gamedata['flag']
|
||||
flag.touch_return_time -= 0.1
|
||||
if flag.counter:
|
||||
flag.counter.text = "%.1f" % flag.touch_return_time
|
||||
flag.counter.text = '%.1f' % flag.touch_return_time
|
||||
flag.counter.color = (1, 1, 0, 1)
|
||||
flag.counter.scale = 0.02
|
||||
|
||||
@ -425,7 +425,7 @@ class CaptureTheFlagGame(ba.TeamGameActivity):
|
||||
# Use a node message to kill the flag instead of just killing
|
||||
# our team's. (avoids redundantly killing new flags if
|
||||
# multiple body parts generate callbacks in one step).
|
||||
node = ba.get_collision_info("opposing_node")
|
||||
node = ba.get_collision_info('opposing_node')
|
||||
if node:
|
||||
self._award_players_touching_own_flag(team)
|
||||
node.handlemessage(ba.DieMessage())
|
||||
|
||||
@ -65,27 +65,27 @@ class ChosenOneGame(ba.TeamGameActivity):
|
||||
def get_settings(
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [("Chosen One Time", {
|
||||
return [('Chosen One Time', {
|
||||
'min_value': 10,
|
||||
'default': 30,
|
||||
'increment': 10
|
||||
}), ("Chosen One Gets Gloves", {
|
||||
}), ('Chosen One Gets Gloves', {
|
||||
'default': True
|
||||
}), ("Chosen One Gets Shield", {
|
||||
}), ('Chosen One Gets Shield', {
|
||||
'default': False
|
||||
}),
|
||||
("Time Limit", {
|
||||
('Time Limit', {
|
||||
'choices': [('None', 0), ('1 Minute', 60),
|
||||
('2 Minutes', 120), ('5 Minutes', 300),
|
||||
('10 Minutes', 600), ('20 Minutes', 1200)],
|
||||
'default': 0
|
||||
}),
|
||||
("Respawn Times", {
|
||||
('Respawn Times', {
|
||||
'choices': [('Shorter', 0.25), ('Short', 0.5),
|
||||
('Normal', 1.0), ('Long', 2.0),
|
||||
('Longer', 4.0)],
|
||||
'default': 1.0
|
||||
}), ("Epic Mode", {
|
||||
}), ('Epic Mode', {
|
||||
'default': False
|
||||
})]
|
||||
|
||||
@ -96,7 +96,7 @@ class ChosenOneGame(ba.TeamGameActivity):
|
||||
self.slow_motion = True
|
||||
self._scoreboard = Scoreboard()
|
||||
self._chosen_one_player: Optional[ba.Player] = None
|
||||
self._swipsound = ba.getsound("swip")
|
||||
self._swipsound = ba.getsound('swip')
|
||||
self._countdownsounds: Dict[int, ba.Sound] = {
|
||||
10: ba.getsound('announceTen'),
|
||||
9: ba.getsound('announceNine'),
|
||||
@ -123,7 +123,7 @@ class ChosenOneGame(ba.TeamGameActivity):
|
||||
super().on_transition_in()
|
||||
|
||||
def on_team_join(self, team: ba.Team) -> None:
|
||||
team.gamedata['time_remaining'] = self.settings["Chosen One Time"]
|
||||
team.gamedata['time_remaining'] = self.settings['Chosen One Time']
|
||||
self._update_scoreboard()
|
||||
|
||||
def on_player_leave(self, player: ba.Player) -> None:
|
||||
@ -170,7 +170,7 @@ class ChosenOneGame(ba.TeamGameActivity):
|
||||
return
|
||||
try:
|
||||
player = (ba.get_collision_info(
|
||||
"opposing_node").getdelegate().getplayer())
|
||||
'opposing_node').getdelegate().getplayer())
|
||||
except Exception:
|
||||
return
|
||||
if player is not None and player.is_alive():
|
||||
@ -184,7 +184,7 @@ class ChosenOneGame(ba.TeamGameActivity):
|
||||
'radius': 0.3,
|
||||
'height_attenuated': False
|
||||
})
|
||||
ba.animate(light, "intensity", {0: 0, 0.25: 0.5, 0.5: 0}, loop=True)
|
||||
ba.animate(light, 'intensity', {0: 0, 0.25: 0.5, 0.5: 0}, loop=True)
|
||||
ba.timer(1.0, light.delete)
|
||||
|
||||
def _tick(self) -> None:
|
||||
@ -296,11 +296,11 @@ class ChosenOneGame(ba.TeamGameActivity):
|
||||
light = player.gamedata['chosen_light'] = ba.NodeActor(
|
||||
ba.newnode('light',
|
||||
attrs={
|
||||
"intensity": 0.6,
|
||||
"height_attenuated": False,
|
||||
"volume_intensity_scale": 0.1,
|
||||
"radius": 0.13,
|
||||
"color": color
|
||||
'intensity': 0.6,
|
||||
'height_attenuated': False,
|
||||
'volume_intensity_scale': 0.1,
|
||||
'radius': 0.13,
|
||||
'color': color
|
||||
}))
|
||||
|
||||
assert light.node
|
||||
|
||||
@ -75,14 +75,14 @@ class ConquestGame(ba.TeamGameActivity):
|
||||
|
||||
@classmethod
|
||||
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
|
||||
return ba.getmaps("conquest")
|
||||
return ba.getmaps('conquest')
|
||||
|
||||
@classmethod
|
||||
def get_settings(
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [
|
||||
("Time Limit", {
|
||||
('Time Limit', {
|
||||
'choices': [('None', 0), ('1 Minute', 60),
|
||||
('2 Minutes', 120),
|
||||
('5 Minutes', 300),
|
||||
@ -217,12 +217,12 @@ class ConquestGame(ba.TeamGameActivity):
|
||||
'height_attenuated': False,
|
||||
'color': flag.light.color
|
||||
})
|
||||
ba.animate(light, "intensity", {0: 0, 0.25: 1, 0.5: 0}, loop=True)
|
||||
ba.animate(light, 'intensity', {0: 0, 0.25: 1, 0.5: 0}, loop=True)
|
||||
ba.timer(length, light.delete)
|
||||
|
||||
def _handle_flag_player_collide(self) -> None:
|
||||
flagnode, playernode = ba.get_collision_info("source_node",
|
||||
"opposing_node")
|
||||
flagnode, playernode = ba.get_collision_info('source_node',
|
||||
'opposing_node')
|
||||
try:
|
||||
player = playernode.getdelegate().getplayer()
|
||||
flag = flagnode.getdelegate()
|
||||
|
||||
@ -53,19 +53,19 @@ class DeathMatchGame(ba.TeamGameActivity):
|
||||
|
||||
@classmethod
|
||||
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
|
||||
return ba.getmaps("melee")
|
||||
return ba.getmaps('melee')
|
||||
|
||||
@classmethod
|
||||
def get_settings(
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
settings: List[Tuple[str, Dict[str, Any]]] = [
|
||||
("Kills to Win Per Player", {
|
||||
('Kills to Win Per Player', {
|
||||
'min_value': 1,
|
||||
'default': 5,
|
||||
'increment': 1
|
||||
}),
|
||||
("Time Limit", {
|
||||
('Time Limit', {
|
||||
'choices':
|
||||
[('None', 0),
|
||||
('1 Minute', 60), ('2 Minutes', 120),
|
||||
@ -73,14 +73,14 @@ class DeathMatchGame(ba.TeamGameActivity):
|
||||
('20 Minutes', 1200)],
|
||||
'default': 0
|
||||
}),
|
||||
("Respawn Times", {
|
||||
('Respawn Times', {
|
||||
'choices':
|
||||
[('Shorter', 0.25), ('Short', 0.5),
|
||||
('Normal', 1.0), ('Long', 2.0),
|
||||
('Longer', 4.0)],
|
||||
'default': 1.0
|
||||
}),
|
||||
("Epic Mode", {
|
||||
('Epic Mode', {
|
||||
'default': False
|
||||
})
|
||||
] # yapf: disable
|
||||
@ -91,7 +91,7 @@ class DeathMatchGame(ba.TeamGameActivity):
|
||||
# be able to go negative. (to avoid a strategy of just
|
||||
# suiciding until you get a good drop)
|
||||
if issubclass(sessiontype, ba.FreeForAllSession):
|
||||
settings.append(("Allow Negative Scores", {'default': False}))
|
||||
settings.append(('Allow Negative Scores', {'default': False}))
|
||||
|
||||
return settings
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ class EasterEggHuntGame(ba.TeamGameActivity):
|
||||
def get_settings(
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [("Pro Mode", {'default': False})]
|
||||
return [('Pro Mode', {'default': False})]
|
||||
|
||||
def __init__(self, settings: Dict[str, Any]):
|
||||
from bastd.actor.scoreboard import Scoreboard
|
||||
@ -86,8 +86,8 @@ class EasterEggHuntGame(ba.TeamGameActivity):
|
||||
self._max_eggs = 1.0
|
||||
self.egg_material = ba.Material()
|
||||
self.egg_material.add_actions(
|
||||
conditions=("they_have_material", ba.sharedobj('player_material')),
|
||||
actions=(("call", "at_connect", self._on_egg_player_collide), ))
|
||||
conditions=('they_have_material', ba.sharedobj('player_material')),
|
||||
actions=(('call', 'at_connect', self._on_egg_player_collide), ))
|
||||
self._eggs: List[Egg] = []
|
||||
self._update_timer: Optional[ba.Timer] = None
|
||||
self._countdown: Optional[OnScreenCountdown] = None
|
||||
@ -264,7 +264,7 @@ class Egg(ba.Actor):
|
||||
ctex = (activity.egg_tex_1, activity.egg_tex_2,
|
||||
activity.egg_tex_3)[random.randrange(3)]
|
||||
mats = [ba.sharedobj('object_material'), activity.egg_material]
|
||||
self.node = ba.newnode("prop",
|
||||
self.node = ba.newnode('prop',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'model': activity.egg_model,
|
||||
@ -291,7 +291,7 @@ class Egg(ba.Actor):
|
||||
if self.node:
|
||||
assert msg.force_direction is not None
|
||||
self.node.handlemessage(
|
||||
"impulse", msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
'impulse', msg.pos[0], msg.pos[1], msg.pos[2],
|
||||
msg.velocity[0], msg.velocity[1], msg.velocity[2],
|
||||
1.0 * msg.magnitude, 1.0 * msg.velocity_magnitude,
|
||||
msg.radius, 0, msg.force_direction[0],
|
||||
|
||||
@ -190,33 +190,33 @@ class EliminationGame(ba.TeamGameActivity):
|
||||
|
||||
@classmethod
|
||||
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
|
||||
return ba.getmaps("melee")
|
||||
return ba.getmaps('melee')
|
||||
|
||||
@classmethod
|
||||
def get_settings(
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
settings: List[Tuple[str, Dict[str, Any]]] = [
|
||||
("Lives Per Player", {
|
||||
('Lives Per Player', {
|
||||
'default': 1, 'min_value': 1,
|
||||
'max_value': 10, 'increment': 1
|
||||
}),
|
||||
("Time Limit", {
|
||||
('Time Limit', {
|
||||
'choices': [('None', 0), ('1 Minute', 60),
|
||||
('2 Minutes', 120), ('5 Minutes', 300),
|
||||
('10 Minutes', 600), ('20 Minutes', 1200)],
|
||||
'default': 0
|
||||
}),
|
||||
("Respawn Times", {
|
||||
('Respawn Times', {
|
||||
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
|
||||
('Long', 2.0), ('Longer', 4.0)],
|
||||
'default': 1.0
|
||||
}),
|
||||
("Epic Mode", {'default': False})] # yapf: disable
|
||||
('Epic Mode', {'default': False})] # yapf: disable
|
||||
|
||||
if issubclass(sessiontype, ba.DualTeamSession):
|
||||
settings.append(("Solo Mode", {'default': False}))
|
||||
settings.append(("Balance Total Lives", {'default': False}))
|
||||
settings.append(('Solo Mode', {'default': False}))
|
||||
settings.append(('Balance Total Lives', {'default': False}))
|
||||
|
||||
return settings
|
||||
|
||||
@ -447,16 +447,16 @@ class EliminationGame(ba.TeamGameActivity):
|
||||
self.setup_standard_powerup_drops()
|
||||
if self._solo_mode:
|
||||
self._vs_text = ba.NodeActor(
|
||||
ba.newnode("text",
|
||||
ba.newnode('text',
|
||||
attrs={
|
||||
'position': (0, 105),
|
||||
'h_attach': "center",
|
||||
'h_attach': 'center',
|
||||
'h_align': 'center',
|
||||
'maxwidth': 200,
|
||||
'shadow': 0.5,
|
||||
'vr_depth': 390,
|
||||
'scale': 0.6,
|
||||
'v_attach': "bottom",
|
||||
'v_attach': 'bottom',
|
||||
'color': (0.8, 0.8, 0.3, 1.0),
|
||||
'text': ba.Lstr(resource='vsText')
|
||||
}))
|
||||
|
||||
@ -92,18 +92,18 @@ class FootballTeamGame(ba.TeamGameActivity):
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [
|
||||
("Score to Win", {
|
||||
('Score to Win', {
|
||||
'min_value': 7,
|
||||
'default': 21,
|
||||
'increment': 7
|
||||
}),
|
||||
("Time Limit", {
|
||||
('Time Limit', {
|
||||
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
|
||||
('5 Minutes', 300), ('10 Minutes', 600),
|
||||
('20 Minutes', 1200)],
|
||||
'default': 0
|
||||
}),
|
||||
("Respawn Times", {
|
||||
('Respawn Times', {
|
||||
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
|
||||
('Long', 2.0), ('Longer', 4.0)],
|
||||
'default': 1.0
|
||||
@ -115,19 +115,19 @@ class FootballTeamGame(ba.TeamGameActivity):
|
||||
self._scoreboard: Optional[Scoreboard] = Scoreboard()
|
||||
|
||||
# Load some media we need.
|
||||
self._cheer_sound = ba.getsound("cheer")
|
||||
self._chant_sound = ba.getsound("crowdChant")
|
||||
self._score_sound = ba.getsound("score")
|
||||
self._swipsound = ba.getsound("swip")
|
||||
self._whistle_sound = ba.getsound("refWhistle")
|
||||
self._cheer_sound = ba.getsound('cheer')
|
||||
self._chant_sound = ba.getsound('crowdChant')
|
||||
self._score_sound = ba.getsound('score')
|
||||
self._swipsound = ba.getsound('swip')
|
||||
self._whistle_sound = ba.getsound('refWhistle')
|
||||
|
||||
self.score_region_material = ba.Material()
|
||||
self.score_region_material.add_actions(
|
||||
conditions=("they_have_material",
|
||||
conditions=('they_have_material',
|
||||
stdflag.get_factory().flagmaterial),
|
||||
actions=(("modify_part_collision", "collide",
|
||||
True), ("modify_part_collision", "physical", False),
|
||||
("call", "at_connect", self._handle_score)))
|
||||
actions=(('modify_part_collision', 'collide',
|
||||
True), ('modify_part_collision', 'physical', False),
|
||||
('call', 'at_connect', self._handle_score)))
|
||||
self._flag_spawn_pos: Optional[Sequence[float]] = None
|
||||
self._score_regions: List[ba.NodeActor] = []
|
||||
self._flag: Optional[FootballFlag] = None
|
||||
@ -198,7 +198,7 @@ class FootballTeamGame(ba.TeamGameActivity):
|
||||
assert self._flag is not None
|
||||
if self._flag.scored:
|
||||
return
|
||||
region = ba.get_collision_info("source_node")
|
||||
region = ba.get_collision_info('source_node')
|
||||
i = None
|
||||
for i in range(len(self._score_regions)):
|
||||
if region == self._score_regions[i].node:
|
||||
@ -263,7 +263,7 @@ class FootballTeamGame(ba.TeamGameActivity):
|
||||
msg.flag.last_holding_player = player
|
||||
msg.flag.held_count += 1
|
||||
except Exception:
|
||||
ba.print_exception("exception in Football FlagPickedUpMessage;"
|
||||
ba.print_exception('exception in Football FlagPickedUpMessage;'
|
||||
" this shouldn't happen")
|
||||
|
||||
elif isinstance(msg, stdflag.FlagDroppedMessage):
|
||||
@ -290,7 +290,7 @@ class FootballTeamGame(ba.TeamGameActivity):
|
||||
}))
|
||||
assert self._flag_respawn_light.node
|
||||
ba.animate(self._flag_respawn_light.node,
|
||||
"intensity", {
|
||||
'intensity', {
|
||||
0.0: 0,
|
||||
0.25: 0.15,
|
||||
0.5: 0
|
||||
@ -359,20 +359,20 @@ class FootballCoopGame(ba.CoopGameActivity):
|
||||
self._preset = self.settings.get('preset', 'rookie')
|
||||
|
||||
# Load some media we need.
|
||||
self._cheer_sound = ba.getsound("cheer")
|
||||
self._boo_sound = ba.getsound("boo")
|
||||
self._chant_sound = ba.getsound("crowdChant")
|
||||
self._score_sound = ba.getsound("score")
|
||||
self._swipsound = ba.getsound("swip")
|
||||
self._whistle_sound = ba.getsound("refWhistle")
|
||||
self._cheer_sound = ba.getsound('cheer')
|
||||
self._boo_sound = ba.getsound('boo')
|
||||
self._chant_sound = ba.getsound('crowdChant')
|
||||
self._score_sound = ba.getsound('score')
|
||||
self._swipsound = ba.getsound('swip')
|
||||
self._whistle_sound = ba.getsound('refWhistle')
|
||||
self._score_to_win = 21
|
||||
self._score_region_material = ba.Material()
|
||||
self._score_region_material.add_actions(
|
||||
conditions=("they_have_material",
|
||||
conditions=('they_have_material',
|
||||
stdflag.get_factory().flagmaterial),
|
||||
actions=(("modify_part_collision", "collide",
|
||||
True), ("modify_part_collision", "physical", False),
|
||||
("call", "at_connect", self._handle_score)))
|
||||
actions=(('modify_part_collision', 'collide',
|
||||
True), ('modify_part_collision', 'physical', False),
|
||||
('call', 'at_connect', self._handle_score)))
|
||||
self._powerup_center = (0, 2, 0)
|
||||
self._powerup_spread = (10, 5.5)
|
||||
self._player_has_dropped_bomb = False
|
||||
@ -660,7 +660,7 @@ class FootballCoopGame(ba.CoopGameActivity):
|
||||
return
|
||||
|
||||
# See which score region it was.
|
||||
region = ba.get_collision_info("source_node")
|
||||
region = ba.get_collision_info('source_node')
|
||||
i = None
|
||||
for i in range(len(self.score_regions)):
|
||||
if region == self.score_regions[i].node:
|
||||
@ -849,7 +849,7 @@ class FootballCoopGame(ba.CoopGameActivity):
|
||||
}))
|
||||
assert self._flag_respawn_light.node
|
||||
ba.animate(self._flag_respawn_light.node,
|
||||
"intensity", {
|
||||
'intensity', {
|
||||
0: 0,
|
||||
0.25: 0.15,
|
||||
0.5: 0
|
||||
|
||||
@ -56,7 +56,7 @@ class Puck(ba.Actor):
|
||||
assert activity is not None
|
||||
assert isinstance(activity, HockeyGame)
|
||||
pmats = [ba.sharedobj('object_material'), activity.puck_material]
|
||||
self.node = ba.newnode("prop",
|
||||
self.node = ba.newnode('prop',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'model': activity.puck_model,
|
||||
@ -69,7 +69,7 @@ class Puck(ba.Actor):
|
||||
'position': self._spawn_pos,
|
||||
'materials': pmats
|
||||
})
|
||||
ba.animate(self.node, "model_scale", {0: 0, 0.2: 1.3, 0.26: 1})
|
||||
ba.animate(self.node, 'model_scale', {0: 0, 0.2: 1.3, 0.26: 1})
|
||||
|
||||
def handlemessage(self, msg: Any) -> Any:
|
||||
if isinstance(msg, ba.DieMessage):
|
||||
@ -88,7 +88,7 @@ class Puck(ba.Actor):
|
||||
assert self.node
|
||||
assert msg.force_direction is not None
|
||||
self.node.handlemessage(
|
||||
"impulse", msg.pos[0], msg.pos[1], msg.pos[2], msg.velocity[0],
|
||||
'impulse', msg.pos[0], msg.pos[1], msg.pos[2], msg.velocity[0],
|
||||
msg.velocity[1], msg.velocity[2], 1.0 * msg.magnitude,
|
||||
1.0 * msg.velocity_magnitude, msg.radius, 0,
|
||||
msg.force_direction[0], msg.force_direction[1],
|
||||
@ -131,16 +131,16 @@ class HockeyGame(ba.TeamGameActivity):
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [
|
||||
("Score to Win", {
|
||||
('Score to Win', {
|
||||
'min_value': 1, 'default': 1, 'increment': 1
|
||||
}),
|
||||
("Time Limit", {
|
||||
('Time Limit', {
|
||||
'choices': [('None', 0), ('1 Minute', 60),
|
||||
('2 Minutes', 120), ('5 Minutes', 300),
|
||||
('10 Minutes', 600), ('20 Minutes', 1200)],
|
||||
'default': 0
|
||||
}),
|
||||
("Respawn Times", {
|
||||
('Respawn Times', {
|
||||
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
|
||||
('Long', 2.0), ('Longer', 4.0)],
|
||||
'default': 1.0
|
||||
@ -151,48 +151,48 @@ class HockeyGame(ba.TeamGameActivity):
|
||||
from bastd.actor import powerupbox
|
||||
super().__init__(settings)
|
||||
self._scoreboard = Scoreboard()
|
||||
self._cheer_sound = ba.getsound("cheer")
|
||||
self._chant_sound = ba.getsound("crowdChant")
|
||||
self._foghorn_sound = ba.getsound("foghorn")
|
||||
self._swipsound = ba.getsound("swip")
|
||||
self._whistle_sound = ba.getsound("refWhistle")
|
||||
self.puck_model = ba.getmodel("puck")
|
||||
self.puck_tex = ba.gettexture("puckColor")
|
||||
self._puck_sound = ba.getsound("metalHit")
|
||||
self._cheer_sound = ba.getsound('cheer')
|
||||
self._chant_sound = ba.getsound('crowdChant')
|
||||
self._foghorn_sound = ba.getsound('foghorn')
|
||||
self._swipsound = ba.getsound('swip')
|
||||
self._whistle_sound = ba.getsound('refWhistle')
|
||||
self.puck_model = ba.getmodel('puck')
|
||||
self.puck_tex = ba.gettexture('puckColor')
|
||||
self._puck_sound = ba.getsound('metalHit')
|
||||
self.puck_material = ba.Material()
|
||||
self.puck_material.add_actions(actions=(("modify_part_collision",
|
||||
"friction", 0.5)))
|
||||
self.puck_material.add_actions(actions=(('modify_part_collision',
|
||||
'friction', 0.5)))
|
||||
self.puck_material.add_actions(
|
||||
conditions=("they_have_material", ba.sharedobj('pickup_material')),
|
||||
actions=("modify_part_collision", "collide", False))
|
||||
conditions=('they_have_material', ba.sharedobj('pickup_material')),
|
||||
actions=('modify_part_collision', 'collide', False))
|
||||
self.puck_material.add_actions(
|
||||
conditions=(("we_are_younger_than", 100),
|
||||
'and', ("they_have_material",
|
||||
conditions=(('we_are_younger_than', 100),
|
||||
'and', ('they_have_material',
|
||||
ba.sharedobj('object_material'))),
|
||||
actions=("modify_node_collision", "collide", False))
|
||||
actions=('modify_node_collision', 'collide', False))
|
||||
self.puck_material.add_actions(
|
||||
conditions=("they_have_material",
|
||||
conditions=('they_have_material',
|
||||
ba.sharedobj('footing_material')),
|
||||
actions=("impact_sound", self._puck_sound, 0.2, 5))
|
||||
actions=('impact_sound', self._puck_sound, 0.2, 5))
|
||||
|
||||
# Keep track of which player last touched the puck
|
||||
self.puck_material.add_actions(
|
||||
conditions=("they_have_material", ba.sharedobj('player_material')),
|
||||
actions=(("call", "at_connect",
|
||||
conditions=('they_have_material', ba.sharedobj('player_material')),
|
||||
actions=(('call', 'at_connect',
|
||||
self._handle_puck_player_collide), ))
|
||||
|
||||
# We want the puck to kill powerups; not get stopped by them
|
||||
self.puck_material.add_actions(
|
||||
conditions=("they_have_material",
|
||||
conditions=('they_have_material',
|
||||
powerupbox.get_factory().powerup_material),
|
||||
actions=(("modify_part_collision", "physical", False),
|
||||
("message", "their_node", "at_connect", ba.DieMessage())))
|
||||
actions=(('modify_part_collision', 'physical', False),
|
||||
('message', 'their_node', 'at_connect', ba.DieMessage())))
|
||||
self._score_region_material = ba.Material()
|
||||
self._score_region_material.add_actions(
|
||||
conditions=("they_have_material", self.puck_material),
|
||||
actions=(("modify_part_collision", "collide",
|
||||
True), ("modify_part_collision", "physical", False),
|
||||
("call", "at_connect", self._handle_score)))
|
||||
conditions=('they_have_material', self.puck_material),
|
||||
actions=(('modify_part_collision', 'collide',
|
||||
True), ('modify_part_collision', 'physical', False),
|
||||
('call', 'at_connect', self._handle_score)))
|
||||
self._puck_spawn_pos: Optional[Sequence[float]] = None
|
||||
self._score_regions: Optional[List[ba.NodeActor]] = None
|
||||
self._puck: Optional[Puck] = None
|
||||
@ -224,20 +224,20 @@ class HockeyGame(ba.TeamGameActivity):
|
||||
self._score_regions = []
|
||||
self._score_regions.append(
|
||||
ba.NodeActor(
|
||||
ba.newnode("region",
|
||||
ba.newnode('region',
|
||||
attrs={
|
||||
'position': defs.boxes["goal1"][0:3],
|
||||
'scale': defs.boxes["goal1"][6:9],
|
||||
'type': "box",
|
||||
'position': defs.boxes['goal1'][0:3],
|
||||
'scale': defs.boxes['goal1'][6:9],
|
||||
'type': 'box',
|
||||
'materials': [self._score_region_material]
|
||||
})))
|
||||
self._score_regions.append(
|
||||
ba.NodeActor(
|
||||
ba.newnode("region",
|
||||
ba.newnode('region',
|
||||
attrs={
|
||||
'position': defs.boxes["goal2"][0:3],
|
||||
'scale': defs.boxes["goal2"][6:9],
|
||||
'type': "box",
|
||||
'position': defs.boxes['goal2'][0:3],
|
||||
'scale': defs.boxes['goal2'][6:9],
|
||||
'type': 'box',
|
||||
'materials': [self._score_region_material]
|
||||
})))
|
||||
self._update_scoreboard()
|
||||
@ -272,7 +272,7 @@ class HockeyGame(ba.TeamGameActivity):
|
||||
if self._puck.scored:
|
||||
return
|
||||
|
||||
region = ba.get_collision_info("source_node")
|
||||
region = ba.get_collision_info('source_node')
|
||||
index = 0
|
||||
for index in range(len(self._score_regions)):
|
||||
if region == self._score_regions[index].node:
|
||||
|
||||
@ -71,18 +71,18 @@ class KeepAwayGame(ba.TeamGameActivity):
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [
|
||||
("Hold Time", {
|
||||
('Hold Time', {
|
||||
'min_value': 10,
|
||||
'default': 30,
|
||||
'increment': 10
|
||||
}),
|
||||
("Time Limit", {
|
||||
('Time Limit', {
|
||||
'choices': [('None', 0), ('1 Minute', 60), ('2 Minutes', 120),
|
||||
('5 Minutes', 300), ('10 Minutes', 600),
|
||||
('20 Minutes', 1200)],
|
||||
'default': 0
|
||||
}),
|
||||
("Respawn Times", {
|
||||
('Respawn Times', {
|
||||
'choices': [('Shorter', 0.25), ('Short', 0.5), ('Normal', 1.0),
|
||||
('Long', 2.0), ('Longer', 4.0)],
|
||||
'default': 1.0
|
||||
@ -93,7 +93,7 @@ class KeepAwayGame(ba.TeamGameActivity):
|
||||
from bastd.actor.scoreboard import Scoreboard
|
||||
super().__init__(settings)
|
||||
self._scoreboard = Scoreboard()
|
||||
self._swipsound = ba.getsound("swip")
|
||||
self._swipsound = ba.getsound('swip')
|
||||
self._tick_sound = ba.getsound('tick')
|
||||
self._countdownsounds = {
|
||||
10: ba.getsound('announceTen'),
|
||||
@ -128,7 +128,7 @@ class KeepAwayGame(ba.TeamGameActivity):
|
||||
super().on_transition_in()
|
||||
|
||||
def on_team_join(self, team: ba.Team) -> None:
|
||||
team.gamedata['time_remaining'] = self.settings["Hold Time"]
|
||||
team.gamedata['time_remaining'] = self.settings['Hold Time']
|
||||
self._update_scoreboard()
|
||||
|
||||
def on_begin(self) -> None:
|
||||
@ -200,7 +200,7 @@ class KeepAwayGame(ba.TeamGameActivity):
|
||||
holding_flag = (
|
||||
player.actor.node.hold_node.getnodetype() == 'flag')
|
||||
except Exception:
|
||||
ba.print_exception("exception checking hold flag")
|
||||
ba.print_exception('exception checking hold flag')
|
||||
if holding_flag:
|
||||
self._holding_players.append(player)
|
||||
player.team.gamedata['holding_flag'] = True
|
||||
|
||||
@ -65,24 +65,24 @@ class KingOfTheHillGame(ba.TeamGameActivity):
|
||||
|
||||
@classmethod
|
||||
def get_supported_maps(cls, sessiontype: Type[ba.Session]) -> List[str]:
|
||||
return ba.getmaps("king_of_the_hill")
|
||||
return ba.getmaps('king_of_the_hill')
|
||||
|
||||
@classmethod
|
||||
def get_settings(
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [("Hold Time", {
|
||||
return [('Hold Time', {
|
||||
'min_value': 10,
|
||||
'default': 30,
|
||||
'increment': 10
|
||||
}),
|
||||
("Time Limit", {
|
||||
('Time Limit', {
|
||||
'choices': [('None', 0), ('1 Minute', 60),
|
||||
('2 Minutes', 120), ('5 Minutes', 300),
|
||||
('10 Minutes', 600), ('20 Minutes', 1200)],
|
||||
'default': 0
|
||||
}),
|
||||
("Respawn Times", {
|
||||
('Respawn Times', {
|
||||
'choices': [('Shorter', 0.25), ('Short', 0.5),
|
||||
('Normal', 1.0), ('Long', 2.0),
|
||||
('Longer', 4.0)],
|
||||
@ -93,7 +93,7 @@ class KingOfTheHillGame(ba.TeamGameActivity):
|
||||
from bastd.actor.scoreboard import Scoreboard
|
||||
super().__init__(settings)
|
||||
self._scoreboard = Scoreboard()
|
||||
self._swipsound = ba.getsound("swip")
|
||||
self._swipsound = ba.getsound('swip')
|
||||
self._tick_sound = ba.getsound('tick')
|
||||
self._countdownsounds = {
|
||||
10: ba.getsound('announceTen'),
|
||||
@ -115,12 +115,12 @@ class KingOfTheHillGame(ba.TeamGameActivity):
|
||||
|
||||
self._flag_region_material = ba.Material()
|
||||
self._flag_region_material.add_actions(
|
||||
conditions=("they_have_material", ba.sharedobj('player_material')),
|
||||
actions=(("modify_part_collision", "collide",
|
||||
True), ("modify_part_collision", "physical", False),
|
||||
("call", "at_connect",
|
||||
conditions=('they_have_material', ba.sharedobj('player_material')),
|
||||
actions=(('modify_part_collision', 'collide',
|
||||
True), ('modify_part_collision', 'physical', False),
|
||||
('call', 'at_connect',
|
||||
ba.Call(self._handle_player_flag_region_collide, True)),
|
||||
("call", "at_disconnect",
|
||||
('call', 'at_disconnect',
|
||||
ba.Call(self._handle_player_flag_region_collide,
|
||||
False))))
|
||||
|
||||
@ -137,7 +137,7 @@ class KingOfTheHillGame(ba.TeamGameActivity):
|
||||
super().on_transition_in()
|
||||
|
||||
def on_team_join(self, team: ba.Team) -> None:
|
||||
team.gamedata['time_remaining'] = self.settings["Hold Time"]
|
||||
team.gamedata['time_remaining'] = self.settings['Hold Time']
|
||||
self._update_scoreboard()
|
||||
|
||||
def on_player_join(self, player: ba.Player) -> None:
|
||||
@ -253,7 +253,7 @@ class KingOfTheHillGame(ba.TeamGameActivity):
|
||||
ba.playsound(self._swipsound)
|
||||
|
||||
def _handle_player_flag_region_collide(self, colliding: bool) -> None:
|
||||
playernode = ba.get_collision_info("opposing_node")
|
||||
playernode = ba.get_collision_info('opposing_node')
|
||||
try:
|
||||
player = playernode.getdelegate().getplayer()
|
||||
except Exception:
|
||||
|
||||
@ -66,7 +66,7 @@ class MeteorShowerGame(ba.TeamGameActivity):
|
||||
def get_settings(
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [("Epic Mode", {'default': False})]
|
||||
return [('Epic Mode', {'default': False})]
|
||||
|
||||
# We support teams, free-for-all, and co-op sessions.
|
||||
@classmethod
|
||||
|
||||
@ -76,7 +76,7 @@ class NinjaFightGame(ba.TeamGameActivity):
|
||||
# ...but not actually create anything yet.
|
||||
def __init__(self, settings: Dict[str, Any]):
|
||||
super().__init__(settings)
|
||||
self._winsound = ba.getsound("score")
|
||||
self._winsound = ba.getsound('score')
|
||||
self._won = False
|
||||
self._timer: Optional[onscreentimer.OnScreenTimer] = None
|
||||
self._bots = spazbot.BotSet()
|
||||
|
||||
@ -58,7 +58,7 @@ class OnslaughtGame(ba.CoopGameActivity):
|
||||
|
||||
@classmethod
|
||||
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
|
||||
return "Defeat all enemies."
|
||||
return 'Defeat all enemies.'
|
||||
|
||||
def __init__(self, settings: Dict[str, Any]):
|
||||
|
||||
@ -81,7 +81,7 @@ class OnslaughtGame(ba.CoopGameActivity):
|
||||
self.announce_player_deaths = True
|
||||
|
||||
self._new_wave_sound = ba.getsound('scoreHit01')
|
||||
self._winsound = ba.getsound("score")
|
||||
self._winsound = ba.getsound('score')
|
||||
self._cashregistersound = ba.getsound('cashRegister')
|
||||
self._a_player_has_been_hurt = False
|
||||
self._player_has_dropped_bomb = False
|
||||
@ -98,7 +98,7 @@ class OnslaughtGame(ba.CoopGameActivity):
|
||||
self._powerup_center = (0, 5, -1.6)
|
||||
self._powerup_spread = (4.6, 2.7)
|
||||
else:
|
||||
raise Exception("Unsupported map: " + str(settings['map']))
|
||||
raise Exception('Unsupported map: ' + str(settings['map']))
|
||||
self._scoreboard: Optional[Scoreboard] = None
|
||||
self._game_over = False
|
||||
self._wave = 0
|
||||
@ -136,8 +136,8 @@ class OnslaughtGame(ba.CoopGameActivity):
|
||||
ba.getsession( # type: ignore
|
||||
)._g_showed_onslaught_land_mine_tip = True
|
||||
self.tips = [{
|
||||
'tip': "Land-mines are a good way"
|
||||
" to stop speedy enemies.",
|
||||
'tip': 'Land-mines are a good way'
|
||||
' to stop speedy enemies.',
|
||||
'icon': ba.gettexture('powerupLandMines'),
|
||||
'sound': ba.getsound('ding')
|
||||
}]
|
||||
@ -150,8 +150,8 @@ class OnslaughtGame(ba.CoopGameActivity):
|
||||
ba.getsession( # type: ignore
|
||||
)._g_showed_onslaught_tnt_tip = True
|
||||
self.tips = [{
|
||||
'tip': "Take out a group of enemies by\n"
|
||||
"setting off a bomb near a TNT box.",
|
||||
'tip': 'Take out a group of enemies by\n'
|
||||
'setting off a bomb near a TNT box.',
|
||||
'icon': ba.gettexture('tnt'),
|
||||
'sound': ba.getsound('ding')
|
||||
}]
|
||||
@ -164,18 +164,18 @@ class OnslaughtGame(ba.CoopGameActivity):
|
||||
ba.getsession( # type: ignore
|
||||
)._g_showed_onslaught_curse_tip = True
|
||||
self.tips = [{
|
||||
'tip': "Curse boxes turn you into a ticking time bomb.\n"
|
||||
"The only cure is to quickly grab a health-pack.",
|
||||
'tip': 'Curse boxes turn you into a ticking time bomb.\n'
|
||||
'The only cure is to quickly grab a health-pack.',
|
||||
'icon': ba.gettexture('powerupCurse'),
|
||||
'sound': ba.getsound('ding')
|
||||
}]
|
||||
|
||||
self._spawn_info_text = ba.NodeActor(
|
||||
ba.newnode("text",
|
||||
ba.newnode('text',
|
||||
attrs={
|
||||
'position': (15, -130),
|
||||
'h_attach': "left",
|
||||
'v_attach': "top",
|
||||
'h_attach': 'left',
|
||||
'v_attach': 'top',
|
||||
'scale': 0.55,
|
||||
'color': (0.3, 0.8, 0.3, 1.0),
|
||||
'text': ''
|
||||
@ -481,7 +481,7 @@ class OnslaughtGame(ba.CoopGameActivity):
|
||||
self._waves = []
|
||||
|
||||
else:
|
||||
raise Exception("Invalid preset: " + str(self._preset))
|
||||
raise Exception('Invalid preset: ' + str(self._preset))
|
||||
|
||||
# FIXME: Should migrate to use setup_standard_powerup_drops().
|
||||
|
||||
@ -976,19 +976,19 @@ class OnslaughtGame(ba.CoopGameActivity):
|
||||
for i in range(entry[1]):
|
||||
if split and i % 2 == 0:
|
||||
entries.insert(0, {
|
||||
"type": bot_type,
|
||||
"spacing": spacing
|
||||
'type': bot_type,
|
||||
'spacing': spacing
|
||||
})
|
||||
else:
|
||||
entries.append({
|
||||
"type": bot_type,
|
||||
"spacing": spacing
|
||||
'type': bot_type,
|
||||
'spacing': spacing
|
||||
})
|
||||
if entries:
|
||||
all_entries += entries
|
||||
all_entries.append({
|
||||
"type": None,
|
||||
"spacing": 40 if random.random() < 0.5 else 80
|
||||
'type': None,
|
||||
'spacing': 40 if random.random() < 0.5 else 80
|
||||
})
|
||||
|
||||
angle_rand = random.random()
|
||||
|
||||
@ -61,7 +61,7 @@ class RaceRegion(ba.Actor):
|
||||
attrs={
|
||||
'position': pt[:3],
|
||||
'scale': (pt[3] * 2.0, pt[4] * 2.0, pt[5] * 2.0),
|
||||
'type': "box",
|
||||
'type': 'box',
|
||||
'materials': [activity.race_region_material]
|
||||
})
|
||||
|
||||
@ -383,7 +383,7 @@ class RaceGame(ba.TeamGameActivity):
|
||||
if otherplayer.actor is not None:
|
||||
otherplayer.actor.handlemessage(ba.DieMessage())
|
||||
except Exception:
|
||||
ba.print_exception("Error sending diemessages")
|
||||
ba.print_exception('Error sending diemessages')
|
||||
|
||||
# Defer so team/player lists will be updated.
|
||||
ba.pushcall(self._check_end_game)
|
||||
|
||||
@ -70,7 +70,7 @@ class RunaroundGame(ba.CoopGameActivity):
|
||||
|
||||
@classmethod
|
||||
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
|
||||
return "Prevent enemies from reaching the exit."
|
||||
return 'Prevent enemies from reaching the exit.'
|
||||
|
||||
def __init__(self, settings: Dict[str, Any]):
|
||||
settings['map'] = 'Tower D'
|
||||
@ -79,9 +79,9 @@ class RunaroundGame(ba.CoopGameActivity):
|
||||
|
||||
self._player_death_sound = ba.getsound('playerDeath')
|
||||
self._new_wave_sound = ba.getsound('scoreHit01')
|
||||
self._winsound = ba.getsound("score")
|
||||
self._winsound = ba.getsound('score')
|
||||
self._cashregistersound = ba.getsound('cashRegister')
|
||||
self._bad_guy_score_sound = ba.getsound("shieldDown")
|
||||
self._bad_guy_score_sound = ba.getsound('shieldDown')
|
||||
self._heart_tex = ba.gettexture('heart')
|
||||
self._heart_model_opaque = ba.getmodel('heartOpaque')
|
||||
self._heart_model_transparent = ba.getmodel('heartTransparent')
|
||||
@ -96,10 +96,10 @@ class RunaroundGame(ba.CoopGameActivity):
|
||||
|
||||
self._score_region_material = ba.Material()
|
||||
self._score_region_material.add_actions(
|
||||
conditions=("they_have_material", ba.sharedobj('player_material')),
|
||||
actions=(("modify_part_collision", "collide",
|
||||
True), ("modify_part_collision", "physical", False),
|
||||
("call", "at_connect", self._handle_reached_end)))
|
||||
conditions=('they_have_material', ba.sharedobj('player_material')),
|
||||
actions=(('modify_part_collision', 'collide',
|
||||
True), ('modify_part_collision', 'physical', False),
|
||||
('call', 'at_connect', self._handle_reached_end)))
|
||||
|
||||
self._last_wave_end_time = ba.time()
|
||||
self._player_has_picked_up_powerup = False
|
||||
@ -398,7 +398,7 @@ class RunaroundGame(ba.CoopGameActivity):
|
||||
ba.timer(2.0, self._start_updating_waves)
|
||||
|
||||
def _handle_reached_end(self) -> None:
|
||||
oppnode = ba.get_collision_info("opposing_node")
|
||||
oppnode = ba.get_collision_info('opposing_node')
|
||||
spaz = oppnode.getdelegate()
|
||||
|
||||
if not spaz.is_alive():
|
||||
|
||||
@ -63,12 +63,12 @@ class TargetPracticeGame(ba.TeamGameActivity):
|
||||
def get_settings(
|
||||
cls,
|
||||
sessiontype: Type[ba.Session]) -> List[Tuple[str, Dict[str, Any]]]:
|
||||
return [("Target Count", {
|
||||
return [('Target Count', {
|
||||
'min_value': 1,
|
||||
'default': 3
|
||||
}), ("Enable Impact Bombs", {
|
||||
}), ('Enable Impact Bombs', {
|
||||
'default': True
|
||||
}), ("Enable Triple Bombs", {
|
||||
}), ('Enable Triple Bombs', {
|
||||
'default': True
|
||||
})]
|
||||
|
||||
@ -345,7 +345,7 @@ class Target(ba.Actor):
|
||||
|
||||
# Award points/etc.. (technically should probably leave this up
|
||||
# to the activity).
|
||||
popupstr = "+" + str(points)
|
||||
popupstr = '+' + str(points)
|
||||
|
||||
# If there's more than 1 player in the game, include their
|
||||
# names and colors so they know who got the hit.
|
||||
|
||||
@ -49,7 +49,7 @@ class TheLastStandGame(ba.CoopGameActivity):
|
||||
|
||||
@classmethod
|
||||
def get_description(cls, sessiontype: Type[ba.Session]) -> str:
|
||||
return "Final glorious epic slow motion battle to the death."
|
||||
return 'Final glorious epic slow motion battle to the death.'
|
||||
|
||||
def __init__(self, settings: Dict[str, Any]):
|
||||
settings['map'] = 'Rampage'
|
||||
@ -62,7 +62,7 @@ class TheLastStandGame(ba.CoopGameActivity):
|
||||
self.slow_motion = True
|
||||
|
||||
self._new_wave_sound = ba.getsound('scoreHit01')
|
||||
self._winsound = ba.getsound("score")
|
||||
self._winsound = ba.getsound('score')
|
||||
self._cashregistersound = ba.getsound('cashRegister')
|
||||
self._spawn_center = (0, 5.5, -4.14)
|
||||
self._tntspawnpos = (0, 5.5, -6)
|
||||
|
||||
@ -348,7 +348,7 @@ class MainMenuActivity(ba.Activity):
|
||||
spc + self._message_duration: 0.0
|
||||
}
|
||||
assert self._text.node
|
||||
ba.animate(self._text.node, "opacity", keys)
|
||||
ba.animate(self._text.node, 'opacity', keys)
|
||||
# {k: v
|
||||
# for k, v in list(keys.items())})
|
||||
self._text.node.text = val
|
||||
@ -692,13 +692,13 @@ class MainMenuActivity(ba.Activity):
|
||||
cmb: Optional[ba.Node]
|
||||
cmb2: Optional[ba.Node]
|
||||
if not shadow:
|
||||
cmb = ba.newnode("combine",
|
||||
cmb = ba.newnode('combine',
|
||||
owner=word_obj.node,
|
||||
attrs={'size': 2})
|
||||
else:
|
||||
cmb = None
|
||||
if shadow:
|
||||
cmb2 = ba.newnode("combine",
|
||||
cmb2 = ba.newnode('combine',
|
||||
owner=word_obj.node,
|
||||
attrs={'size': 2})
|
||||
else:
|
||||
@ -719,9 +719,9 @@ class MainMenuActivity(ba.Activity):
|
||||
keys2[time_v * self._ts] = val2 + 5
|
||||
time_v += random.random() * 0.1
|
||||
if cmb is not None:
|
||||
ba.animate(cmb, "input0", keys, loop=True)
|
||||
ba.animate(cmb, 'input0', keys, loop=True)
|
||||
if cmb2 is not None:
|
||||
ba.animate(cmb2, "input0", keys2, loop=True)
|
||||
ba.animate(cmb2, 'input0', keys2, loop=True)
|
||||
keys = {}
|
||||
keys2 = {}
|
||||
time_v = 0
|
||||
@ -732,20 +732,20 @@ class MainMenuActivity(ba.Activity):
|
||||
keys2[time_v * self._ts] = val2 - 9
|
||||
time_v += random.random() * 0.1
|
||||
if cmb is not None:
|
||||
ba.animate(cmb, "input1", keys, loop=True)
|
||||
ba.animate(cmb, 'input1', keys, loop=True)
|
||||
if cmb2 is not None:
|
||||
ba.animate(cmb2, "input1", keys2, loop=True)
|
||||
ba.animate(cmb2, 'input1', keys2, loop=True)
|
||||
|
||||
if not shadow:
|
||||
assert word_obj.node
|
||||
ba.animate(word_obj.node, "project_scale", {
|
||||
ba.animate(word_obj.node, 'project_scale', {
|
||||
delay: 0.0,
|
||||
delay + 0.1: scale * 1.1,
|
||||
delay + 0.2: scale
|
||||
})
|
||||
else:
|
||||
assert word_obj.node
|
||||
ba.animate(word_obj.node, "project_scale", {
|
||||
ba.animate(word_obj.node, 'project_scale', {
|
||||
delay: 0.0,
|
||||
delay + 0.1: scale * 1.1,
|
||||
delay + 0.2: scale
|
||||
@ -784,7 +784,7 @@ class MainMenuActivity(ba.Activity):
|
||||
'model_transparent': mtrans,
|
||||
'vr_depth': -10 + vr_depth_offset,
|
||||
'rotate': rotate,
|
||||
'attach': "center",
|
||||
'attach': 'center',
|
||||
'tilt_translate': 0.21,
|
||||
'absolute_scale': True
|
||||
}))
|
||||
@ -796,7 +796,7 @@ class MainMenuActivity(ba.Activity):
|
||||
# leave things still).
|
||||
assert logo.node
|
||||
if not ba.app.vr_mode:
|
||||
cmb = ba.newnode("combine", owner=logo.node, attrs={'size': 2})
|
||||
cmb = ba.newnode('combine', owner=logo.node, attrs={'size': 2})
|
||||
cmb.connectattr('output', logo.node, 'position')
|
||||
keys = {}
|
||||
time_v = 0.0
|
||||
@ -805,27 +805,27 @@ class MainMenuActivity(ba.Activity):
|
||||
for _i in range(10):
|
||||
keys[time_v] = x + (random.random() - 0.5) * 0.7 * jitter_scale
|
||||
time_v += random.random() * 0.1
|
||||
ba.animate(cmb, "input0", keys, loop=True)
|
||||
ba.animate(cmb, 'input0', keys, loop=True)
|
||||
keys = {}
|
||||
time_v = 0.0
|
||||
for _i in range(10):
|
||||
keys[time_v * self._ts] = y + (random.random() -
|
||||
0.5) * 0.7 * jitter_scale
|
||||
time_v += random.random() * 0.1
|
||||
ba.animate(cmb, "input1", keys, loop=True)
|
||||
ba.animate(cmb, 'input1', keys, loop=True)
|
||||
else:
|
||||
logo.node.position = (x, y)
|
||||
|
||||
cmb = ba.newnode("combine", owner=logo.node, attrs={"size": 2})
|
||||
cmb = ba.newnode('combine', owner=logo.node, attrs={'size': 2})
|
||||
|
||||
keys = {
|
||||
delay: 0.0,
|
||||
delay + 0.1: 700.0 * scale,
|
||||
delay + 0.2: 600.0 * scale
|
||||
}
|
||||
ba.animate(cmb, "input0", keys)
|
||||
ba.animate(cmb, "input1", keys)
|
||||
cmb.connectattr("output", logo.node, "scale")
|
||||
ba.animate(cmb, 'input0', keys)
|
||||
ba.animate(cmb, 'input1', keys)
|
||||
cmb.connectattr('output', logo.node, 'scale')
|
||||
|
||||
def _start_preloads(self) -> None:
|
||||
# FIXME: The func that calls us back doesn't save/restore state
|
||||
@ -850,14 +850,14 @@ def _preload1() -> None:
|
||||
'scrollWidgetShort', 'windowBGBlotch'
|
||||
]:
|
||||
ba.getmodel(mname)
|
||||
for tname in ["playerLineup", "lock"]:
|
||||
for tname in ['playerLineup', 'lock']:
|
||||
ba.gettexture(tname)
|
||||
for tex in [
|
||||
'iconRunaround', 'iconOnslaught', 'medalComplete', 'medalBronze',
|
||||
'medalSilver', 'medalGold', 'characterIconMask'
|
||||
]:
|
||||
ba.gettexture(tex)
|
||||
ba.gettexture("bg")
|
||||
ba.gettexture('bg')
|
||||
from bastd.actor import powerupbox
|
||||
powerupbox.get_factory()
|
||||
ba.timer(0.1, _preload2)
|
||||
@ -867,17 +867,17 @@ def _preload2() -> None:
|
||||
# FIXME: Could integrate these loads with the classes that use them
|
||||
# so they don't have to redundantly call the load
|
||||
# (even if the actual result is cached).
|
||||
for mname in ["powerup", "powerupSimple"]:
|
||||
for mname in ['powerup', 'powerupSimple']:
|
||||
ba.getmodel(mname)
|
||||
for tname in [
|
||||
"powerupBomb", "powerupSpeed", "powerupPunch", "powerupIceBombs",
|
||||
"powerupStickyBombs", "powerupShield", "powerupImpactBombs",
|
||||
"powerupHealth"
|
||||
'powerupBomb', 'powerupSpeed', 'powerupPunch', 'powerupIceBombs',
|
||||
'powerupStickyBombs', 'powerupShield', 'powerupImpactBombs',
|
||||
'powerupHealth'
|
||||
]:
|
||||
ba.gettexture(tname)
|
||||
for sname in [
|
||||
"powerup01", "boxDrop", "boxingBell", "scoreHit01", "scoreHit02",
|
||||
"dripity", "spawn", "gong"
|
||||
'powerup01', 'boxDrop', 'boxingBell', 'scoreHit01', 'scoreHit02',
|
||||
'dripity', 'spawn', 'gong'
|
||||
]:
|
||||
ba.getsound(sname)
|
||||
from bastd.actor import bomb
|
||||
@ -886,14 +886,14 @@ def _preload2() -> None:
|
||||
|
||||
|
||||
def _preload3() -> None:
|
||||
for mname in ["bomb", "bombSticky", "impactBomb"]:
|
||||
for mname in ['bomb', 'bombSticky', 'impactBomb']:
|
||||
ba.getmodel(mname)
|
||||
for tname in [
|
||||
"bombColor", "bombColorIce", "bombStickyColor", "impactBombColor",
|
||||
"impactBombColorLit"
|
||||
'bombColor', 'bombColorIce', 'bombStickyColor', 'impactBombColor',
|
||||
'impactBombColorLit'
|
||||
]:
|
||||
ba.gettexture(tname)
|
||||
for sname in ["freeze", "fuse01", "activateBeep", "warnBeep"]:
|
||||
for sname in ['freeze', 'fuse01', 'activateBeep', 'warnBeep']:
|
||||
ba.getsound(sname)
|
||||
spaz.get_factory()
|
||||
ba.timer(0.2, _preload4)
|
||||
|
||||
@ -37,7 +37,7 @@ class HockeyStadium(ba.Map):
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from bastd.mapdata import hockey_stadium as defs
|
||||
name = "Hockey Stadium"
|
||||
name = 'Hockey Stadium'
|
||||
|
||||
@classmethod
|
||||
def get_play_types(cls) -> List[str]:
|
||||
@ -66,7 +66,7 @@ class HockeyStadium(ba.Map):
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.node = ba.newnode("terrain",
|
||||
self.node = ba.newnode('terrain',
|
||||
delegate=self,
|
||||
attrs={
|
||||
'model':
|
||||
@ -91,20 +91,20 @@ class HockeyStadium(ba.Map):
|
||||
mats = [
|
||||
ba.sharedobj('footing_material'), self.preloaddata['ice_material']
|
||||
]
|
||||
self.floor = ba.newnode("terrain",
|
||||
self.floor = ba.newnode('terrain',
|
||||
attrs={
|
||||
"model": self.preloaddata['models'][1],
|
||||
"color_texture": self.preloaddata['tex'],
|
||||
"opacity": 0.92,
|
||||
"opacity_in_low_or_medium_quality": 1.0,
|
||||
"materials": mats
|
||||
'model': self.preloaddata['models'][1],
|
||||
'color_texture': self.preloaddata['tex'],
|
||||
'opacity': 0.92,
|
||||
'opacity_in_low_or_medium_quality': 1.0,
|
||||
'materials': mats
|
||||
})
|
||||
self.stands = ba.newnode(
|
||||
"terrain",
|
||||
'terrain',
|
||||
attrs={
|
||||
"model": self.preloaddata['models'][2],
|
||||
"visible_in_reflections": False,
|
||||
"color_texture": self.preloaddata['stands_tex']
|
||||
'model': self.preloaddata['models'][2],
|
||||
'visible_in_reflections': False,
|
||||
'color_texture': self.preloaddata['stands_tex']
|
||||
})
|
||||
gnode = ba.sharedobj('globals')
|
||||
gnode.floor_reflection = True
|
||||
@ -123,7 +123,7 @@ class FootballStadium(ba.Map):
|
||||
"""Stadium map for football games."""
|
||||
from bastd.mapdata import football_stadium as defs
|
||||
|
||||
name = "Football Stadium"
|
||||
name = 'Football Stadium'
|
||||
|
||||
@classmethod
|
||||
def get_play_types(cls) -> List[str]:
|
||||
@ -137,10 +137,10 @@ class FootballStadium(ba.Map):
|
||||
@classmethod
|
||||
def on_preload(cls) -> Any:
|
||||
data: Dict[str, Any] = {
|
||||
'model': ba.getmodel("footballStadium"),
|
||||
'model': ba.getmodel('footballStadium'),
|
||||
'vr_fill_model': ba.getmodel('footballStadiumVRFill'),
|
||||
'collide_model': ba.getcollidemodel("footballStadiumCollide"),
|
||||
'tex': ba.gettexture("footballStadium")
|
||||
'collide_model': ba.getcollidemodel('footballStadiumCollide'),
|
||||
'tex': ba.gettexture('footballStadium')
|
||||
}
|
||||
return data
|
||||
|
||||
@ -202,16 +202,16 @@ class Bridgit(ba.Map):
|
||||
@classmethod
|
||||
def on_preload(cls) -> Any:
|
||||
data: Dict[str, Any] = {
|
||||
'model_top': ba.getmodel("bridgitLevelTop"),
|
||||
'model_bottom': ba.getmodel("bridgitLevelBottom"),
|
||||
'model_bg': ba.getmodel("natureBackground"),
|
||||
'model_top': ba.getmodel('bridgitLevelTop'),
|
||||
'model_bottom': ba.getmodel('bridgitLevelBottom'),
|
||||
'model_bg': ba.getmodel('natureBackground'),
|
||||
'bg_vr_fill_model': ba.getmodel('natureBackgroundVRFill'),
|
||||
'collide_model': ba.getcollidemodel("bridgitLevelCollide"),
|
||||
'tex': ba.gettexture("bridgitLevelColor"),
|
||||
'model_bg_tex': ba.gettexture("natureBackgroundColor"),
|
||||
'collide_bg': ba.getcollidemodel("natureBackgroundCollide"),
|
||||
'collide_model': ba.getcollidemodel('bridgitLevelCollide'),
|
||||
'tex': ba.gettexture('bridgitLevelColor'),
|
||||
'model_bg_tex': ba.gettexture('natureBackgroundColor'),
|
||||
'collide_bg': ba.getcollidemodel('natureBackgroundCollide'),
|
||||
'railing_collide_model':
|
||||
(ba.getcollidemodel("bridgitLevelRailingCollide")),
|
||||
(ba.getcollidemodel('bridgitLevelRailingCollide')),
|
||||
'bg_material': ba.Material()
|
||||
}
|
||||
data['bg_material'].add_actions(actions=('modify_part_collision',
|
||||
|
||||
@ -94,7 +94,7 @@ class ButtonPress:
|
||||
img = None
|
||||
color = None
|
||||
else:
|
||||
raise Exception(f"invalid button: {self._button}")
|
||||
raise Exception(f'invalid button: {self._button}')
|
||||
|
||||
brightness = 4.0
|
||||
if color is not None:
|
||||
@ -167,7 +167,7 @@ class ButtonRelease:
|
||||
img = None
|
||||
color = None
|
||||
else:
|
||||
raise Exception("invalid button: " + self._button)
|
||||
raise Exception('invalid button: ' + self._button)
|
||||
if self._delay == 0:
|
||||
call()
|
||||
else:
|
||||
@ -445,8 +445,8 @@ class TutorialActivity(ba.Activity):
|
||||
diff = tval
|
||||
a.cycle_times.append(diff)
|
||||
ba.screenmessage(
|
||||
"cycle time: " + str(diff) + " (average: " +
|
||||
str(sum(a.cycle_times) / len(a.cycle_times)) + ")")
|
||||
'cycle time: ' + str(diff) + ' (average: ' +
|
||||
str(sum(a.cycle_times) / len(a.cycle_times)) + ')')
|
||||
tval = ba.time(ba.TimeType.REAL,
|
||||
ba.TimeFormat.MILLISECONDS)
|
||||
assert isinstance(tval, int)
|
||||
@ -823,7 +823,7 @@ class TutorialActivity(ba.Activity):
|
||||
elif self._celebrate_type == 'both':
|
||||
s.node.handlemessage('celebrate', self._duration)
|
||||
else:
|
||||
raise Exception("invalid celebrate type " +
|
||||
raise Exception('invalid celebrate type ' +
|
||||
self._celebrate_type)
|
||||
|
||||
self._entries = [
|
||||
@ -2275,7 +2275,7 @@ class TutorialActivity(ba.Activity):
|
||||
Celebrate(),
|
||||
DelayOld(2000),
|
||||
KillSpaz(1),
|
||||
Text(""),
|
||||
Text(''),
|
||||
Move(0.5, -0.5),
|
||||
DelayOld(1000),
|
||||
Move(0, -0.1),
|
||||
@ -2389,7 +2389,7 @@ class TutorialActivity(ba.Activity):
|
||||
|
||||
# test...
|
||||
if not all(self.players):
|
||||
ba.print_error("Nonexistent player in _player_pressed_button: " +
|
||||
ba.print_error('Nonexistent player in _player_pressed_button: ' +
|
||||
str([str(p) for p in self.players]) + ': we are ' +
|
||||
str(player))
|
||||
|
||||
@ -2412,7 +2412,7 @@ class TutorialActivity(ba.Activity):
|
||||
|
||||
def on_player_leave(self, player: ba.Player) -> None:
|
||||
if not all(self.players):
|
||||
ba.print_error("Nonexistent player in on_player_leave: " +
|
||||
ba.print_error('Nonexistent player in on_player_leave: ' +
|
||||
str([str(p) for p in self.players]) + ': we are ' +
|
||||
str(player))
|
||||
super().on_player_leave(player)
|
||||
|
||||
@ -156,8 +156,8 @@ class AccountLinkCodeWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=(1.0, 3.0, 1.0),
|
||||
scale=2.0,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=data['code'],
|
||||
maxwidth=self._width * 0.85)
|
||||
|
||||
|
||||
@ -140,8 +140,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||
color=ba.app.title_color,
|
||||
maxwidth=self._width - 340,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
|
||||
self._scrollwidget = ba.scrollwidget(
|
||||
parent=self._root_widget,
|
||||
@ -346,8 +346,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
color=(0.5, 0.5, 0.6),
|
||||
maxwidth=self._sub_width * 0.9,
|
||||
flatness=1.0,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
v -= local_signed_in_as_space * 0.4
|
||||
|
||||
self._account_name_text: Optional[ba.Widget]
|
||||
@ -363,8 +363,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
scale=0.9,
|
||||
color=ba.app.title_color,
|
||||
maxwidth=self._sub_width * 0.9,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
v -= signed_in_as_space * 0.4
|
||||
self._account_name_text = ba.textwidget(
|
||||
parent=self._subcontainer,
|
||||
@ -374,8 +374,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
maxwidth=self._sub_width * 0.9,
|
||||
res_scale=1.5,
|
||||
color=(1, 1, 1, 1),
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
self._refresh_account_name_text()
|
||||
v -= signed_in_as_space * 0.4
|
||||
else:
|
||||
@ -412,8 +412,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
scale=0.9,
|
||||
color=(0.75, 0.7, 0.8),
|
||||
maxwidth=self._sub_width * 0.8,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
|
||||
if show_signing_in_text:
|
||||
v -= signing_in_text_space
|
||||
@ -427,8 +427,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
scale=0.9,
|
||||
color=(0, 1, 0),
|
||||
maxwidth=self._sub_width * 0.8,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
|
||||
if show_google_play_sign_in_button:
|
||||
button_width = 350
|
||||
@ -658,8 +658,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
scale=0.9,
|
||||
color=(0.75, 0.7, 0.8),
|
||||
maxwidth=self._sub_width * 0.8,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
v -= achievements_text_space * 0.5
|
||||
else:
|
||||
self._achievements_text = None
|
||||
@ -728,8 +728,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
scale=0.9,
|
||||
color=(0.75, 0.7, 0.8),
|
||||
maxwidth=self._sub_width * 0.8,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
v -= campaign_progress_space * 0.5
|
||||
self._refresh_campaign_progress_text()
|
||||
else:
|
||||
@ -746,8 +746,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
color=(0.75, 0.7, 0.8),
|
||||
maxwidth=self._sub_width * 0.8,
|
||||
flatness=1.0,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
v -= tickets_space * 0.5
|
||||
self._refresh_tickets_text()
|
||||
|
||||
@ -795,8 +795,8 @@ class AccountSettingsWindow(ba.Window):
|
||||
scale=0.9,
|
||||
color=(0.75, 0.7, 0.8),
|
||||
maxwidth=self._sub_width * 0.95,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
v -= linked_accounts_text_space * 0.2
|
||||
self._update_linked_accounts_text()
|
||||
else:
|
||||
@ -1041,7 +1041,7 @@ class AccountSettingsWindow(ba.Window):
|
||||
# pylint: disable=cyclic-import
|
||||
from bastd.ui.profile import browser as pbrowser
|
||||
self._save_state()
|
||||
ba.containerwidget(edit=self._root_widget, transition="out_left")
|
||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||
pbrowser.ProfileBrowserWindow(
|
||||
origin_widget=self._player_profiles_button)
|
||||
|
||||
@ -1105,7 +1105,7 @@ class AccountSettingsWindow(ba.Window):
|
||||
elif sel == self._scrollwidget:
|
||||
sel_name = 'Scroll'
|
||||
else:
|
||||
raise Exception("unrecognized selection")
|
||||
raise Exception('unrecognized selection')
|
||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
||||
except Exception:
|
||||
ba.print_exception('exception saving state for', self.__class__)
|
||||
|
||||
@ -208,7 +208,7 @@ class AccountViewerWindow(popup.PopupWindow):
|
||||
if trophystr == '':
|
||||
trophystr = '-'
|
||||
except Exception:
|
||||
ba.print_exception("Error displaying trophies")
|
||||
ba.print_exception('Error displaying trophies')
|
||||
account_name_spacing = 15
|
||||
tscale = 0.65
|
||||
ts_height = _ba.get_string_height(trophystr,
|
||||
@ -255,7 +255,7 @@ class AccountViewerWindow(popup.PopupWindow):
|
||||
tint2_color=tint2_color)
|
||||
v -= 95
|
||||
except Exception:
|
||||
ba.print_exception("Error displaying character")
|
||||
ba.print_exception('Error displaying character')
|
||||
ba.textwidget(
|
||||
parent=self._subcontainer,
|
||||
size=(0, 0),
|
||||
|
||||
@ -201,8 +201,8 @@ class ShowFriendCodeWindow(ba.Window):
|
||||
color=ba.app.infotextcolor,
|
||||
scale=1.0,
|
||||
flatness=1.0,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource='gatherWindow.shareThisCodeWithFriendsText'),
|
||||
maxwidth=self._width * 0.85)
|
||||
|
||||
@ -211,8 +211,8 @@ class ShowFriendCodeWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=(1.0, 3.0, 1.0),
|
||||
scale=2.0,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=data['code'],
|
||||
maxwidth=self._width * 0.85)
|
||||
|
||||
@ -230,8 +230,8 @@ class ShowFriendCodeWindow(ba.Window):
|
||||
color=ba.app.infotextcolor,
|
||||
scale=1.0,
|
||||
flatness=1.0,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(
|
||||
value='${A}\n${B}\n${C}\n${D}',
|
||||
subs=[
|
||||
|
||||
@ -50,7 +50,7 @@ class ColorPicker(popup.PopupWindow):
|
||||
|
||||
c_raw = get_player_colors()
|
||||
if len(c_raw) != 16:
|
||||
raise Exception("expected 16 player colors")
|
||||
raise Exception('expected 16 player colors')
|
||||
self.colors = [c_raw[0:4], c_raw[4:8], c_raw[8:12], c_raw[12:16]]
|
||||
|
||||
if scale is None:
|
||||
@ -189,7 +189,7 @@ class ColorPickerExact(popup.PopupWindow):
|
||||
from ba.internal import get_player_colors
|
||||
c_raw = get_player_colors()
|
||||
if len(c_raw) != 16:
|
||||
raise Exception("expected 16 player colors")
|
||||
raise Exception('expected 16 player colors')
|
||||
self.colors = [c_raw[0:4], c_raw[4:8], c_raw[8:12], c_raw[12:16]]
|
||||
|
||||
if scale is None:
|
||||
|
||||
@ -44,31 +44,31 @@ class ConfigErrorWindow(ba.Window):
|
||||
parent=self._root_widget,
|
||||
position=(padding, 220),
|
||||
size=(width - 2 * padding, 100 - 2 * padding),
|
||||
h_align="center",
|
||||
v_align="top",
|
||||
h_align='center',
|
||||
v_align='top',
|
||||
scale=0.73,
|
||||
text=("Error reading BallisticaCore config file"
|
||||
":\n\n\nCheck the console"
|
||||
" (press ~ twice) for details.\n\nWould you like to quit and"
|
||||
" try to fix it by hand\nor overwrite it with defaults?\n\n"
|
||||
"(high scores, player profiles, etc will be lost if you"
|
||||
" overwrite)"))
|
||||
text=('Error reading BallisticaCore config file'
|
||||
':\n\n\nCheck the console'
|
||||
' (press ~ twice) for details.\n\nWould you like to quit and'
|
||||
' try to fix it by hand\nor overwrite it with defaults?\n\n'
|
||||
'(high scores, player profiles, etc will be lost if you'
|
||||
' overwrite)'))
|
||||
ba.textwidget(parent=self._root_widget,
|
||||
position=(padding, 198),
|
||||
size=(width - 2 * padding, 100 - 2 * padding),
|
||||
h_align="center",
|
||||
v_align="top",
|
||||
h_align='center',
|
||||
v_align='top',
|
||||
scale=0.5,
|
||||
text=self._config_file_path)
|
||||
quit_button = ba.buttonwidget(parent=self._root_widget,
|
||||
position=(35, 30),
|
||||
size=(240, 54),
|
||||
label="Quit and Edit",
|
||||
label='Quit and Edit',
|
||||
on_activate_call=self._quit)
|
||||
ba.buttonwidget(parent=self._root_widget,
|
||||
position=(width - 370, 30),
|
||||
size=(330, 54),
|
||||
label="Overwrite with Defaults",
|
||||
label='Overwrite with Defaults',
|
||||
on_activate_call=self._defaults)
|
||||
ba.containerwidget(edit=self._root_widget,
|
||||
cancel_button=quit_button,
|
||||
@ -86,7 +86,7 @@ class ConfigErrorWindow(ba.Window):
|
||||
from ba.internal import commit_app_config
|
||||
ba.containerwidget(edit=self._root_widget, transition='out_left')
|
||||
ba.playsound(ba.getsound('gunCocking'))
|
||||
ba.screenmessage("settings reset.", color=(1, 1, 0))
|
||||
ba.screenmessage('settings reset.', color=(1, 1, 0))
|
||||
|
||||
# At this point settings are already set; lets just commit them
|
||||
# to disk.
|
||||
|
||||
@ -35,7 +35,7 @@ class ConfirmWindow:
|
||||
"""Window for answering simple yes/no questions."""
|
||||
|
||||
def __init__(self,
|
||||
text: Union[str, ba.Lstr] = "Are you sure?",
|
||||
text: Union[str, ba.Lstr] = 'Are you sure?',
|
||||
action: Callable[[], Any] = None,
|
||||
width: float = 360.0,
|
||||
height: float = 100.0,
|
||||
@ -79,8 +79,8 @@ class ConfirmWindow:
|
||||
ba.textwidget(parent=self.root_widget,
|
||||
position=(width * 0.5, height - 5 - (height - 75) * 0.5),
|
||||
size=(0, 0),
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=text,
|
||||
scale=text_scale,
|
||||
color=color,
|
||||
|
||||
@ -86,7 +86,7 @@ class CoopBrowserWindow(ba.Window):
|
||||
self._width = 1320 if app.small_ui else 1120
|
||||
self._x_inset = x_inset = 100 if app.small_ui else 0
|
||||
self._height = (657 if app.small_ui else 730 if app.med_ui else 800)
|
||||
app.main_window = "Coop Select"
|
||||
app.main_window = 'Coop Select'
|
||||
self._r = 'coopSelectWindow'
|
||||
top_extra = 20 if app.small_ui else 0
|
||||
|
||||
@ -188,11 +188,11 @@ class CoopBrowserWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
text=ba.Lstr(resource='playModes.singlePlayerCoopText',
|
||||
fallback_resource='playModes.coopText'),
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=app.title_color,
|
||||
scale=1.5,
|
||||
maxwidth=500,
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
|
||||
if app.toolbars and app.small_ui:
|
||||
ba.textwidget(edit=txt, text='')
|
||||
@ -786,7 +786,7 @@ class CoopBrowserWindow(ba.Window):
|
||||
v + 30),
|
||||
size=(0, 0),
|
||||
text='',
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
color=ba.app.title_color,
|
||||
scale=1.1)
|
||||
@ -831,7 +831,7 @@ class CoopBrowserWindow(ba.Window):
|
||||
position=(h_base + 27, v + 30),
|
||||
size=(0, 0),
|
||||
text=txt,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
color=ba.app.title_color,
|
||||
scale=1.1)
|
||||
@ -865,7 +865,7 @@ class CoopBrowserWindow(ba.Window):
|
||||
position=(h_base + 47, v),
|
||||
size=(0, 0),
|
||||
text=unavailable_text,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
color=ba.app.title_color,
|
||||
scale=0.9)
|
||||
@ -911,7 +911,7 @@ class CoopBrowserWindow(ba.Window):
|
||||
text=ba.Lstr(
|
||||
resource='practiceText',
|
||||
fallback_resource='coopSelectWindow.customText'),
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
color=ba.app.title_color,
|
||||
scale=1.1)
|
||||
@ -1555,7 +1555,7 @@ class CoopBrowserWindow(ba.Window):
|
||||
elif sel == self._scrollwidget:
|
||||
sel_name = 'Scroll'
|
||||
else:
|
||||
raise Exception("unrecognized selection")
|
||||
raise Exception('unrecognized selection')
|
||||
ba.app.window_states[self.__class__.__name__] = {
|
||||
'sel_name': sel_name
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ class CoopLevelLockedWindow(ba.Window):
|
||||
ba.textwidget(parent=self._root_widget,
|
||||
position=(150 - 20, height * 0.63),
|
||||
size=(0, 0),
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource='levelIsLockedText',
|
||||
subs=[('${LEVEL}', name)]),
|
||||
@ -49,7 +49,7 @@ class CoopLevelLockedWindow(ba.Window):
|
||||
ba.textwidget(parent=self._root_widget,
|
||||
position=(150 - 20, height * 0.48),
|
||||
size=(0, 0),
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource='levelMustBeCompletedFirstText',
|
||||
subs=[('${LEVEL}', dep_name)]),
|
||||
|
||||
@ -92,10 +92,10 @@ class CreditsListWindow(ba.Window):
|
||||
text=ba.Lstr(resource=self._r + '.titleText',
|
||||
subs=[('${APP_NAME}',
|
||||
ba.Lstr(resource='titleText'))]),
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=ba.app.title_color,
|
||||
maxwidth=330,
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
|
||||
scroll = ba.scrollwidget(parent=self._root_widget,
|
||||
position=(40 + x_inset, 35),
|
||||
|
||||
@ -74,9 +74,9 @@ class DebugWindow(ba.Window):
|
||||
position=(0, height - 60),
|
||||
size=(width, 30),
|
||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=ba.app.title_color,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
maxwidth=260)
|
||||
|
||||
self._scrollwidget = ba.scrollwidget(
|
||||
@ -130,8 +130,8 @@ class DebugWindow(ba.Window):
|
||||
maxwidth=200,
|
||||
color=ba.app.heading_color,
|
||||
scale=0.85,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
v -= 45
|
||||
|
||||
x_offs = 165
|
||||
@ -143,8 +143,8 @@ class DebugWindow(ba.Window):
|
||||
maxwidth=130,
|
||||
color=ba.app.heading_color,
|
||||
scale=0.65,
|
||||
h_align="right",
|
||||
v_align="center")
|
||||
h_align='right',
|
||||
v_align='center')
|
||||
|
||||
popup.PopupMenu(
|
||||
parent=self._subcontainer,
|
||||
@ -169,16 +169,16 @@ class DebugWindow(ba.Window):
|
||||
maxwidth=130,
|
||||
color=ba.app.heading_color,
|
||||
scale=0.65,
|
||||
h_align="right",
|
||||
v_align="center")
|
||||
h_align='right',
|
||||
v_align='center')
|
||||
|
||||
self._stress_test_playlist_name_field = ba.textwidget(
|
||||
parent=self._subcontainer,
|
||||
position=(x_offs + 5, v - 5),
|
||||
size=(250, 46),
|
||||
text=self._stress_test_playlist,
|
||||
h_align="left",
|
||||
v_align="center",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
autoselect=True,
|
||||
color=(0.9, 0.9, 0.9, 1.0),
|
||||
description=ba.Lstr(resource=self._r +
|
||||
@ -195,8 +195,8 @@ class DebugWindow(ba.Window):
|
||||
text=ba.Lstr(resource=self._r +
|
||||
'.stressTestPlayerCountText'),
|
||||
color=(0.8, 0.8, 0.8, 1.0),
|
||||
h_align="right",
|
||||
v_align="center",
|
||||
h_align='right',
|
||||
v_align='center',
|
||||
scale=0.65,
|
||||
maxwidth=130)
|
||||
self._stress_test_player_count_text = ba.textwidget(
|
||||
@ -205,14 +205,14 @@ class DebugWindow(ba.Window):
|
||||
size=(60, 28),
|
||||
editable=False,
|
||||
color=(0.3, 1.0, 0.3, 1.0),
|
||||
h_align="right",
|
||||
v_align="center",
|
||||
h_align='right',
|
||||
v_align='center',
|
||||
text=str(self._stress_test_player_count),
|
||||
padding=2)
|
||||
ba.buttonwidget(parent=self._subcontainer,
|
||||
position=(330 - x_sub, v - 11),
|
||||
size=(28, 28),
|
||||
label="-",
|
||||
label='-',
|
||||
autoselect=True,
|
||||
on_activate_call=ba.Call(
|
||||
self._stress_test_player_count_decrement),
|
||||
@ -221,7 +221,7 @@ class DebugWindow(ba.Window):
|
||||
ba.buttonwidget(parent=self._subcontainer,
|
||||
position=(380 - x_sub, v - 11),
|
||||
size=(28, 28),
|
||||
label="+",
|
||||
label='+',
|
||||
autoselect=True,
|
||||
on_activate_call=ba.Call(
|
||||
self._stress_test_player_count_increment),
|
||||
@ -236,8 +236,8 @@ class DebugWindow(ba.Window):
|
||||
text=ba.Lstr(resource=self._r +
|
||||
'.stressTestRoundDurationText'),
|
||||
color=(0.8, 0.8, 0.8, 1.0),
|
||||
h_align="right",
|
||||
v_align="center",
|
||||
h_align='right',
|
||||
v_align='center',
|
||||
scale=0.65,
|
||||
maxwidth=130)
|
||||
self._stress_test_round_duration_text = ba.textwidget(
|
||||
@ -246,14 +246,14 @@ class DebugWindow(ba.Window):
|
||||
size=(60, 28),
|
||||
editable=False,
|
||||
color=(0.3, 1.0, 0.3, 1.0),
|
||||
h_align="right",
|
||||
v_align="center",
|
||||
h_align='right',
|
||||
v_align='center',
|
||||
text=str(self._stress_test_round_duration),
|
||||
padding=2)
|
||||
ba.buttonwidget(parent=self._subcontainer,
|
||||
position=(330 - x_sub, v - 11),
|
||||
size=(28, 28),
|
||||
label="-",
|
||||
label='-',
|
||||
autoselect=True,
|
||||
on_activate_call=ba.Call(
|
||||
self._stress_test_round_duration_decrement),
|
||||
@ -262,7 +262,7 @@ class DebugWindow(ba.Window):
|
||||
ba.buttonwidget(parent=self._subcontainer,
|
||||
position=(380 - x_sub, v - 11),
|
||||
size=(28, 28),
|
||||
label="+",
|
||||
label='+',
|
||||
autoselect=True,
|
||||
on_activate_call=ba.Call(
|
||||
self._stress_test_round_duration_increment),
|
||||
|
||||
@ -51,7 +51,7 @@ def ask_for_rating() -> Optional[ba.Widget]:
|
||||
ba.imagewidget(parent=dlg,
|
||||
position=(width / 2 - 100, v + 10),
|
||||
size=(200, 200),
|
||||
texture=ba.gettexture("cuteSpaz"))
|
||||
texture=ba.gettexture('cuteSpaz'))
|
||||
ba.textwidget(parent=dlg,
|
||||
position=(15, v - 55),
|
||||
size=(width - 30, 30),
|
||||
@ -62,8 +62,8 @@ def ask_for_rating() -> Optional[ba.Widget]:
|
||||
maxwidth=width * 0.95,
|
||||
max_height=130,
|
||||
scale=0.85,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
|
||||
def do_rating() -> None:
|
||||
if platform == 'android':
|
||||
|
||||
@ -72,8 +72,8 @@ class FileSelectorWindow(ba.Window):
|
||||
position=(self._width * 0.5, self._height - 42),
|
||||
size=(0, 0),
|
||||
color=ba.app.title_color,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource=self._r + '.titleFolderText') if
|
||||
(allow_folders and not valid_file_extensions) else ba.Lstr(
|
||||
resource=self._r +
|
||||
@ -120,8 +120,8 @@ class FileSelectorWindow(ba.Window):
|
||||
self._height - 98),
|
||||
size=(0, 0),
|
||||
color=ba.app.title_color,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=self._path,
|
||||
maxwidth=self._width * 0.9)
|
||||
self._scrollwidget: Optional[ba.Widget] = None
|
||||
|
||||
@ -55,7 +55,7 @@ class GatherWindow(ba.Window):
|
||||
else:
|
||||
self._transition_out = 'out_right'
|
||||
scale_origin = None
|
||||
ba.app.main_window = "Gather"
|
||||
ba.app.main_window = 'Gather'
|
||||
_ba.set_party_icon_always_visible(True)
|
||||
self._public_parties: Dict[str, Dict[str, Any]] = {}
|
||||
self._width = 1240 if ba.app.small_ui else 1040
|
||||
@ -138,8 +138,8 @@ class GatherWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=ba.app.title_color,
|
||||
scale=1.5,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||
maxwidth=550)
|
||||
|
||||
@ -1948,7 +1948,7 @@ class GatherWindow(ba.Window):
|
||||
elif sel == self._tab_container:
|
||||
sel_name = 'TabContainer'
|
||||
else:
|
||||
raise Exception("unrecognized selection: " + str(sel))
|
||||
raise Exception('unrecognized selection: ' + str(sel))
|
||||
ba.app.window_states[self.__class__.__name__] = {
|
||||
'sel_name': sel_name,
|
||||
'tab': self._current_tab,
|
||||
|
||||
@ -100,8 +100,8 @@ class GetCurrencyWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=ba.app.title_color,
|
||||
scale=1.2,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||
maxwidth=290)
|
||||
|
||||
|
||||
@ -78,8 +78,8 @@ class HelpWindow(ba.Window):
|
||||
subs=[('${APP_NAME}',
|
||||
ba.Lstr(resource='titleText'))]),
|
||||
color=ba.app.title_color,
|
||||
h_align="center",
|
||||
v_align="top")
|
||||
h_align='center',
|
||||
v_align='top')
|
||||
|
||||
self._scrollwidget = ba.scrollwidget(
|
||||
parent=self._root_widget,
|
||||
@ -110,7 +110,7 @@ class HelpWindow(ba.Window):
|
||||
size=(140, 60),
|
||||
scale=0.7 if ba.app.small_ui else 0.8,
|
||||
label=ba.Lstr(
|
||||
resource='backText') if self._main_menu else "Close",
|
||||
resource='backText') if self._main_menu else 'Close',
|
||||
button_type='back' if self._main_menu else None,
|
||||
extra_touch_border_scale=2.0,
|
||||
autoselect=True,
|
||||
@ -158,9 +158,9 @@ class HelpWindow(ba.Window):
|
||||
flatness=0.5,
|
||||
res_scale=1.5,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=header,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
maxwidth=txt_maxwidth)
|
||||
txt_width = min(
|
||||
txt_maxwidth,
|
||||
@ -223,9 +223,9 @@ class HelpWindow(ba.Window):
|
||||
scale=1.2,
|
||||
maxwidth=self._sub_width * 0.9,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=paragraph,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
flatness=1.0)
|
||||
v -= (spacing * 25.0 +
|
||||
get_resource(self._r + '.someDaysExtraSpace'))
|
||||
@ -238,9 +238,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
maxwidth=self._sub_width * 0.9,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=paragraph,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
flatness=1.0)
|
||||
v -= (spacing * 27.0 +
|
||||
get_resource(self._r + '.orPunchingSomethingExtraSpace'))
|
||||
@ -254,9 +254,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
flatness=1.0,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=paragraph,
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
|
||||
v -= spacing * 70.0
|
||||
txt_scale = 1.0
|
||||
@ -267,9 +267,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
maxwidth=self._sub_width * 0.9,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=header,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
flatness=1.0)
|
||||
|
||||
v -= spacing * 40.0
|
||||
@ -282,9 +282,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
maxwidth=100,
|
||||
text=txt,
|
||||
h_align="right",
|
||||
h_align='right',
|
||||
color=header,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
flatness=1.0)
|
||||
|
||||
txt = ba.Lstr(resource=self._r + '.friendsGoodText',
|
||||
@ -297,7 +297,7 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
maxwidth=500,
|
||||
text=txt,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
color=paragraph,
|
||||
flatness=1.0)
|
||||
|
||||
@ -315,9 +315,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
maxwidth=100,
|
||||
text=txt,
|
||||
h_align="right",
|
||||
h_align='right',
|
||||
color=header,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
flatness=1.0)
|
||||
|
||||
txt_scale = 0.7
|
||||
@ -340,7 +340,7 @@ class HelpWindow(ba.Window):
|
||||
maxwidth=500,
|
||||
max_height=105,
|
||||
text=txt,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
color=paragraph,
|
||||
flatness=1.0)
|
||||
|
||||
@ -355,9 +355,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
flatness=0.5,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=header,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
res_scale=1.5,
|
||||
maxwidth=txt_maxwidth)
|
||||
txt_width = min(
|
||||
@ -385,9 +385,9 @@ class HelpWindow(ba.Window):
|
||||
maxwidth=self._sub_width * 0.9,
|
||||
flatness=1.0,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=paragraph,
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
v -= spacing * 160.0
|
||||
|
||||
sep = 70
|
||||
@ -410,9 +410,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
flatness=1.0,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=(1, 0.7, 0.3, 1.0),
|
||||
v_align="top")
|
||||
v_align='top')
|
||||
|
||||
hval2 = h + sep
|
||||
vval2 = v
|
||||
@ -432,9 +432,9 @@ class HelpWindow(ba.Window):
|
||||
flatness=1.0,
|
||||
maxwidth=270,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=(1, 0.3, 0.3, 1.0),
|
||||
v_align="top")
|
||||
v_align='top')
|
||||
|
||||
hval2 = h
|
||||
vval2 = v + sep
|
||||
@ -453,9 +453,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
flatness=1.0,
|
||||
text=txtl,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=(0.5, 0.5, 1, 1.0),
|
||||
v_align="top")
|
||||
v_align='top')
|
||||
|
||||
hval2 = h
|
||||
vval2 = v - sep
|
||||
@ -474,9 +474,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
flatness=1.0,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=(0.4, 1, 0.4, 1.0),
|
||||
v_align="top")
|
||||
v_align='top')
|
||||
|
||||
txt = ba.Lstr(resource=self._r + '.runInfoText').evaluate()
|
||||
txt_scale = get_resource(self._r + '.runInfoTextScale')
|
||||
@ -487,9 +487,9 @@ class HelpWindow(ba.Window):
|
||||
maxwidth=self._sub_width * 0.93,
|
||||
flatness=1.0,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=(0.7, 0.7, 1.0, 1.0),
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
|
||||
v -= spacing * 280.0
|
||||
|
||||
@ -502,9 +502,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
flatness=0.5,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=header,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
maxwidth=txt_maxwidth)
|
||||
txt_width = min(
|
||||
txt_maxwidth,
|
||||
@ -526,9 +526,9 @@ class HelpWindow(ba.Window):
|
||||
scale=txt_scale,
|
||||
maxwidth=self._sub_width * 0.9,
|
||||
text=txt,
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=paragraph,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
flatness=1.0)
|
||||
|
||||
v -= spacing * 1.0
|
||||
@ -578,9 +578,9 @@ class HelpWindow(ba.Window):
|
||||
maxwidth=200,
|
||||
flatness=1.0,
|
||||
text=txtl,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
color=header2,
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
txt_scale = t_small
|
||||
txtl = desc
|
||||
ba.textwidget(parent=self._subcontainer,
|
||||
@ -590,9 +590,9 @@ class HelpWindow(ba.Window):
|
||||
maxwidth=300,
|
||||
flatness=1.0,
|
||||
text=txtl,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
color=paragraph,
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
res_scale=0.5)
|
||||
|
||||
def _close(self) -> None:
|
||||
|
||||
@ -193,7 +193,7 @@ class LeagueRankButton:
|
||||
size=(0, 0),
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text='+' + self._improvement_text + "!",
|
||||
text='+' + self._improvement_text + '!',
|
||||
position=(self._position[0] +
|
||||
self._size[0] * 0.5 * self._scale,
|
||||
self._position[1] +
|
||||
|
||||
@ -97,11 +97,11 @@ class LeagueRankWindow(ba.Window):
|
||||
text=ba.Lstr(
|
||||
resource='league.leagueRankText',
|
||||
fallback_resource='coopSelectWindow.powerRankingText'),
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=ba.app.title_color,
|
||||
scale=1.4,
|
||||
maxwidth=600,
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
|
||||
ba.buttonwidget(edit=btn,
|
||||
button_type='backSmall',
|
||||
|
||||
@ -673,7 +673,7 @@ class MainMenuWindow(ba.Window):
|
||||
if (not isinstance(cme, dict) or 'label' not in cme
|
||||
or not isinstance(cme['label'], (str, ba.Lstr))
|
||||
or 'call' not in cme or not callable(cme['call'])):
|
||||
raise Exception("invalid custom menu entry: " +
|
||||
raise Exception('invalid custom menu entry: ' +
|
||||
str(cme))
|
||||
except Exception:
|
||||
custom_menu_entries = []
|
||||
|
||||
@ -248,8 +248,8 @@ class PartyQueueWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=(1.0, 3.0, 1.0),
|
||||
scale=1.3,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource='internal.connectingToPartyText'),
|
||||
maxwidth=self._width * 0.65)
|
||||
|
||||
@ -259,8 +259,8 @@ class PartyQueueWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=(0.2, 1.0, 0.2),
|
||||
scale=0.7,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text='')
|
||||
|
||||
# update at roughly 30fps
|
||||
@ -420,8 +420,8 @@ class PartyQueueWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=(0.8, 1.0, 0.8),
|
||||
scale=1.5,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource='boostText'),
|
||||
maxwidth=150)
|
||||
self._boost_price = ba.textwidget(
|
||||
@ -431,8 +431,8 @@ class PartyQueueWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=(0, 1, 0),
|
||||
scale=0.9,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.charstr(ba.SpecialChar.TICKET) +
|
||||
str(self._boost_tickets),
|
||||
maxwidth=150)
|
||||
|
||||
@ -86,8 +86,8 @@ class PlayWindow(ba.Window):
|
||||
res_scale=2.0,
|
||||
maxwidth=400,
|
||||
color=ba.app.heading_color,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
|
||||
ba.buttonwidget(edit=btn,
|
||||
button_type='backSmall',
|
||||
@ -123,7 +123,7 @@ class PlayWindow(ba.Window):
|
||||
size=(scl * button_width, scl * (300 if new_style else 360)),
|
||||
extra_touch_border_scale=0.1,
|
||||
autoselect=True,
|
||||
label="",
|
||||
label='',
|
||||
button_type='square',
|
||||
text_scale=1.13,
|
||||
on_activate_call=self._coop)
|
||||
@ -206,7 +206,7 @@ class PlayWindow(ba.Window):
|
||||
size=(scl * button_width, scl * (300 if new_style else 360)),
|
||||
extra_touch_border_scale=0.1,
|
||||
autoselect=True,
|
||||
label="",
|
||||
label='',
|
||||
button_type='square',
|
||||
text_scale=1.13,
|
||||
on_activate_call=self._team_tourney)
|
||||
@ -310,7 +310,7 @@ class PlayWindow(ba.Window):
|
||||
size=(scl * button_width, scl * (300 if new_style else 360)),
|
||||
extra_touch_border_scale=0.1,
|
||||
autoselect=True,
|
||||
label="",
|
||||
label='',
|
||||
button_type='square',
|
||||
text_scale=1.13,
|
||||
on_activate_call=self._free_for_all)
|
||||
@ -538,7 +538,7 @@ class PlayWindow(ba.Window):
|
||||
elif sel == self._back_button:
|
||||
sel_name = 'Back'
|
||||
else:
|
||||
raise Exception("unrecognized selected widget")
|
||||
raise Exception('unrecognized selected widget')
|
||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
||||
except Exception:
|
||||
ba.print_exception('error saving state for', self.__class__)
|
||||
|
||||
@ -163,8 +163,8 @@ class PlaylistAddGameWindow(ba.Window):
|
||||
position=(0, 0),
|
||||
size=(self._width - 88, 24),
|
||||
text=gametype.get_display_string(),
|
||||
h_align="left",
|
||||
v_align="center",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
color=(0.8, 0.8, 0.8, 1.0),
|
||||
maxwidth=self._scroll_width * 0.8,
|
||||
on_select_call=ba.Call(
|
||||
|
||||
@ -56,10 +56,10 @@ class PlaylistBrowserWindow(ba.Window):
|
||||
|
||||
# Store state for when we exit the next game.
|
||||
if issubclass(sessiontype, ba.DualTeamSession):
|
||||
ba.app.main_window = "Team Game Select"
|
||||
ba.app.main_window = 'Team Game Select'
|
||||
ba.set_analytics_screen('Teams Window')
|
||||
elif issubclass(sessiontype, ba.FreeForAllSession):
|
||||
ba.app.main_window = "Free-for-All Game Select"
|
||||
ba.app.main_window = 'Free-for-All Game Select'
|
||||
ba.set_analytics_screen('FreeForAll Window')
|
||||
else:
|
||||
raise Exception(f'invalid sessiontype: {sessiontype}')
|
||||
@ -237,8 +237,8 @@ class PlaylistBrowserWindow(ba.Window):
|
||||
scale=1.3,
|
||||
res_scale=1.5,
|
||||
color=ba.app.heading_color,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
if ba.app.small_ui and ba.app.toolbars:
|
||||
ba.textwidget(edit=txt, text='')
|
||||
|
||||
@ -415,7 +415,7 @@ class PlaylistBrowserWindow(ba.Window):
|
||||
elif self._sessiontype is ba.DualTeamSession:
|
||||
playlist = get_default_teams_playlist()
|
||||
else:
|
||||
raise Exception("unrecognized session-type: " +
|
||||
raise Exception('unrecognized session-type: ' +
|
||||
str(self._sessiontype))
|
||||
else:
|
||||
if name not in bs_config[self._pvars.config_name +
|
||||
@ -507,7 +507,7 @@ class PlaylistBrowserWindow(ba.Window):
|
||||
v -= scl * 130.0
|
||||
|
||||
except Exception:
|
||||
ba.print_exception("error listing playlist maps")
|
||||
ba.print_exception('error listing playlist maps')
|
||||
|
||||
if not map_images:
|
||||
ba.textwidget(parent=self._subcontainer,
|
||||
@ -625,7 +625,7 @@ class PlaylistBrowserWindow(ba.Window):
|
||||
else:
|
||||
sel_name = 'Scroll'
|
||||
else:
|
||||
raise Exception("unrecognized selected widget")
|
||||
raise Exception('unrecognized selected widget')
|
||||
ba.app.window_states[self.__class__.__name__] = sel_name
|
||||
except Exception:
|
||||
ba.print_exception('error saving state for', self.__class__)
|
||||
|
||||
@ -90,8 +90,8 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
||||
self._pvars.window_title_name)]),
|
||||
color=ba.app.heading_color,
|
||||
maxwidth=290,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
|
||||
ba.buttonwidget(edit=btn,
|
||||
button_type='backSmall',
|
||||
@ -300,7 +300,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
|
||||
_ba.new_host_session(self._sessiontype)
|
||||
except Exception:
|
||||
from bastd import mainmenu
|
||||
ba.print_exception("exception running session", self._sessiontype)
|
||||
ba.print_exception('exception running session', self._sessiontype)
|
||||
|
||||
# Drop back into a main menu session.
|
||||
_ba.new_host_session(mainmenu.MainMenuSession)
|
||||
|
||||
@ -88,8 +88,8 @@ class PlaylistEditWindow(ba.Window):
|
||||
text=ba.Lstr(resource=self._r + '.titleText'),
|
||||
color=ba.app.title_color,
|
||||
scale=1.05,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
maxwidth=270)
|
||||
|
||||
v = self._height - 115.0
|
||||
@ -111,8 +111,8 @@ class PlaylistEditWindow(ba.Window):
|
||||
position=(210 + x_inset, v + 7),
|
||||
size=(self._scroll_width - 53, 43),
|
||||
text=self._editcontroller.get_name(),
|
||||
h_align="left",
|
||||
v_align="center",
|
||||
h_align='left',
|
||||
v_align='center',
|
||||
max_chars=40,
|
||||
autoselect=True,
|
||||
color=(0.9, 0.9, 0.9, 1.0),
|
||||
|
||||
@ -70,7 +70,7 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
valid_maps = gameclass.get_supported_maps(sessiontype)
|
||||
if not valid_maps:
|
||||
ba.screenmessage(ba.Lstr(resource='noValidMapsErrorText'))
|
||||
raise Exception("No valid maps")
|
||||
raise Exception('No valid maps')
|
||||
|
||||
self._settings_defs = gameclass.get_settings(sessiontype)
|
||||
self._completion_call = completion_call
|
||||
@ -115,7 +115,7 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
|
||||
map_tex_name = (get_map_class(self._map).get_preview_texture_name())
|
||||
if map_tex_name is None:
|
||||
raise Exception("no map preview tex found for" + self._map)
|
||||
raise Exception('no map preview tex found for' + self._map)
|
||||
map_tex = ba.gettexture(map_tex_name)
|
||||
|
||||
top_extra = 20 if ba.app.small_ui else 0
|
||||
@ -160,8 +160,8 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
color=ba.app.title_color,
|
||||
maxwidth=235,
|
||||
scale=1.1,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
|
||||
map_height = 100
|
||||
|
||||
@ -205,9 +205,9 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
size=(100, 30),
|
||||
maxwidth=110,
|
||||
text=ba.Lstr(resource='mapText'),
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
color=(0.8, 0.8, 0.8, 1.0),
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
|
||||
ba.imagewidget(
|
||||
parent=self._subcontainer,
|
||||
@ -234,9 +234,9 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
scale=0.55,
|
||||
maxwidth=256 * 0.7 * 0.8,
|
||||
text=get_map_display_string(self._map),
|
||||
h_align="center",
|
||||
h_align='center',
|
||||
color=(0.6, 1.0, 0.6, 1.0),
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
v -= map_height
|
||||
|
||||
for setting_name, setting in self._settings_defs:
|
||||
@ -269,16 +269,16 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
repr(choice))
|
||||
if not isinstance(choice[0], str):
|
||||
raise Exception(
|
||||
"First value for choice tuple must be a str; got: "
|
||||
'First value for choice tuple must be a str; got: '
|
||||
+ repr(choice))
|
||||
if not isinstance(choice[1], value_type):
|
||||
raise Exception(
|
||||
"Choice type does not match default value; choice:"
|
||||
+ repr(choice) + "; setting:" + repr(setting))
|
||||
'Choice type does not match default value; choice:'
|
||||
+ repr(choice) + '; setting:' + repr(setting))
|
||||
if value_type not in (int, float):
|
||||
raise Exception(
|
||||
"Choice type setting must have int or float default; "
|
||||
"got: " + repr(setting))
|
||||
'Choice type setting must have int or float default; '
|
||||
'got: ' + repr(setting))
|
||||
|
||||
# Start at the choice corresponding to the default if possible.
|
||||
self._choice_selections[setting_name] = 0
|
||||
@ -293,9 +293,9 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
size=(100, 30),
|
||||
maxwidth=mw1,
|
||||
text=name_translated,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
color=(0.8, 0.8, 0.8, 1.0),
|
||||
v_align="center")
|
||||
v_align='center')
|
||||
txt = ba.textwidget(
|
||||
parent=self._subcontainer,
|
||||
position=(h + 509 - 95, v),
|
||||
@ -305,13 +305,13 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
editable=False,
|
||||
color=(0.6, 1.0, 0.6, 1.0),
|
||||
maxwidth=mw2,
|
||||
h_align="right",
|
||||
v_align="center",
|
||||
h_align='right',
|
||||
v_align='center',
|
||||
padding=2)
|
||||
btn1 = ba.buttonwidget(parent=self._subcontainer,
|
||||
position=(h + 509 - 50 - 1, v),
|
||||
size=(28, 28),
|
||||
label="<",
|
||||
label='<',
|
||||
autoselect=True,
|
||||
on_activate_call=ba.Call(
|
||||
self._choice_inc, setting_name, txt,
|
||||
@ -320,7 +320,7 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
btn2 = ba.buttonwidget(parent=self._subcontainer,
|
||||
position=(h + 509 + 5, v),
|
||||
size=(28, 28),
|
||||
label=">",
|
||||
label='>',
|
||||
autoselect=True,
|
||||
on_activate_call=ba.Call(
|
||||
self._choice_inc, setting_name, txt,
|
||||
@ -346,9 +346,9 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
position=(h + 50, v),
|
||||
size=(100, 30),
|
||||
text=name_translated,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
color=(0.8, 0.8, 0.8, 1.0),
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
maxwidth=mw1)
|
||||
txt = ba.textwidget(parent=self._subcontainer,
|
||||
position=(h + 509 - 95, v),
|
||||
@ -357,13 +357,13 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
editable=False,
|
||||
color=(0.6, 1.0, 0.6, 1.0),
|
||||
maxwidth=mw2,
|
||||
h_align="right",
|
||||
v_align="center",
|
||||
h_align='right',
|
||||
v_align='center',
|
||||
padding=2)
|
||||
btn1 = ba.buttonwidget(parent=self._subcontainer,
|
||||
position=(h + 509 - 50 - 1, v),
|
||||
size=(28, 28),
|
||||
label="-",
|
||||
label='-',
|
||||
autoselect=True,
|
||||
on_activate_call=ba.Call(
|
||||
self._inc, txt, min_value,
|
||||
@ -373,7 +373,7 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
btn2 = ba.buttonwidget(parent=self._subcontainer,
|
||||
position=(h + 509 + 5, v),
|
||||
size=(28, 28),
|
||||
label="+",
|
||||
label='+',
|
||||
autoselect=True,
|
||||
on_activate_call=ba.Call(
|
||||
self._inc, txt, min_value,
|
||||
@ -388,9 +388,9 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
position=(h + 50, v),
|
||||
size=(100, 30),
|
||||
text=name_translated,
|
||||
h_align="left",
|
||||
h_align='left',
|
||||
color=(0.8, 0.8, 0.8, 1.0),
|
||||
v_align="center",
|
||||
v_align='center',
|
||||
maxwidth=mw1)
|
||||
txt = ba.textwidget(
|
||||
parent=self._subcontainer,
|
||||
@ -401,8 +401,8 @@ class PlaylistEditGameWindow(ba.Window):
|
||||
editable=False,
|
||||
color=(0.6, 1.0, 0.6, 1.0),
|
||||
maxwidth=mw2,
|
||||
h_align="right",
|
||||
v_align="center",
|
||||
h_align='right',
|
||||
v_align='center',
|
||||
padding=2)
|
||||
cbw = ba.checkboxwidget(parent=self._subcontainer,
|
||||
text='',
|
||||
|
||||
@ -87,8 +87,8 @@ class PlaylistMapSelectWindow(ba.Window):
|
||||
self._gameclass.get_display_string())
|
||||
]),
|
||||
color=ba.app.title_color,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
v = height - 70
|
||||
self._scroll_width = width - (80 + 2 * x_inset)
|
||||
self._scroll_height = height - 140
|
||||
@ -183,7 +183,7 @@ class PlaylistMapSelectWindow(ba.Window):
|
||||
if x == columns - 1 and ba.app.toolbars:
|
||||
ba.widget(
|
||||
edit=btn,
|
||||
right_widget=_ba.get_special_widget("party_button"))
|
||||
right_widget=_ba.get_special_widget('party_button'))
|
||||
|
||||
ba.widget(edit=btn, show_buffer_top=60, show_buffer_bottom=60)
|
||||
if self._maps[index][0] == self._previous_map:
|
||||
|
||||
@ -116,8 +116,8 @@ class SharePlaylistResultsWindow(ba.Window):
|
||||
color=ba.app.infotextcolor,
|
||||
scale=1.0,
|
||||
flatness=1.0,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource='exportSuccessText',
|
||||
subs=[('${NAME}', name)]),
|
||||
maxwidth=self._width * 0.85)
|
||||
@ -129,8 +129,8 @@ class SharePlaylistResultsWindow(ba.Window):
|
||||
color=ba.app.infotextcolor,
|
||||
scale=0.6,
|
||||
flatness=1.0,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=ba.Lstr(resource='importPlaylistCodeInstructionsText'),
|
||||
maxwidth=self._width * 0.85)
|
||||
|
||||
@ -139,8 +139,8 @@ class SharePlaylistResultsWindow(ba.Window):
|
||||
size=(0, 0),
|
||||
color=(1.0, 3.0, 1.0),
|
||||
scale=2.3,
|
||||
h_align="center",
|
||||
v_align="center",
|
||||
h_align='center',
|
||||
v_align='center',
|
||||
text=data,
|
||||
maxwidth=self._width * 0.85)
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ class PlayOptionsWindow(popup.PopupWindow):
|
||||
elif self._sessiontype is ba.DualTeamSession:
|
||||
plst = get_default_teams_playlist()
|
||||
else:
|
||||
raise Exception("unrecognized session-type: " +
|
||||
raise Exception('unrecognized session-type: ' +
|
||||
str(self._sessiontype))
|
||||
else:
|
||||
try:
|
||||
@ -141,7 +141,7 @@ class PlayOptionsWindow(popup.PopupWindow):
|
||||
self._height += self._row_height * rows
|
||||
|
||||
except Exception:
|
||||
ba.print_exception("error listing playlist maps")
|
||||
ba.print_exception('error listing playlist maps')
|
||||
|
||||
show_shuffle_check_box = game_count > 1
|
||||
|
||||
@ -165,8 +165,8 @@ class PlayOptionsWindow(popup.PopupWindow):
|
||||
scale=1.4,
|
||||
color=(1, 1, 1),
|
||||
maxwidth=self._width * 0.7,
|
||||
h_align="center",
|
||||
v_align="center")
|
||||
h_align='center',
|
||||
v_align='center')
|
||||
|
||||
self._cancel_button = ba.buttonwidget(
|
||||
parent=self.root_widget,
|
||||
@ -439,7 +439,7 @@ class PlayOptionsWindow(popup.PopupWindow):
|
||||
_ba.new_host_session(self._sessiontype)
|
||||
except Exception:
|
||||
from bastd import mainmenu
|
||||
ba.print_exception("exception running session", self._sessiontype)
|
||||
ba.print_exception('exception running session', self._sessiontype)
|
||||
|
||||
# Drop back into a main menu session.
|
||||
_ba.new_host_session(mainmenu.MainMenuSession)
|
||||
|
||||
@ -43,7 +43,7 @@ class PopupWindow:
|
||||
bg_color: Tuple[float, float, float] = (0.35, 0.55, 0.15),
|
||||
focus_position: Tuple[float, float] = (0, 0),
|
||||
focus_size: Tuple[float, float] = None,
|
||||
toolbar_visibility: str = "menu_minimal_no_back"):
|
||||
toolbar_visibility: str = 'menu_minimal_no_back'):
|
||||
# pylint: disable=too-many-locals
|
||||
if focus_size is None:
|
||||
focus_size = size
|
||||
@ -153,7 +153,7 @@ class PopupMenuWindow(PopupWindow):
|
||||
self._choices_disabled = list(choices_disabled)
|
||||
self._done_building = False
|
||||
if not choices:
|
||||
raise Exception("Must pass at least one choice")
|
||||
raise Exception('Must pass at least one choice')
|
||||
self._width = width
|
||||
self._scale = scale
|
||||
if len(choices) > 8:
|
||||
@ -302,7 +302,7 @@ class PopupMenu:
|
||||
current_choice = None
|
||||
self._choices = list(choices)
|
||||
if not choices:
|
||||
raise Exception("no choices given")
|
||||
raise Exception('no choices given')
|
||||
self._choices_display = list(choices_display)
|
||||
self._choices_disabled = list(choices_disabled)
|
||||
self._width = width
|
||||
@ -313,7 +313,7 @@ class PopupMenu:
|
||||
self._position = position
|
||||
self._parent = parent
|
||||
if not choices:
|
||||
raise Exception("Must pass at least one choice")
|
||||
raise Exception('Must pass at least one choice')
|
||||
self._parent = parent
|
||||
self._button_size = button_size
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user