From 96abee0c9ff5b1acd4af595280957a0fe5b52858 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Mon, 27 Apr 2020 15:12:12 -0700 Subject: [PATCH] Enabled pylint quote consistency check --- Makefile | 6 +- assets/src/ba_data/python/_ba.py | 24 +- assets/src/ba_data/python/ba/_account.py | 2 +- assets/src/ba_data/python/ba/_achievement.py | 4 +- assets/src/ba_data/python/ba/_activity.py | 24 +- assets/src/ba_data/python/ba/_app.py | 10 +- assets/src/ba_data/python/ba/_appconfig.py | 4 +- assets/src/ba_data/python/ba/_benchmark.py | 8 +- assets/src/ba_data/python/ba/_campaign.py | 2 +- assets/src/ba_data/python/ba/_coopgame.py | 6 +- assets/src/ba_data/python/ba/_coopsession.py | 4 +- assets/src/ba_data/python/ba/_dependency.py | 18 +- assets/src/ba_data/python/ba/_error.py | 2 +- assets/src/ba_data/python/ba/_gameactivity.py | 50 +- assets/src/ba_data/python/ba/_gameresults.py | 2 +- assets/src/ba_data/python/ba/_gameutils.py | 34 +- assets/src/ba_data/python/ba/_hooks.py | 2 +- assets/src/ba_data/python/ba/_input.py | 12 +- assets/src/ba_data/python/ba/_lang.py | 2 +- assets/src/ba_data/python/ba/_level.py | 4 +- assets/src/ba_data/python/ba/_lobby.py | 2 +- assets/src/ba_data/python/ba/_map.py | 16 +- assets/src/ba_data/python/ba/_meta.py | 2 +- assets/src/ba_data/python/ba/_modutils.py | 10 +- .../ba_data/python/ba/_multiteamsession.py | 6 +- assets/src/ba_data/python/ba/_music.py | 12 +- assets/src/ba_data/python/ba/_netutils.py | 6 +- assets/src/ba_data/python/ba/_playlist.py | 2 +- assets/src/ba_data/python/ba/_session.py | 24 +- assets/src/ba_data/python/ba/_team.py | 2 +- assets/src/ba_data/python/ba/_teamgame.py | 2 +- assets/src/ba_data/python/ba/macmusicapp.py | 4 +- assets/src/ba_data/python/ba/osmusic.py | 2 +- .../ba_data/python/bastd/activity/coopjoin.py | 6 +- .../python/bastd/activity/coopscore.py | 24 +- .../python/bastd/activity/multiteamscore.py | 4 +- .../ba_data/python/bastd/actor/background.py | 10 +- assets/src/ba_data/python/bastd/actor/bomb.py | 26 +- assets/src/ba_data/python/bastd/actor/flag.py | 4 +- .../python/bastd/actor/onscreencountdown.py | 6 +- .../ba_data/python/bastd/actor/playerspaz.py | 4 +- .../ba_data/python/bastd/actor/powerupbox.py | 58 +- .../ba_data/python/bastd/actor/scoreboard.py | 16 +- assets/src/ba_data/python/bastd/actor/spaz.py | 40 +- .../python/bastd/actor/spazappearance.py | 1020 ++++++++--------- .../src/ba_data/python/bastd/actor/spazbot.py | 6 +- assets/src/ba_data/python/bastd/actor/text.py | 12 +- .../ba_data/python/bastd/actor/tipstext.py | 4 +- .../ba_data/python/bastd/actor/zoomtext.py | 2 +- .../src/ba_data/python/bastd/game/assault.py | 4 +- .../python/bastd/game/capturetheflag.py | 10 +- .../ba_data/python/bastd/game/chosenone.py | 30 +- .../src/ba_data/python/bastd/game/conquest.py | 10 +- .../ba_data/python/bastd/game/deathmatch.py | 12 +- .../python/bastd/game/easteregghunt.py | 10 +- .../ba_data/python/bastd/game/elimination.py | 20 +- .../src/ba_data/python/bastd/game/football.py | 54 +- .../src/ba_data/python/bastd/game/hockey.py | 82 +- .../src/ba_data/python/bastd/game/keepaway.py | 12 +- .../python/bastd/game/kingofthehill.py | 24 +- .../ba_data/python/bastd/game/meteorshower.py | 2 +- .../ba_data/python/bastd/game/ninjafight.py | 2 +- .../ba_data/python/bastd/game/onslaught.py | 38 +- assets/src/ba_data/python/bastd/game/race.py | 4 +- .../ba_data/python/bastd/game/runaround.py | 16 +- .../python/bastd/game/targetpractice.py | 8 +- .../ba_data/python/bastd/game/thelaststand.py | 4 +- assets/src/ba_data/python/bastd/mainmenu.py | 58 +- assets/src/ba_data/python/bastd/maps.py | 48 +- assets/src/ba_data/python/bastd/tutorial.py | 16 +- .../ba_data/python/bastd/ui/account/link.py | 4 +- .../python/bastd/ui/account/settings.py | 44 +- .../ba_data/python/bastd/ui/account/viewer.py | 4 +- .../src/ba_data/python/bastd/ui/appinvite.py | 12 +- .../ba_data/python/bastd/ui/colorpicker.py | 4 +- .../ba_data/python/bastd/ui/configerror.py | 26 +- assets/src/ba_data/python/bastd/ui/confirm.py | 6 +- .../ba_data/python/bastd/ui/coop/browser.py | 16 +- .../src/ba_data/python/bastd/ui/coop/level.py | 4 +- .../ba_data/python/bastd/ui/creditslist.py | 4 +- assets/src/ba_data/python/bastd/ui/debug.py | 44 +- .../src/ba_data/python/bastd/ui/feedback.py | 6 +- .../ba_data/python/bastd/ui/fileselector.py | 8 +- assets/src/ba_data/python/bastd/ui/gather.py | 8 +- .../ba_data/python/bastd/ui/getcurrency.py | 4 +- assets/src/ba_data/python/bastd/ui/helpui.py | 82 +- .../python/bastd/ui/league/rankbutton.py | 2 +- .../python/bastd/ui/league/rankwindow.py | 4 +- .../src/ba_data/python/bastd/ui/mainmenu.py | 2 +- .../src/ba_data/python/bastd/ui/partyqueue.py | 16 +- assets/src/ba_data/python/bastd/ui/play.py | 12 +- .../python/bastd/ui/playlist/addgame.py | 4 +- .../python/bastd/ui/playlist/browser.py | 14 +- .../bastd/ui/playlist/customizebrowser.py | 6 +- .../ba_data/python/bastd/ui/playlist/edit.py | 8 +- .../python/bastd/ui/playlist/editgame.py | 58 +- .../python/bastd/ui/playlist/mapselect.py | 6 +- .../ba_data/python/bastd/ui/playlist/share.py | 12 +- .../ba_data/python/bastd/ui/playoptions.py | 10 +- assets/src/ba_data/python/bastd/ui/popup.py | 8 +- .../python/bastd/ui/profile/browser.py | 8 +- .../ba_data/python/bastd/ui/profile/edit.py | 6 +- .../python/bastd/ui/profile/upgrade.py | 20 +- .../src/ba_data/python/bastd/ui/promocode.py | 4 +- assets/src/ba_data/python/bastd/ui/report.py | 4 +- .../ba_data/python/bastd/ui/serverdialog.py | 4 +- .../python/bastd/ui/settings/advanced.py | 16 +- .../python/bastd/ui/settings/allsettings.py | 6 +- .../ba_data/python/bastd/ui/settings/audio.py | 18 +- .../python/bastd/ui/settings/controls.py | 4 +- .../python/bastd/ui/settings/gamepad.py | 22 +- .../bastd/ui/settings/gamepadadvanced.py | 16 +- .../python/bastd/ui/settings/gamepadselect.py | 18 +- .../python/bastd/ui/settings/graphics.py | 28 +- .../python/bastd/ui/settings/keyboard.py | 18 +- .../python/bastd/ui/settings/ps3controller.py | 16 +- .../python/bastd/ui/settings/remoteapp.py | 16 +- .../python/bastd/ui/settings/touchscreen.py | 14 +- .../python/bastd/ui/settings/wiimote.py | 38 +- .../bastd/ui/settings/xbox360controller.py | 16 +- .../python/bastd/ui/soundtrack/browser.py | 8 +- .../python/bastd/ui/soundtrack/edit.py | 10 +- .../bastd/ui/soundtrack/entrytypeselect.py | 8 +- .../python/bastd/ui/soundtrack/macmusicapp.py | 4 +- .../ba_data/python/bastd/ui/store/browser.py | 24 +- .../ba_data/python/bastd/ui/store/button.py | 2 +- .../python/bastd/ui/teamnamescolors.py | 4 +- assets/src/ba_data/python/bastd/ui/telnet.py | 4 +- .../python/bastd/ui/tournamententry.py | 4 +- assets/src/ba_data/python/bastd/ui/url.py | 8 +- assets/src/ba_data/python/bastd/ui/watch.py | 12 +- .../src/ba_data/python/efro/entity/_entity.py | 4 +- .../src/ba_data/python/efro/entity/_field.py | 4 +- .../ba_data/python/efro/entity/_support.py | 4 +- .../src/ba_data/python/efro/entity/_value.py | 14 +- assets/src/ba_data/python/efro/executils.py | 8 +- assets/src/ba_data/python/efro/jsonutils.py | 6 +- assets/src/server/server.py | 8 +- config/toolconfigsrc/pylintrc | 4 + tests/test_efro/test_entities.py | 2 +- tools/batools/build.py | 2 +- tools/efrotools/__init__.py | 4 +- tools/efrotools/code.py | 8 +- tools/efrotools/efrocache.py | 4 +- tools/efrotools/ios.py | 2 +- tools/efrotools/jsontools.py | 2 +- tools/efrotools/pybuild.py | 24 +- tools/efrotools/snippets.py | 20 +- tools/efrotools/statictest.py | 18 +- tools/snippets | 14 +- tools/stage_assets | 30 +- tools/update_project | 8 +- 152 files changed, 1516 insertions(+), 1508 deletions(-) diff --git a/Makefile b/Makefile index 78d0effe..376efd05 100644 --- a/Makefile +++ b/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 diff --git a/assets/src/ba_data/python/_ba.py b/assets/src/ba_data/python/_ba.py index 0190c5d5..f5ceb070 100644 --- a/assets/src/ba_data/python/_ba.py +++ b/assets/src/ba_data/python/_ba.py @@ -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: diff --git a/assets/src/ba_data/python/ba/_account.py b/assets/src/ba_data/python/ba/_account.py index 73fa8892..f94a0330 100644 --- a/assets/src/ba_data/python/ba/_account.py +++ b/assets/src/ba_data/python/ba/_account.py @@ -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( diff --git a/assets/src/ba_data/python/ba/_achievement.py b/assets/src/ba_data/python/ba/_achievement.py index 0c87eda6..09445c1b 100644 --- a/assets/src/ba_data/python/ba/_achievement.py +++ b/assets/src/ba_data/python/ba/_achievement.py @@ -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] diff --git a/assets/src/ba_data/python/ba/_activity.py b/assets/src/ba_data/python/ba/_activity.py index 1515a01e..97294640 100644 --- a/assets/src/ba_data/python/ba/_activity.py +++ b/assets/src/ba_data/python/ba/_activity.py @@ -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. diff --git a/assets/src/ba_data/python/ba/_app.py b/assets/src/ba_data/python/ba/_app.py index 9714183c..9ca5def9 100644 --- a/assets/src/ba_data/python/ba/_app.py +++ b/assets/src/ba_data/python/ba/_app.py @@ -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) diff --git a/assets/src/ba_data/python/ba/_appconfig.py b/assets/src/ba_data/python/ba/_appconfig.py index d66ee158..55f94943 100644 --- a/assets/src/ba_data/python/ba/_appconfig.py +++ b/assets/src/ba_data/python/ba/_appconfig.py @@ -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() diff --git a/assets/src/ba_data/python/ba/_benchmark.py b/assets/src/ba_data/python/ba/_benchmark.py index 93634e47..e31ee809 100644 --- a/assets/src/ba_data/python/ba/_benchmark.py +++ b/assets/src/ba_data/python/ba/_benchmark.py @@ -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)) diff --git a/assets/src/ba_data/python/ba/_campaign.py b/assets/src/ba_data/python/ba/_campaign.py index b76a86ae..3beb4dca 100644 --- a/assets/src/ba_data/python/ba/_campaign.py +++ b/assets/src/ba_data/python/ba/_campaign.py @@ -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) diff --git a/assets/src/ba_data/python/ba/_coopgame.py b/assets/src/ba_data/python/ba/_coopgame.py index 321e23ba..b48187a2 100644 --- a/assets/src/ba_data/python/ba/_coopgame.py +++ b/assets/src/ba_data/python/ba/_coopgame.py @@ -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], diff --git a/assets/src/ba_data/python/ba/_coopsession.py b/assets/src/ba_data/python/ba/_coopsession.py index 205a6c87..d1c28fd0 100644 --- a/assets/src/ba_data/python/ba/_coopsession.py +++ b/assets/src/ba_data/python/ba/_coopsession.py @@ -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 diff --git a/assets/src/ba_data/python/ba/_dependency.py b/assets/src/ba_data/python/ba/_dependency.py index 082f05ef..3cff9850 100644 --- a/assets/src/ba_data/python/ba/_dependency.py +++ b/assets/src/ba_data/python/ba/_dependency.py @@ -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() diff --git a/assets/src/ba_data/python/ba/_error.py b/assets/src/ba_data/python/ba/_error.py index 6f89a05e..ed6df2b4 100644 --- a/assets/src/ba_data/python/ba/_error.py +++ b/assets/src/ba_data/python/ba/_error.py @@ -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): diff --git a/assets/src/ba_data/python/ba/_gameactivity.py b/assets/src/ba_data/python/ba/_gameactivity.py index 1d5fc486..e9b16efd 100644 --- a/assets/src/ba_data/python/ba/_gameactivity.py +++ b/assets/src/ba_data/python/ba/_gameactivity.py @@ -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. diff --git a/assets/src/ba_data/python/ba/_gameresults.py b/assets/src/ba_data/python/ba/_gameresults.py index 1db48666..46c484a4 100644 --- a/assets/src/ba_data/python/ba/_gameresults.py +++ b/assets/src/ba_data/python/ba/_gameresults.py @@ -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() diff --git a/assets/src/ba_data/python/ba/_gameutils.py b/assets/src/ba_data/python/ba/_gameutils.py index 4de43c43..acc8969a 100644 --- a/assets/src/ba_data/python/ba/_gameutils.py +++ b/assets/src/ba_data/python/ba/_gameutils.py @@ -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, diff --git a/assets/src/ba_data/python/ba/_hooks.py b/assets/src/ba_data/python/ba/_hooks.py index cc14d8bb..fdafedd7 100644 --- a/assets/src/ba_data/python/ba/_hooks.py +++ b/assets/src/ba_data/python/ba/_hooks.py @@ -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')) diff --git a/assets/src/ba_data/python/ba/_input.py b/assets/src/ba_data/python/ba/_input.py index b07c6723..b4d87cec 100644 --- a/assets/src/ba_data/python/ba/_input.py +++ b/assets/src/ba_data/python/ba/_input.py @@ -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: diff --git a/assets/src/ba_data/python/ba/_lang.py b/assets/src/ba_data/python/ba/_lang.py index a72ce297..73664924 100644 --- a/assets/src/ba_data/python/ba/_lang.py +++ b/assets/src/ba_data/python/ba/_lang.py @@ -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 diff --git a/assets/src/ba_data/python/ba/_level.py b/assets/src/ba_data/python/ba/_level.py index 687bae40..44f805fa 100644 --- a/assets/src/ba_data/python/ba/_level.py +++ b/assets/src/ba_data/python/ba/_level.py @@ -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, { diff --git a/assets/src/ba_data/python/ba/_lobby.py b/assets/src/ba_data/python/ba/_lobby.py index 67832390..7dec759f 100644 --- a/assets/src/ba_data/python/ba/_lobby.py +++ b/assets/src/ba_data/python/ba/_lobby.py @@ -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: diff --git a/assets/src/ba_data/python/ba/_map.py b/assets/src/ba_data/python/ba/_map.py index 61f1e32d..d5e57e31 100644 --- a/assets/src/ba_data/python/ba/_map.py +++ b/assets/src/ba_data/python/ba/_map.py @@ -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 diff --git a/assets/src/ba_data/python/ba/_meta.py b/assets/src/ba_data/python/ba/_meta.py index ca5588e9..8f4487fc 100644 --- a/assets/src/ba_data/python/ba/_meta.py +++ b/assets/src/ba_data/python/ba/_meta.py @@ -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() diff --git a/assets/src/ba_data/python/ba/_modutils.py b/assets/src/ba_data/python/ba/_modutils.py index 9887e5cc..11e33021 100644 --- a/assets/src/ba_data/python/ba/_modutils.py +++ b/assets/src/ba_data/python/ba/_modutils.py @@ -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)' diff --git a/assets/src/ba_data/python/ba/_multiteamsession.py b/assets/src/ba_data/python/ba/_multiteamsession.py index fe8545fe..e94815f2 100644 --- a/assets/src/ba_data/python/ba/_multiteamsession.py +++ b/assets/src/ba_data/python/ba/_multiteamsession.py @@ -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: diff --git a/assets/src/ba_data/python/ba/_music.py b/assets/src/ba_data/python/ba/_music.py index 58522c62..c1bd2524 100644 --- a/assets/src/ba_data/python/ba/_music.py +++ b/assets/src/ba_data/python/ba/_music.py @@ -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 diff --git a/assets/src/ba_data/python/ba/_netutils.py b/assets/src/ba_data/python/ba/_netutils.py index f28eaab1..1f290972 100644 --- a/assets/src/ba_data/python/ba/_netutils.py +++ b/assets/src/ba_data/python/ba/_netutils.py @@ -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: diff --git a/assets/src/ba_data/python/ba/_playlist.py b/assets/src/ba_data/python/ba/_playlist.py index 5caf6dec..b50b1c6c 100644 --- a/assets/src/ba_data/python/ba/_playlist.py +++ b/assets/src/ba_data/python/ba/_playlist.py @@ -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', diff --git a/assets/src/ba_data/python/ba/_session.py b/assets/src/ba_data/python/ba/_session.py index 2c379a7e..1a5c4a7d 100644 --- a/assets/src/ba_data/python/ba/_session.py +++ b/assets/src/ba_data/python/ba/_session.py @@ -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 diff --git a/assets/src/ba_data/python/ba/_team.py b/assets/src/ba_data/python/ba/_team.py index 23f53726..31e2e9d1 100644 --- a/assets/src/ba_data/python/ba/_team.py +++ b/assets/src/ba_data/python/ba/_team.py @@ -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. diff --git a/assets/src/ba_data/python/ba/_teamgame.py b/assets/src/ba_data/python/ba/_teamgame.py index 344e22f9..7c13f6ab 100644 --- a/assets/src/ba_data/python/ba/_teamgame.py +++ b/assets/src/ba_data/python/ba/_teamgame.py @@ -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) diff --git a/assets/src/ba_data/python/ba/macmusicapp.py b/assets/src/ba_data/python/ba/macmusicapp.py index 816e0200..94a3b48f 100644 --- a/assets/src/ba_data/python/ba/macmusicapp.py +++ b/assets/src/ba_data/python/ba/macmusicapp.py @@ -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( diff --git a/assets/src/ba_data/python/ba/osmusic.py b/assets/src/ba_data/python/ba/osmusic.py index 6caacaf6..38a097c8 100644 --- a/assets/src/ba_data/python/ba/osmusic.py +++ b/assets/src/ba_data/python/ba/osmusic.py @@ -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): diff --git a/assets/src/ba_data/python/bastd/activity/coopjoin.py b/assets/src/ba_data/python/bastd/activity/coopjoin.py index 232354e0..048dfa68 100644 --- a/assets/src/ba_data/python/bastd/activity/coopjoin.py +++ b/assets/src/ba_data/python/bastd/activity/coopjoin.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/activity/coopscore.py b/assets/src/ba_data/python/bastd/activity/coopscore.py index ef21e370..23604e2b 100644 --- a/assets/src/ba_data/python/bastd/activity/coopscore.py +++ b/assets/src/ba_data/python/bastd/activity/coopscore.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/activity/multiteamscore.py b/assets/src/ba_data/python/bastd/activity/multiteamscore.py index d32cedfe..7eaed72b 100644 --- a/assets/src/ba_data/python/bastd/activity/multiteamscore.py +++ b/assets/src/ba_data/python/bastd/activity/multiteamscore.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/actor/background.py b/assets/src/ba_data/python/bastd/actor/background.py index 02811c7c..86b0031a 100644 --- a/assets/src/ba_data/python/bastd/actor/background.py +++ b/assets/src/ba_data/python/bastd/actor/background.py @@ -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 }, diff --git a/assets/src/ba_data/python/bastd/actor/bomb.py b/assets/src/ba_data/python/bastd/actor/bomb.py index 2a0adc5a..bf4aca77 100644 --- a/assets/src/ba_data/python/bastd/actor/bomb.py +++ b/assets/src/ba_data/python/bastd/actor/bomb.py @@ -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, diff --git a/assets/src/ba_data/python/bastd/actor/flag.py b/assets/src/ba_data/python/bastd/actor/flag.py index 844b6625..f9784336 100644 --- a/assets/src/ba_data/python/bastd/actor/flag.py +++ b/assets/src/ba_data/python/bastd/actor/flag.py @@ -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]) diff --git a/assets/src/ba_data/python/bastd/actor/onscreencountdown.py b/assets/src/ba_data/python/bastd/actor/onscreencountdown.py index 1a838da6..59b5070c 100644 --- a/assets/src/ba_data/python/bastd/actor/onscreencountdown.py +++ b/assets/src/ba_data/python/bastd/actor/onscreencountdown.py @@ -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')) diff --git a/assets/src/ba_data/python/bastd/actor/playerspaz.py b/assets/src/ba_data/python/bastd/actor/playerspaz.py index d83cab93..82a1c0b7 100644 --- a/assets/src/ba_data/python/bastd/actor/playerspaz.py +++ b/assets/src/ba_data/python/bastd/actor/playerspaz.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/actor/powerupbox.py b/assets/src/ba_data/python/bastd/actor/powerupbox.py index 513cfbea..29f14766 100644 --- a/assets/src/ba_data/python/bastd/actor/powerupbox.py +++ b/assets/src/ba_data/python/bastd/actor/powerupbox.py @@ -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): diff --git a/assets/src/ba_data/python/bastd/actor/scoreboard.py b/assets/src/ba_data/python/bastd/actor/scoreboard.py index 0a4a6aba..c229ca55 100644 --- a/assets/src/ba_data/python/bastd/actor/scoreboard.py +++ b/assets/src/ba_data/python/bastd/actor/scoreboard.py @@ -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, diff --git a/assets/src/ba_data/python/bastd/actor/spaz.py b/assets/src/ba_data/python/bastd/actor/spaz.py index b2baeba4..3f510b14 100644 --- a/assets/src/ba_data/python/bastd/actor/spaz.py +++ b/assets/src/ba_data/python/bastd/actor/spaz.py @@ -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, diff --git a/assets/src/ba_data/python/bastd/actor/spazappearance.py b/assets/src/ba_data/python/bastd/actor/spazappearance.py index be4d0f66..65e9dcdd 100644 --- a/assets/src/ba_data/python/bastd/actor/spazappearance.py +++ b/assets/src/ba_data/python/bastd/actor/spazappearance.py @@ -106,22 +106,22 @@ class Appearance: def __init__(self, name: str): self.name = name if self.name in ba.app.spaz_appearances: - raise Exception("spaz appearance name \"" + self.name + - "\" already exists.") + raise Exception('spaz appearance name "' + self.name + + '" already exists.') ba.app.spaz_appearances[self.name] = self - self.color_texture = "" - self.color_mask_texture = "" - self.icon_texture = "" - self.icon_mask_texture = "" - self.head_model = "" - self.torso_model = "" - self.pelvis_model = "" - self.upper_arm_model = "" - self.forearm_model = "" - self.hand_model = "" - self.upper_leg_model = "" - self.lower_leg_model = "" - self.toes_model = "" + self.color_texture = '' + self.color_mask_texture = '' + self.icon_texture = '' + self.icon_mask_texture = '' + self.head_model = '' + self.torso_model = '' + self.pelvis_model = '' + self.upper_arm_model = '' + self.forearm_model = '' + self.hand_model = '' + self.upper_leg_model = '' + self.lower_leg_model = '' + self.toes_model = '' self.jump_sounds: List[str] = [] self.attack_sounds: List[str] = [] self.impact_sounds: List[str] = [] @@ -142,221 +142,221 @@ def register_appearances() -> None: # pylint: disable=too-many-statements # Spaz ####################################### - t = Appearance("Spaz") - t.color_texture = "neoSpazColor" - t.color_mask_texture = "neoSpazColorMask" - t.icon_texture = "neoSpazIcon" - t.icon_mask_texture = "neoSpazIconColorMask" - t.head_model = "neoSpazHead" - t.torso_model = "neoSpazTorso" - t.pelvis_model = "neoSpazPelvis" - t.upper_arm_model = "neoSpazUpperArm" - t.forearm_model = "neoSpazForeArm" - t.hand_model = "neoSpazHand" - t.upper_leg_model = "neoSpazUpperLeg" - t.lower_leg_model = "neoSpazLowerLeg" - t.toes_model = "neoSpazToes" - t.jump_sounds = ["spazJump01", "spazJump02", "spazJump03", "spazJump04"] + t = Appearance('Spaz') + t.color_texture = 'neoSpazColor' + t.color_mask_texture = 'neoSpazColorMask' + t.icon_texture = 'neoSpazIcon' + t.icon_mask_texture = 'neoSpazIconColorMask' + t.head_model = 'neoSpazHead' + t.torso_model = 'neoSpazTorso' + t.pelvis_model = 'neoSpazPelvis' + t.upper_arm_model = 'neoSpazUpperArm' + t.forearm_model = 'neoSpazForeArm' + t.hand_model = 'neoSpazHand' + t.upper_leg_model = 'neoSpazUpperLeg' + t.lower_leg_model = 'neoSpazLowerLeg' + t.toes_model = 'neoSpazToes' + t.jump_sounds = ['spazJump01', 'spazJump02', 'spazJump03', 'spazJump04'] t.attack_sounds = [ - "spazAttack01", "spazAttack02", "spazAttack03", "spazAttack04" + 'spazAttack01', 'spazAttack02', 'spazAttack03', 'spazAttack04' ] t.impact_sounds = [ - "spazImpact01", "spazImpact02", "spazImpact03", "spazImpact04" + 'spazImpact01', 'spazImpact02', 'spazImpact03', 'spazImpact04' ] - t.death_sounds = ["spazDeath01"] - t.pickup_sounds = ["spazPickup01"] - t.fall_sounds = ["spazFall01"] + t.death_sounds = ['spazDeath01'] + t.pickup_sounds = ['spazPickup01'] + t.fall_sounds = ['spazFall01'] t.style = 'spaz' # Zoe ##################################### - t = Appearance("Zoe") - t.color_texture = "zoeColor" - t.color_mask_texture = "zoeColorMask" + t = Appearance('Zoe') + t.color_texture = 'zoeColor' + t.color_mask_texture = 'zoeColorMask' t.default_color = (0.6, 0.6, 0.6) t.default_highlight = (0, 1, 0) - t.icon_texture = "zoeIcon" - t.icon_mask_texture = "zoeIconColorMask" - t.head_model = "zoeHead" - t.torso_model = "zoeTorso" - t.pelvis_model = "zoePelvis" - t.upper_arm_model = "zoeUpperArm" - t.forearm_model = "zoeForeArm" - t.hand_model = "zoeHand" - t.upper_leg_model = "zoeUpperLeg" - t.lower_leg_model = "zoeLowerLeg" - t.toes_model = "zoeToes" - t.jump_sounds = ["zoeJump01", "zoeJump02", "zoeJump03"] + t.icon_texture = 'zoeIcon' + t.icon_mask_texture = 'zoeIconColorMask' + t.head_model = 'zoeHead' + t.torso_model = 'zoeTorso' + t.pelvis_model = 'zoePelvis' + t.upper_arm_model = 'zoeUpperArm' + t.forearm_model = 'zoeForeArm' + t.hand_model = 'zoeHand' + t.upper_leg_model = 'zoeUpperLeg' + t.lower_leg_model = 'zoeLowerLeg' + t.toes_model = 'zoeToes' + t.jump_sounds = ['zoeJump01', 'zoeJump02', 'zoeJump03'] t.attack_sounds = [ - "zoeAttack01", "zoeAttack02", "zoeAttack03", "zoeAttack04" + 'zoeAttack01', 'zoeAttack02', 'zoeAttack03', 'zoeAttack04' ] t.impact_sounds = [ - "zoeImpact01", "zoeImpact02", "zoeImpact03", "zoeImpact04" + 'zoeImpact01', 'zoeImpact02', 'zoeImpact03', 'zoeImpact04' ] - t.death_sounds = ["zoeDeath01"] - t.pickup_sounds = ["zoePickup01"] - t.fall_sounds = ["zoeFall01"] + t.death_sounds = ['zoeDeath01'] + t.pickup_sounds = ['zoePickup01'] + t.fall_sounds = ['zoeFall01'] t.style = 'female' # Ninja ########################################## - t = Appearance("Snake Shadow") - t.color_texture = "ninjaColor" - t.color_mask_texture = "ninjaColorMask" + t = Appearance('Snake Shadow') + t.color_texture = 'ninjaColor' + t.color_mask_texture = 'ninjaColorMask' t.default_color = (1, 1, 1) t.default_highlight = (0.55, 0.8, 0.55) - t.icon_texture = "ninjaIcon" - t.icon_mask_texture = "ninjaIconColorMask" - t.head_model = "ninjaHead" - t.torso_model = "ninjaTorso" - t.pelvis_model = "ninjaPelvis" - t.upper_arm_model = "ninjaUpperArm" - t.forearm_model = "ninjaForeArm" - t.hand_model = "ninjaHand" - t.upper_leg_model = "ninjaUpperLeg" - t.lower_leg_model = "ninjaLowerLeg" - t.toes_model = "ninjaToes" + t.icon_texture = 'ninjaIcon' + t.icon_mask_texture = 'ninjaIconColorMask' + t.head_model = 'ninjaHead' + t.torso_model = 'ninjaTorso' + t.pelvis_model = 'ninjaPelvis' + t.upper_arm_model = 'ninjaUpperArm' + t.forearm_model = 'ninjaForeArm' + t.hand_model = 'ninjaHand' + t.upper_leg_model = 'ninjaUpperLeg' + t.lower_leg_model = 'ninjaLowerLeg' + t.toes_model = 'ninjaToes' ninja_attacks = ['ninjaAttack' + str(i + 1) + '' for i in range(7)] ninja_hits = ['ninjaHit' + str(i + 1) + '' for i in range(8)] ninja_jumps = ['ninjaAttack' + str(i + 1) + '' for i in range(7)] t.jump_sounds = ninja_jumps t.attack_sounds = ninja_attacks t.impact_sounds = ninja_hits - t.death_sounds = ["ninjaDeath1"] + t.death_sounds = ['ninjaDeath1'] t.pickup_sounds = ninja_attacks - t.fall_sounds = ["ninjaFall1"] + t.fall_sounds = ['ninjaFall1'] t.style = 'ninja' # Barbarian ##################################### - t = Appearance("Kronk") - t.color_texture = "kronk" - t.color_mask_texture = "kronkColorMask" + t = Appearance('Kronk') + t.color_texture = 'kronk' + t.color_mask_texture = 'kronkColorMask' t.default_color = (0.4, 0.5, 0.4) t.default_highlight = (1, 0.5, 0.3) - t.icon_texture = "kronkIcon" - t.icon_mask_texture = "kronkIconColorMask" - t.head_model = "kronkHead" - t.torso_model = "kronkTorso" - t.pelvis_model = "kronkPelvis" - t.upper_arm_model = "kronkUpperArm" - t.forearm_model = "kronkForeArm" - t.hand_model = "kronkHand" - t.upper_leg_model = "kronkUpperLeg" - t.lower_leg_model = "kronkLowerLeg" - t.toes_model = "kronkToes" + t.icon_texture = 'kronkIcon' + t.icon_mask_texture = 'kronkIconColorMask' + t.head_model = 'kronkHead' + t.torso_model = 'kronkTorso' + t.pelvis_model = 'kronkPelvis' + t.upper_arm_model = 'kronkUpperArm' + t.forearm_model = 'kronkForeArm' + t.hand_model = 'kronkHand' + t.upper_leg_model = 'kronkUpperLeg' + t.lower_leg_model = 'kronkLowerLeg' + t.toes_model = 'kronkToes' kronk_sounds = [ - "kronk1", "kronk2", "kronk3", "kronk4", "kronk5", "kronk6", "kronk7", - "kronk8", "kronk9", "kronk10" + 'kronk1', 'kronk2', 'kronk3', 'kronk4', 'kronk5', 'kronk6', 'kronk7', + 'kronk8', 'kronk9', 'kronk10' ] t.jump_sounds = kronk_sounds t.attack_sounds = kronk_sounds t.impact_sounds = kronk_sounds - t.death_sounds = ["kronkDeath"] + t.death_sounds = ['kronkDeath'] t.pickup_sounds = kronk_sounds - t.fall_sounds = ["kronkFall"] + t.fall_sounds = ['kronkFall'] t.style = 'kronk' # Chef ########################################### - t = Appearance("Mel") - t.color_texture = "melColor" - t.color_mask_texture = "melColorMask" + t = Appearance('Mel') + t.color_texture = 'melColor' + t.color_mask_texture = 'melColorMask' t.default_color = (1, 1, 1) t.default_highlight = (0.1, 0.6, 0.1) - t.icon_texture = "melIcon" - t.icon_mask_texture = "melIconColorMask" - t.head_model = "melHead" - t.torso_model = "melTorso" - t.pelvis_model = "kronkPelvis" - t.upper_arm_model = "melUpperArm" - t.forearm_model = "melForeArm" - t.hand_model = "melHand" - t.upper_leg_model = "melUpperLeg" - t.lower_leg_model = "melLowerLeg" - t.toes_model = "melToes" + t.icon_texture = 'melIcon' + t.icon_mask_texture = 'melIconColorMask' + t.head_model = 'melHead' + t.torso_model = 'melTorso' + t.pelvis_model = 'kronkPelvis' + t.upper_arm_model = 'melUpperArm' + t.forearm_model = 'melForeArm' + t.hand_model = 'melHand' + t.upper_leg_model = 'melUpperLeg' + t.lower_leg_model = 'melLowerLeg' + t.toes_model = 'melToes' mel_sounds = [ - "mel01", "mel02", "mel03", "mel04", "mel05", "mel06", "mel07", "mel08", - "mel09", "mel10" + 'mel01', 'mel02', 'mel03', 'mel04', 'mel05', 'mel06', 'mel07', 'mel08', + 'mel09', 'mel10' ] t.attack_sounds = mel_sounds t.jump_sounds = mel_sounds t.impact_sounds = mel_sounds - t.death_sounds = ["melDeath01"] + t.death_sounds = ['melDeath01'] t.pickup_sounds = mel_sounds - t.fall_sounds = ["melFall01"] + t.fall_sounds = ['melFall01'] t.style = 'mel' # Pirate ####################################### - t = Appearance("Jack Morgan") - t.color_texture = "jackColor" - t.color_mask_texture = "jackColorMask" + t = Appearance('Jack Morgan') + t.color_texture = 'jackColor' + t.color_mask_texture = 'jackColorMask' t.default_color = (1, 0.2, 0.1) t.default_highlight = (1, 1, 0) - t.icon_texture = "jackIcon" - t.icon_mask_texture = "jackIconColorMask" - t.head_model = "jackHead" - t.torso_model = "jackTorso" - t.pelvis_model = "kronkPelvis" - t.upper_arm_model = "jackUpperArm" - t.forearm_model = "jackForeArm" - t.hand_model = "jackHand" - t.upper_leg_model = "jackUpperLeg" - t.lower_leg_model = "jackLowerLeg" - t.toes_model = "jackToes" + t.icon_texture = 'jackIcon' + t.icon_mask_texture = 'jackIconColorMask' + t.head_model = 'jackHead' + t.torso_model = 'jackTorso' + t.pelvis_model = 'kronkPelvis' + t.upper_arm_model = 'jackUpperArm' + t.forearm_model = 'jackForeArm' + t.hand_model = 'jackHand' + t.upper_leg_model = 'jackUpperLeg' + t.lower_leg_model = 'jackLowerLeg' + t.toes_model = 'jackToes' hit_sounds = [ - "jackHit01", "jackHit02", "jackHit03", "jackHit04", "jackHit05", - "jackHit06", "jackHit07" + 'jackHit01', 'jackHit02', 'jackHit03', 'jackHit04', 'jackHit05', + 'jackHit06', 'jackHit07' ] - sounds = ["jack01", "jack02", "jack03", "jack04", "jack05", "jack06"] + sounds = ['jack01', 'jack02', 'jack03', 'jack04', 'jack05', 'jack06'] t.attack_sounds = sounds t.jump_sounds = sounds t.impact_sounds = hit_sounds - t.death_sounds = ["jackDeath01"] + t.death_sounds = ['jackDeath01'] t.pickup_sounds = sounds - t.fall_sounds = ["jackFall01"] + t.fall_sounds = ['jackFall01'] t.style = 'pirate' # Santa ###################################### - t = Appearance("Santa Claus") - t.color_texture = "santaColor" - t.color_mask_texture = "santaColorMask" + t = Appearance('Santa Claus') + t.color_texture = 'santaColor' + t.color_mask_texture = 'santaColorMask' t.default_color = (1, 0, 0) t.default_highlight = (1, 1, 1) - t.icon_texture = "santaIcon" - t.icon_mask_texture = "santaIconColorMask" - t.head_model = "santaHead" - t.torso_model = "santaTorso" - t.pelvis_model = "kronkPelvis" - t.upper_arm_model = "santaUpperArm" - t.forearm_model = "santaForeArm" - t.hand_model = "santaHand" - t.upper_leg_model = "santaUpperLeg" - t.lower_leg_model = "santaLowerLeg" - t.toes_model = "santaToes" + t.icon_texture = 'santaIcon' + t.icon_mask_texture = 'santaIconColorMask' + t.head_model = 'santaHead' + t.torso_model = 'santaTorso' + t.pelvis_model = 'kronkPelvis' + t.upper_arm_model = 'santaUpperArm' + t.forearm_model = 'santaForeArm' + t.hand_model = 'santaHand' + t.upper_leg_model = 'santaUpperLeg' + t.lower_leg_model = 'santaLowerLeg' + t.toes_model = 'santaToes' hit_sounds = ['santaHit01', 'santaHit02', 'santaHit03', 'santaHit04'] sounds = ['santa01', 'santa02', 'santa03', 'santa04', 'santa05'] t.attack_sounds = sounds t.jump_sounds = sounds t.impact_sounds = hit_sounds - t.death_sounds = ["santaDeath"] + t.death_sounds = ['santaDeath'] t.pickup_sounds = sounds - t.fall_sounds = ["santaFall"] + t.fall_sounds = ['santaFall'] t.style = 'santa' # Snowman ################################### - t = Appearance("Frosty") - t.color_texture = "frostyColor" - t.color_mask_texture = "frostyColorMask" + t = Appearance('Frosty') + t.color_texture = 'frostyColor' + t.color_mask_texture = 'frostyColorMask' t.default_color = (0.5, 0.5, 1) t.default_highlight = (1, 0.5, 0) - t.icon_texture = "frostyIcon" - t.icon_mask_texture = "frostyIconColorMask" - t.head_model = "frostyHead" - t.torso_model = "frostyTorso" - t.pelvis_model = "frostyPelvis" - t.upper_arm_model = "frostyUpperArm" - t.forearm_model = "frostyForeArm" - t.hand_model = "frostyHand" - t.upper_leg_model = "frostyUpperLeg" - t.lower_leg_model = "frostyLowerLeg" - t.toes_model = "frostyToes" + t.icon_texture = 'frostyIcon' + t.icon_mask_texture = 'frostyIconColorMask' + t.head_model = 'frostyHead' + t.torso_model = 'frostyTorso' + t.pelvis_model = 'frostyPelvis' + t.upper_arm_model = 'frostyUpperArm' + t.forearm_model = 'frostyForeArm' + t.hand_model = 'frostyHand' + t.upper_leg_model = 'frostyUpperLeg' + t.lower_leg_model = 'frostyLowerLeg' + t.toes_model = 'frostyToes' frosty_sounds = [ 'frosty01', 'frosty02', 'frosty03', 'frosty04', 'frosty05' ] @@ -364,216 +364,216 @@ def register_appearances() -> None: t.attack_sounds = frosty_sounds t.jump_sounds = frosty_sounds t.impact_sounds = frosty_hit_sounds - t.death_sounds = ["frostyDeath"] + t.death_sounds = ['frostyDeath'] t.pickup_sounds = frosty_sounds - t.fall_sounds = ["frostyFall"] + t.fall_sounds = ['frostyFall'] t.style = 'frosty' # Skeleton ################################ - t = Appearance("Bones") - t.color_texture = "bonesColor" - t.color_mask_texture = "bonesColorMask" + t = Appearance('Bones') + t.color_texture = 'bonesColor' + t.color_mask_texture = 'bonesColorMask' t.default_color = (0.6, 0.9, 1) t.default_highlight = (0.6, 0.9, 1) - t.icon_texture = "bonesIcon" - t.icon_mask_texture = "bonesIconColorMask" - t.head_model = "bonesHead" - t.torso_model = "bonesTorso" - t.pelvis_model = "bonesPelvis" - t.upper_arm_model = "bonesUpperArm" - t.forearm_model = "bonesForeArm" - t.hand_model = "bonesHand" - t.upper_leg_model = "bonesUpperLeg" - t.lower_leg_model = "bonesLowerLeg" - t.toes_model = "bonesToes" + t.icon_texture = 'bonesIcon' + t.icon_mask_texture = 'bonesIconColorMask' + t.head_model = 'bonesHead' + t.torso_model = 'bonesTorso' + t.pelvis_model = 'bonesPelvis' + t.upper_arm_model = 'bonesUpperArm' + t.forearm_model = 'bonesForeArm' + t.hand_model = 'bonesHand' + t.upper_leg_model = 'bonesUpperLeg' + t.lower_leg_model = 'bonesLowerLeg' + t.toes_model = 'bonesToes' bones_sounds = ['bones1', 'bones2', 'bones3'] bones_hit_sounds = ['bones1', 'bones2', 'bones3'] t.attack_sounds = bones_sounds t.jump_sounds = bones_sounds t.impact_sounds = bones_hit_sounds - t.death_sounds = ["bonesDeath"] + t.death_sounds = ['bonesDeath'] t.pickup_sounds = bones_sounds - t.fall_sounds = ["bonesFall"] + t.fall_sounds = ['bonesFall'] t.style = 'bones' # Bear ################################### - t = Appearance("Bernard") - t.color_texture = "bearColor" - t.color_mask_texture = "bearColorMask" + t = Appearance('Bernard') + t.color_texture = 'bearColor' + t.color_mask_texture = 'bearColorMask' t.default_color = (0.7, 0.5, 0.0) - t.icon_texture = "bearIcon" - t.icon_mask_texture = "bearIconColorMask" - t.head_model = "bearHead" - t.torso_model = "bearTorso" - t.pelvis_model = "bearPelvis" - t.upper_arm_model = "bearUpperArm" - t.forearm_model = "bearForeArm" - t.hand_model = "bearHand" - t.upper_leg_model = "bearUpperLeg" - t.lower_leg_model = "bearLowerLeg" - t.toes_model = "bearToes" + t.icon_texture = 'bearIcon' + t.icon_mask_texture = 'bearIconColorMask' + t.head_model = 'bearHead' + t.torso_model = 'bearTorso' + t.pelvis_model = 'bearPelvis' + t.upper_arm_model = 'bearUpperArm' + t.forearm_model = 'bearForeArm' + t.hand_model = 'bearHand' + t.upper_leg_model = 'bearUpperLeg' + t.lower_leg_model = 'bearLowerLeg' + t.toes_model = 'bearToes' bear_sounds = ['bear1', 'bear2', 'bear3', 'bear4'] bear_hit_sounds = ['bearHit1', 'bearHit2'] t.attack_sounds = bear_sounds t.jump_sounds = bear_sounds t.impact_sounds = bear_hit_sounds - t.death_sounds = ["bearDeath"] + t.death_sounds = ['bearDeath'] t.pickup_sounds = bear_sounds - t.fall_sounds = ["bearFall"] + t.fall_sounds = ['bearFall'] t.style = 'bear' # Penguin ################################### - t = Appearance("Pascal") - t.color_texture = "penguinColor" - t.color_mask_texture = "penguinColorMask" + t = Appearance('Pascal') + t.color_texture = 'penguinColor' + t.color_mask_texture = 'penguinColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "penguinIcon" - t.icon_mask_texture = "penguinIconColorMask" - t.head_model = "penguinHead" - t.torso_model = "penguinTorso" - t.pelvis_model = "penguinPelvis" - t.upper_arm_model = "penguinUpperArm" - t.forearm_model = "penguinForeArm" - t.hand_model = "penguinHand" - t.upper_leg_model = "penguinUpperLeg" - t.lower_leg_model = "penguinLowerLeg" - t.toes_model = "penguinToes" + t.icon_texture = 'penguinIcon' + t.icon_mask_texture = 'penguinIconColorMask' + t.head_model = 'penguinHead' + t.torso_model = 'penguinTorso' + t.pelvis_model = 'penguinPelvis' + t.upper_arm_model = 'penguinUpperArm' + t.forearm_model = 'penguinForeArm' + t.hand_model = 'penguinHand' + t.upper_leg_model = 'penguinUpperLeg' + t.lower_leg_model = 'penguinLowerLeg' + t.toes_model = 'penguinToes' penguin_sounds = ['penguin1', 'penguin2', 'penguin3', 'penguin4'] penguin_hit_sounds = ['penguinHit1', 'penguinHit2'] t.attack_sounds = penguin_sounds t.jump_sounds = penguin_sounds t.impact_sounds = penguin_hit_sounds - t.death_sounds = ["penguinDeath"] + t.death_sounds = ['penguinDeath'] t.pickup_sounds = penguin_sounds - t.fall_sounds = ["penguinFall"] + t.fall_sounds = ['penguinFall'] t.style = 'penguin' # Ali ################################### - t = Appearance("Taobao Mascot") - t.color_texture = "aliColor" - t.color_mask_texture = "aliColorMask" + t = Appearance('Taobao Mascot') + t.color_texture = 'aliColor' + t.color_mask_texture = 'aliColorMask' t.default_color = (1, 0.5, 0) t.default_highlight = (1, 1, 1) - t.icon_texture = "aliIcon" - t.icon_mask_texture = "aliIconColorMask" - t.head_model = "aliHead" - t.torso_model = "aliTorso" - t.pelvis_model = "aliPelvis" - t.upper_arm_model = "aliUpperArm" - t.forearm_model = "aliForeArm" - t.hand_model = "aliHand" - t.upper_leg_model = "aliUpperLeg" - t.lower_leg_model = "aliLowerLeg" - t.toes_model = "aliToes" + t.icon_texture = 'aliIcon' + t.icon_mask_texture = 'aliIconColorMask' + t.head_model = 'aliHead' + t.torso_model = 'aliTorso' + t.pelvis_model = 'aliPelvis' + t.upper_arm_model = 'aliUpperArm' + t.forearm_model = 'aliForeArm' + t.hand_model = 'aliHand' + t.upper_leg_model = 'aliUpperLeg' + t.lower_leg_model = 'aliLowerLeg' + t.toes_model = 'aliToes' ali_sounds = ['ali1', 'ali2', 'ali3', 'ali4'] ali_hit_sounds = ['aliHit1', 'aliHit2'] t.attack_sounds = ali_sounds t.jump_sounds = ali_sounds t.impact_sounds = ali_hit_sounds - t.death_sounds = ["aliDeath"] + t.death_sounds = ['aliDeath'] t.pickup_sounds = ali_sounds - t.fall_sounds = ["aliFall"] + t.fall_sounds = ['aliFall'] t.style = 'ali' # cyborg ################################### - t = Appearance("B-9000") - t.color_texture = "cyborgColor" - t.color_mask_texture = "cyborgColorMask" + t = Appearance('B-9000') + t.color_texture = 'cyborgColor' + t.color_mask_texture = 'cyborgColorMask' t.default_color = (0.5, 0.5, 0.5) t.default_highlight = (1, 0, 0) - t.icon_texture = "cyborgIcon" - t.icon_mask_texture = "cyborgIconColorMask" - t.head_model = "cyborgHead" - t.torso_model = "cyborgTorso" - t.pelvis_model = "cyborgPelvis" - t.upper_arm_model = "cyborgUpperArm" - t.forearm_model = "cyborgForeArm" - t.hand_model = "cyborgHand" - t.upper_leg_model = "cyborgUpperLeg" - t.lower_leg_model = "cyborgLowerLeg" - t.toes_model = "cyborgToes" + t.icon_texture = 'cyborgIcon' + t.icon_mask_texture = 'cyborgIconColorMask' + t.head_model = 'cyborgHead' + t.torso_model = 'cyborgTorso' + t.pelvis_model = 'cyborgPelvis' + t.upper_arm_model = 'cyborgUpperArm' + t.forearm_model = 'cyborgForeArm' + t.hand_model = 'cyborgHand' + t.upper_leg_model = 'cyborgUpperLeg' + t.lower_leg_model = 'cyborgLowerLeg' + t.toes_model = 'cyborgToes' cyborg_sounds = ['cyborg1', 'cyborg2', 'cyborg3', 'cyborg4'] cyborg_hit_sounds = ['cyborgHit1', 'cyborgHit2'] t.attack_sounds = cyborg_sounds t.jump_sounds = cyborg_sounds t.impact_sounds = cyborg_hit_sounds - t.death_sounds = ["cyborgDeath"] + t.death_sounds = ['cyborgDeath'] t.pickup_sounds = cyborg_sounds - t.fall_sounds = ["cyborgFall"] + t.fall_sounds = ['cyborgFall'] t.style = 'cyborg' # Agent ################################### - t = Appearance("Agent Johnson") - t.color_texture = "agentColor" - t.color_mask_texture = "agentColorMask" + t = Appearance('Agent Johnson') + t.color_texture = 'agentColor' + t.color_mask_texture = 'agentColorMask' t.default_color = (0.3, 0.3, 0.33) t.default_highlight = (1, 0.5, 0.3) - t.icon_texture = "agentIcon" - t.icon_mask_texture = "agentIconColorMask" - t.head_model = "agentHead" - t.torso_model = "agentTorso" - t.pelvis_model = "agentPelvis" - t.upper_arm_model = "agentUpperArm" - t.forearm_model = "agentForeArm" - t.hand_model = "agentHand" - t.upper_leg_model = "agentUpperLeg" - t.lower_leg_model = "agentLowerLeg" - t.toes_model = "agentToes" + t.icon_texture = 'agentIcon' + t.icon_mask_texture = 'agentIconColorMask' + t.head_model = 'agentHead' + t.torso_model = 'agentTorso' + t.pelvis_model = 'agentPelvis' + t.upper_arm_model = 'agentUpperArm' + t.forearm_model = 'agentForeArm' + t.hand_model = 'agentHand' + t.upper_leg_model = 'agentUpperLeg' + t.lower_leg_model = 'agentLowerLeg' + t.toes_model = 'agentToes' agent_sounds = ['agent1', 'agent2', 'agent3', 'agent4'] agent_hit_sounds = ['agentHit1', 'agentHit2'] t.attack_sounds = agent_sounds t.jump_sounds = agent_sounds t.impact_sounds = agent_hit_sounds - t.death_sounds = ["agentDeath"] + t.death_sounds = ['agentDeath'] t.pickup_sounds = agent_sounds - t.fall_sounds = ["agentFall"] + t.fall_sounds = ['agentFall'] t.style = 'agent' # Jumpsuit ################################### - t = Appearance("Lee") - t.color_texture = "jumpsuitColor" - t.color_mask_texture = "jumpsuitColorMask" + t = Appearance('Lee') + t.color_texture = 'jumpsuitColor' + t.color_mask_texture = 'jumpsuitColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "jumpsuitIcon" - t.icon_mask_texture = "jumpsuitIconColorMask" - t.head_model = "jumpsuitHead" - t.torso_model = "jumpsuitTorso" - t.pelvis_model = "jumpsuitPelvis" - t.upper_arm_model = "jumpsuitUpperArm" - t.forearm_model = "jumpsuitForeArm" - t.hand_model = "jumpsuitHand" - t.upper_leg_model = "jumpsuitUpperLeg" - t.lower_leg_model = "jumpsuitLowerLeg" - t.toes_model = "jumpsuitToes" + t.icon_texture = 'jumpsuitIcon' + t.icon_mask_texture = 'jumpsuitIconColorMask' + t.head_model = 'jumpsuitHead' + t.torso_model = 'jumpsuitTorso' + t.pelvis_model = 'jumpsuitPelvis' + t.upper_arm_model = 'jumpsuitUpperArm' + t.forearm_model = 'jumpsuitForeArm' + t.hand_model = 'jumpsuitHand' + t.upper_leg_model = 'jumpsuitUpperLeg' + t.lower_leg_model = 'jumpsuitLowerLeg' + t.toes_model = 'jumpsuitToes' jumpsuit_sounds = ['jumpsuit1', 'jumpsuit2', 'jumpsuit3', 'jumpsuit4'] jumpsuit_hit_sounds = ['jumpsuitHit1', 'jumpsuitHit2'] t.attack_sounds = jumpsuit_sounds t.jump_sounds = jumpsuit_sounds t.impact_sounds = jumpsuit_hit_sounds - t.death_sounds = ["jumpsuitDeath"] + t.death_sounds = ['jumpsuitDeath'] t.pickup_sounds = jumpsuit_sounds - t.fall_sounds = ["jumpsuitFall"] + t.fall_sounds = ['jumpsuitFall'] t.style = 'spaz' # ActionHero ################################### - t = Appearance("Todd McBurton") - t.color_texture = "actionHeroColor" - t.color_mask_texture = "actionHeroColorMask" + t = Appearance('Todd McBurton') + t.color_texture = 'actionHeroColor' + t.color_mask_texture = 'actionHeroColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "actionHeroIcon" - t.icon_mask_texture = "actionHeroIconColorMask" - t.head_model = "actionHeroHead" - t.torso_model = "actionHeroTorso" - t.pelvis_model = "actionHeroPelvis" - t.upper_arm_model = "actionHeroUpperArm" - t.forearm_model = "actionHeroForeArm" - t.hand_model = "actionHeroHand" - t.upper_leg_model = "actionHeroUpperLeg" - t.lower_leg_model = "actionHeroLowerLeg" - t.toes_model = "actionHeroToes" + t.icon_texture = 'actionHeroIcon' + t.icon_mask_texture = 'actionHeroIconColorMask' + t.head_model = 'actionHeroHead' + t.torso_model = 'actionHeroTorso' + t.pelvis_model = 'actionHeroPelvis' + t.upper_arm_model = 'actionHeroUpperArm' + t.forearm_model = 'actionHeroForeArm' + t.hand_model = 'actionHeroHand' + t.upper_leg_model = 'actionHeroUpperLeg' + t.lower_leg_model = 'actionHeroLowerLeg' + t.toes_model = 'actionHeroToes' action_hero_sounds = [ 'actionHero1', 'actionHero2', 'actionHero3', 'actionHero4' ] @@ -581,298 +581,298 @@ def register_appearances() -> None: t.attack_sounds = action_hero_sounds t.jump_sounds = action_hero_sounds t.impact_sounds = action_hero_hit_sounds - t.death_sounds = ["actionHeroDeath"] + t.death_sounds = ['actionHeroDeath'] t.pickup_sounds = action_hero_sounds - t.fall_sounds = ["actionHeroFall"] + t.fall_sounds = ['actionHeroFall'] t.style = 'spaz' # Assassin ################################### - t = Appearance("Zola") - t.color_texture = "assassinColor" - t.color_mask_texture = "assassinColorMask" + t = Appearance('Zola') + t.color_texture = 'assassinColor' + t.color_mask_texture = 'assassinColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "assassinIcon" - t.icon_mask_texture = "assassinIconColorMask" - t.head_model = "assassinHead" - t.torso_model = "assassinTorso" - t.pelvis_model = "assassinPelvis" - t.upper_arm_model = "assassinUpperArm" - t.forearm_model = "assassinForeArm" - t.hand_model = "assassinHand" - t.upper_leg_model = "assassinUpperLeg" - t.lower_leg_model = "assassinLowerLeg" - t.toes_model = "assassinToes" + t.icon_texture = 'assassinIcon' + t.icon_mask_texture = 'assassinIconColorMask' + t.head_model = 'assassinHead' + t.torso_model = 'assassinTorso' + t.pelvis_model = 'assassinPelvis' + t.upper_arm_model = 'assassinUpperArm' + t.forearm_model = 'assassinForeArm' + t.hand_model = 'assassinHand' + t.upper_leg_model = 'assassinUpperLeg' + t.lower_leg_model = 'assassinLowerLeg' + t.toes_model = 'assassinToes' assassin_sounds = ['assassin1', 'assassin2', 'assassin3', 'assassin4'] assassin_hit_sounds = ['assassinHit1', 'assassinHit2'] t.attack_sounds = assassin_sounds t.jump_sounds = assassin_sounds t.impact_sounds = assassin_hit_sounds - t.death_sounds = ["assassinDeath"] + t.death_sounds = ['assassinDeath'] t.pickup_sounds = assassin_sounds - t.fall_sounds = ["assassinFall"] + t.fall_sounds = ['assassinFall'] t.style = 'spaz' # Wizard ################################### - t = Appearance("Grumbledorf") - t.color_texture = "wizardColor" - t.color_mask_texture = "wizardColorMask" + t = Appearance('Grumbledorf') + t.color_texture = 'wizardColor' + t.color_mask_texture = 'wizardColorMask' t.default_color = (0.2, 0.4, 1.0) t.default_highlight = (0.06, 0.15, 0.4) - t.icon_texture = "wizardIcon" - t.icon_mask_texture = "wizardIconColorMask" - t.head_model = "wizardHead" - t.torso_model = "wizardTorso" - t.pelvis_model = "wizardPelvis" - t.upper_arm_model = "wizardUpperArm" - t.forearm_model = "wizardForeArm" - t.hand_model = "wizardHand" - t.upper_leg_model = "wizardUpperLeg" - t.lower_leg_model = "wizardLowerLeg" - t.toes_model = "wizardToes" + t.icon_texture = 'wizardIcon' + t.icon_mask_texture = 'wizardIconColorMask' + t.head_model = 'wizardHead' + t.torso_model = 'wizardTorso' + t.pelvis_model = 'wizardPelvis' + t.upper_arm_model = 'wizardUpperArm' + t.forearm_model = 'wizardForeArm' + t.hand_model = 'wizardHand' + t.upper_leg_model = 'wizardUpperLeg' + t.lower_leg_model = 'wizardLowerLeg' + t.toes_model = 'wizardToes' wizard_sounds = ['wizard1', 'wizard2', 'wizard3', 'wizard4'] wizard_hit_sounds = ['wizardHit1', 'wizardHit2'] t.attack_sounds = wizard_sounds t.jump_sounds = wizard_sounds t.impact_sounds = wizard_hit_sounds - t.death_sounds = ["wizardDeath"] + t.death_sounds = ['wizardDeath'] t.pickup_sounds = wizard_sounds - t.fall_sounds = ["wizardFall"] + t.fall_sounds = ['wizardFall'] t.style = 'spaz' # Cowboy ################################### - t = Appearance("Butch") - t.color_texture = "cowboyColor" - t.color_mask_texture = "cowboyColorMask" + t = Appearance('Butch') + t.color_texture = 'cowboyColor' + t.color_mask_texture = 'cowboyColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "cowboyIcon" - t.icon_mask_texture = "cowboyIconColorMask" - t.head_model = "cowboyHead" - t.torso_model = "cowboyTorso" - t.pelvis_model = "cowboyPelvis" - t.upper_arm_model = "cowboyUpperArm" - t.forearm_model = "cowboyForeArm" - t.hand_model = "cowboyHand" - t.upper_leg_model = "cowboyUpperLeg" - t.lower_leg_model = "cowboyLowerLeg" - t.toes_model = "cowboyToes" + t.icon_texture = 'cowboyIcon' + t.icon_mask_texture = 'cowboyIconColorMask' + t.head_model = 'cowboyHead' + t.torso_model = 'cowboyTorso' + t.pelvis_model = 'cowboyPelvis' + t.upper_arm_model = 'cowboyUpperArm' + t.forearm_model = 'cowboyForeArm' + t.hand_model = 'cowboyHand' + t.upper_leg_model = 'cowboyUpperLeg' + t.lower_leg_model = 'cowboyLowerLeg' + t.toes_model = 'cowboyToes' cowboy_sounds = ['cowboy1', 'cowboy2', 'cowboy3', 'cowboy4'] cowboy_hit_sounds = ['cowboyHit1', 'cowboyHit2'] t.attack_sounds = cowboy_sounds t.jump_sounds = cowboy_sounds t.impact_sounds = cowboy_hit_sounds - t.death_sounds = ["cowboyDeath"] + t.death_sounds = ['cowboyDeath'] t.pickup_sounds = cowboy_sounds - t.fall_sounds = ["cowboyFall"] + t.fall_sounds = ['cowboyFall'] t.style = 'spaz' # Witch ################################### - t = Appearance("Witch") - t.color_texture = "witchColor" - t.color_mask_texture = "witchColorMask" + t = Appearance('Witch') + t.color_texture = 'witchColor' + t.color_mask_texture = 'witchColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "witchIcon" - t.icon_mask_texture = "witchIconColorMask" - t.head_model = "witchHead" - t.torso_model = "witchTorso" - t.pelvis_model = "witchPelvis" - t.upper_arm_model = "witchUpperArm" - t.forearm_model = "witchForeArm" - t.hand_model = "witchHand" - t.upper_leg_model = "witchUpperLeg" - t.lower_leg_model = "witchLowerLeg" - t.toes_model = "witchToes" + t.icon_texture = 'witchIcon' + t.icon_mask_texture = 'witchIconColorMask' + t.head_model = 'witchHead' + t.torso_model = 'witchTorso' + t.pelvis_model = 'witchPelvis' + t.upper_arm_model = 'witchUpperArm' + t.forearm_model = 'witchForeArm' + t.hand_model = 'witchHand' + t.upper_leg_model = 'witchUpperLeg' + t.lower_leg_model = 'witchLowerLeg' + t.toes_model = 'witchToes' witch_sounds = ['witch1', 'witch2', 'witch3', 'witch4'] witch_hit_sounds = ['witchHit1', 'witchHit2'] t.attack_sounds = witch_sounds t.jump_sounds = witch_sounds t.impact_sounds = witch_hit_sounds - t.death_sounds = ["witchDeath"] + t.death_sounds = ['witchDeath'] t.pickup_sounds = witch_sounds - t.fall_sounds = ["witchFall"] + t.fall_sounds = ['witchFall'] t.style = 'spaz' # Warrior ################################### - t = Appearance("Warrior") - t.color_texture = "warriorColor" - t.color_mask_texture = "warriorColorMask" + t = Appearance('Warrior') + t.color_texture = 'warriorColor' + t.color_mask_texture = 'warriorColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "warriorIcon" - t.icon_mask_texture = "warriorIconColorMask" - t.head_model = "warriorHead" - t.torso_model = "warriorTorso" - t.pelvis_model = "warriorPelvis" - t.upper_arm_model = "warriorUpperArm" - t.forearm_model = "warriorForeArm" - t.hand_model = "warriorHand" - t.upper_leg_model = "warriorUpperLeg" - t.lower_leg_model = "warriorLowerLeg" - t.toes_model = "warriorToes" + t.icon_texture = 'warriorIcon' + t.icon_mask_texture = 'warriorIconColorMask' + t.head_model = 'warriorHead' + t.torso_model = 'warriorTorso' + t.pelvis_model = 'warriorPelvis' + t.upper_arm_model = 'warriorUpperArm' + t.forearm_model = 'warriorForeArm' + t.hand_model = 'warriorHand' + t.upper_leg_model = 'warriorUpperLeg' + t.lower_leg_model = 'warriorLowerLeg' + t.toes_model = 'warriorToes' warrior_sounds = ['warrior1', 'warrior2', 'warrior3', 'warrior4'] warrior_hit_sounds = ['warriorHit1', 'warriorHit2'] t.attack_sounds = warrior_sounds t.jump_sounds = warrior_sounds t.impact_sounds = warrior_hit_sounds - t.death_sounds = ["warriorDeath"] + t.death_sounds = ['warriorDeath'] t.pickup_sounds = warrior_sounds - t.fall_sounds = ["warriorFall"] + t.fall_sounds = ['warriorFall'] t.style = 'spaz' # Superhero ################################### - t = Appearance("Middle-Man") - t.color_texture = "superheroColor" - t.color_mask_texture = "superheroColorMask" + t = Appearance('Middle-Man') + t.color_texture = 'superheroColor' + t.color_mask_texture = 'superheroColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "superheroIcon" - t.icon_mask_texture = "superheroIconColorMask" - t.head_model = "superheroHead" - t.torso_model = "superheroTorso" - t.pelvis_model = "superheroPelvis" - t.upper_arm_model = "superheroUpperArm" - t.forearm_model = "superheroForeArm" - t.hand_model = "superheroHand" - t.upper_leg_model = "superheroUpperLeg" - t.lower_leg_model = "superheroLowerLeg" - t.toes_model = "superheroToes" + t.icon_texture = 'superheroIcon' + t.icon_mask_texture = 'superheroIconColorMask' + t.head_model = 'superheroHead' + t.torso_model = 'superheroTorso' + t.pelvis_model = 'superheroPelvis' + t.upper_arm_model = 'superheroUpperArm' + t.forearm_model = 'superheroForeArm' + t.hand_model = 'superheroHand' + t.upper_leg_model = 'superheroUpperLeg' + t.lower_leg_model = 'superheroLowerLeg' + t.toes_model = 'superheroToes' superhero_sounds = ['superhero1', 'superhero2', 'superhero3', 'superhero4'] superhero_hit_sounds = ['superheroHit1', 'superheroHit2'] t.attack_sounds = superhero_sounds t.jump_sounds = superhero_sounds t.impact_sounds = superhero_hit_sounds - t.death_sounds = ["superheroDeath"] + t.death_sounds = ['superheroDeath'] t.pickup_sounds = superhero_sounds - t.fall_sounds = ["superheroFall"] + t.fall_sounds = ['superheroFall'] t.style = 'spaz' # Alien ################################### - t = Appearance("Alien") - t.color_texture = "alienColor" - t.color_mask_texture = "alienColorMask" + t = Appearance('Alien') + t.color_texture = 'alienColor' + t.color_mask_texture = 'alienColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "alienIcon" - t.icon_mask_texture = "alienIconColorMask" - t.head_model = "alienHead" - t.torso_model = "alienTorso" - t.pelvis_model = "alienPelvis" - t.upper_arm_model = "alienUpperArm" - t.forearm_model = "alienForeArm" - t.hand_model = "alienHand" - t.upper_leg_model = "alienUpperLeg" - t.lower_leg_model = "alienLowerLeg" - t.toes_model = "alienToes" + t.icon_texture = 'alienIcon' + t.icon_mask_texture = 'alienIconColorMask' + t.head_model = 'alienHead' + t.torso_model = 'alienTorso' + t.pelvis_model = 'alienPelvis' + t.upper_arm_model = 'alienUpperArm' + t.forearm_model = 'alienForeArm' + t.hand_model = 'alienHand' + t.upper_leg_model = 'alienUpperLeg' + t.lower_leg_model = 'alienLowerLeg' + t.toes_model = 'alienToes' alien_sounds = ['alien1', 'alien2', 'alien3', 'alien4'] alien_hit_sounds = ['alienHit1', 'alienHit2'] t.attack_sounds = alien_sounds t.jump_sounds = alien_sounds t.impact_sounds = alien_hit_sounds - t.death_sounds = ["alienDeath"] + t.death_sounds = ['alienDeath'] t.pickup_sounds = alien_sounds - t.fall_sounds = ["alienFall"] + t.fall_sounds = ['alienFall'] t.style = 'spaz' # OldLady ################################### - t = Appearance("OldLady") - t.color_texture = "oldLadyColor" - t.color_mask_texture = "oldLadyColorMask" + t = Appearance('OldLady') + t.color_texture = 'oldLadyColor' + t.color_mask_texture = 'oldLadyColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "oldLadyIcon" - t.icon_mask_texture = "oldLadyIconColorMask" - t.head_model = "oldLadyHead" - t.torso_model = "oldLadyTorso" - t.pelvis_model = "oldLadyPelvis" - t.upper_arm_model = "oldLadyUpperArm" - t.forearm_model = "oldLadyForeArm" - t.hand_model = "oldLadyHand" - t.upper_leg_model = "oldLadyUpperLeg" - t.lower_leg_model = "oldLadyLowerLeg" - t.toes_model = "oldLadyToes" + t.icon_texture = 'oldLadyIcon' + t.icon_mask_texture = 'oldLadyIconColorMask' + t.head_model = 'oldLadyHead' + t.torso_model = 'oldLadyTorso' + t.pelvis_model = 'oldLadyPelvis' + t.upper_arm_model = 'oldLadyUpperArm' + t.forearm_model = 'oldLadyForeArm' + t.hand_model = 'oldLadyHand' + t.upper_leg_model = 'oldLadyUpperLeg' + t.lower_leg_model = 'oldLadyLowerLeg' + t.toes_model = 'oldLadyToes' old_lady_sounds = ['oldLady1', 'oldLady2', 'oldLady3', 'oldLady4'] old_lady_hit_sounds = ['oldLadyHit1', 'oldLadyHit2'] t.attack_sounds = old_lady_sounds t.jump_sounds = old_lady_sounds t.impact_sounds = old_lady_hit_sounds - t.death_sounds = ["oldLadyDeath"] + t.death_sounds = ['oldLadyDeath'] t.pickup_sounds = old_lady_sounds - t.fall_sounds = ["oldLadyFall"] + t.fall_sounds = ['oldLadyFall'] t.style = 'spaz' # Gladiator ################################### - t = Appearance("Gladiator") - t.color_texture = "gladiatorColor" - t.color_mask_texture = "gladiatorColorMask" + t = Appearance('Gladiator') + t.color_texture = 'gladiatorColor' + t.color_mask_texture = 'gladiatorColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "gladiatorIcon" - t.icon_mask_texture = "gladiatorIconColorMask" - t.head_model = "gladiatorHead" - t.torso_model = "gladiatorTorso" - t.pelvis_model = "gladiatorPelvis" - t.upper_arm_model = "gladiatorUpperArm" - t.forearm_model = "gladiatorForeArm" - t.hand_model = "gladiatorHand" - t.upper_leg_model = "gladiatorUpperLeg" - t.lower_leg_model = "gladiatorLowerLeg" - t.toes_model = "gladiatorToes" + t.icon_texture = 'gladiatorIcon' + t.icon_mask_texture = 'gladiatorIconColorMask' + t.head_model = 'gladiatorHead' + t.torso_model = 'gladiatorTorso' + t.pelvis_model = 'gladiatorPelvis' + t.upper_arm_model = 'gladiatorUpperArm' + t.forearm_model = 'gladiatorForeArm' + t.hand_model = 'gladiatorHand' + t.upper_leg_model = 'gladiatorUpperLeg' + t.lower_leg_model = 'gladiatorLowerLeg' + t.toes_model = 'gladiatorToes' gladiator_sounds = ['gladiator1', 'gladiator2', 'gladiator3', 'gladiator4'] gladiator_hit_sounds = ['gladiatorHit1', 'gladiatorHit2'] t.attack_sounds = gladiator_sounds t.jump_sounds = gladiator_sounds t.impact_sounds = gladiator_hit_sounds - t.death_sounds = ["gladiatorDeath"] + t.death_sounds = ['gladiatorDeath'] t.pickup_sounds = gladiator_sounds - t.fall_sounds = ["gladiatorFall"] + t.fall_sounds = ['gladiatorFall'] t.style = 'spaz' # Wrestler ################################### - t = Appearance("Wrestler") - t.color_texture = "wrestlerColor" - t.color_mask_texture = "wrestlerColorMask" + t = Appearance('Wrestler') + t.color_texture = 'wrestlerColor' + t.color_mask_texture = 'wrestlerColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "wrestlerIcon" - t.icon_mask_texture = "wrestlerIconColorMask" - t.head_model = "wrestlerHead" - t.torso_model = "wrestlerTorso" - t.pelvis_model = "wrestlerPelvis" - t.upper_arm_model = "wrestlerUpperArm" - t.forearm_model = "wrestlerForeArm" - t.hand_model = "wrestlerHand" - t.upper_leg_model = "wrestlerUpperLeg" - t.lower_leg_model = "wrestlerLowerLeg" - t.toes_model = "wrestlerToes" + t.icon_texture = 'wrestlerIcon' + t.icon_mask_texture = 'wrestlerIconColorMask' + t.head_model = 'wrestlerHead' + t.torso_model = 'wrestlerTorso' + t.pelvis_model = 'wrestlerPelvis' + t.upper_arm_model = 'wrestlerUpperArm' + t.forearm_model = 'wrestlerForeArm' + t.hand_model = 'wrestlerHand' + t.upper_leg_model = 'wrestlerUpperLeg' + t.lower_leg_model = 'wrestlerLowerLeg' + t.toes_model = 'wrestlerToes' wrestler_sounds = ['wrestler1', 'wrestler2', 'wrestler3', 'wrestler4'] wrestler_hit_sounds = ['wrestlerHit1', 'wrestlerHit2'] t.attack_sounds = wrestler_sounds t.jump_sounds = wrestler_sounds t.impact_sounds = wrestler_hit_sounds - t.death_sounds = ["wrestlerDeath"] + t.death_sounds = ['wrestlerDeath'] t.pickup_sounds = wrestler_sounds - t.fall_sounds = ["wrestlerFall"] + t.fall_sounds = ['wrestlerFall'] t.style = 'spaz' # OperaSinger ################################### - t = Appearance("Gretel") - t.color_texture = "operaSingerColor" - t.color_mask_texture = "operaSingerColorMask" + t = Appearance('Gretel') + t.color_texture = 'operaSingerColor' + t.color_mask_texture = 'operaSingerColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "operaSingerIcon" - t.icon_mask_texture = "operaSingerIconColorMask" - t.head_model = "operaSingerHead" - t.torso_model = "operaSingerTorso" - t.pelvis_model = "operaSingerPelvis" - t.upper_arm_model = "operaSingerUpperArm" - t.forearm_model = "operaSingerForeArm" - t.hand_model = "operaSingerHand" - t.upper_leg_model = "operaSingerUpperLeg" - t.lower_leg_model = "operaSingerLowerLeg" - t.toes_model = "operaSingerToes" + t.icon_texture = 'operaSingerIcon' + t.icon_mask_texture = 'operaSingerIconColorMask' + t.head_model = 'operaSingerHead' + t.torso_model = 'operaSingerTorso' + t.pelvis_model = 'operaSingerPelvis' + t.upper_arm_model = 'operaSingerUpperArm' + t.forearm_model = 'operaSingerForeArm' + t.hand_model = 'operaSingerHand' + t.upper_leg_model = 'operaSingerUpperLeg' + t.lower_leg_model = 'operaSingerLowerLeg' + t.toes_model = 'operaSingerToes' opera_singer_sounds = [ 'operaSinger1', 'operaSinger2', 'operaSinger3', 'operaSinger4' ] @@ -880,88 +880,88 @@ def register_appearances() -> None: t.attack_sounds = opera_singer_sounds t.jump_sounds = opera_singer_sounds t.impact_sounds = opera_singer_hit_sounds - t.death_sounds = ["operaSingerDeath"] + t.death_sounds = ['operaSingerDeath'] t.pickup_sounds = opera_singer_sounds - t.fall_sounds = ["operaSingerFall"] + t.fall_sounds = ['operaSingerFall'] t.style = 'spaz' # Pixie ################################### - t = Appearance("Pixel") - t.color_texture = "pixieColor" - t.color_mask_texture = "pixieColorMask" + t = Appearance('Pixel') + t.color_texture = 'pixieColor' + t.color_mask_texture = 'pixieColorMask' t.default_color = (0, 1, 0.7) t.default_highlight = (0.65, 0.35, 0.75) - t.icon_texture = "pixieIcon" - t.icon_mask_texture = "pixieIconColorMask" - t.head_model = "pixieHead" - t.torso_model = "pixieTorso" - t.pelvis_model = "pixiePelvis" - t.upper_arm_model = "pixieUpperArm" - t.forearm_model = "pixieForeArm" - t.hand_model = "pixieHand" - t.upper_leg_model = "pixieUpperLeg" - t.lower_leg_model = "pixieLowerLeg" - t.toes_model = "pixieToes" + t.icon_texture = 'pixieIcon' + t.icon_mask_texture = 'pixieIconColorMask' + t.head_model = 'pixieHead' + t.torso_model = 'pixieTorso' + t.pelvis_model = 'pixiePelvis' + t.upper_arm_model = 'pixieUpperArm' + t.forearm_model = 'pixieForeArm' + t.hand_model = 'pixieHand' + t.upper_leg_model = 'pixieUpperLeg' + t.lower_leg_model = 'pixieLowerLeg' + t.toes_model = 'pixieToes' pixie_sounds = ['pixie1', 'pixie2', 'pixie3', 'pixie4'] pixie_hit_sounds = ['pixieHit1', 'pixieHit2'] t.attack_sounds = pixie_sounds t.jump_sounds = pixie_sounds t.impact_sounds = pixie_hit_sounds - t.death_sounds = ["pixieDeath"] + t.death_sounds = ['pixieDeath'] t.pickup_sounds = pixie_sounds - t.fall_sounds = ["pixieFall"] + t.fall_sounds = ['pixieFall'] t.style = 'pixie' # Robot ################################### - t = Appearance("Robot") - t.color_texture = "robotColor" - t.color_mask_texture = "robotColorMask" + t = Appearance('Robot') + t.color_texture = 'robotColor' + t.color_mask_texture = 'robotColorMask' t.default_color = (0.3, 0.5, 0.8) t.default_highlight = (1, 0, 0) - t.icon_texture = "robotIcon" - t.icon_mask_texture = "robotIconColorMask" - t.head_model = "robotHead" - t.torso_model = "robotTorso" - t.pelvis_model = "robotPelvis" - t.upper_arm_model = "robotUpperArm" - t.forearm_model = "robotForeArm" - t.hand_model = "robotHand" - t.upper_leg_model = "robotUpperLeg" - t.lower_leg_model = "robotLowerLeg" - t.toes_model = "robotToes" + t.icon_texture = 'robotIcon' + t.icon_mask_texture = 'robotIconColorMask' + t.head_model = 'robotHead' + t.torso_model = 'robotTorso' + t.pelvis_model = 'robotPelvis' + t.upper_arm_model = 'robotUpperArm' + t.forearm_model = 'robotForeArm' + t.hand_model = 'robotHand' + t.upper_leg_model = 'robotUpperLeg' + t.lower_leg_model = 'robotLowerLeg' + t.toes_model = 'robotToes' robot_sounds = ['robot1', 'robot2', 'robot3', 'robot4'] robot_hit_sounds = ['robotHit1', 'robotHit2'] t.attack_sounds = robot_sounds t.jump_sounds = robot_sounds t.impact_sounds = robot_hit_sounds - t.death_sounds = ["robotDeath"] + t.death_sounds = ['robotDeath'] t.pickup_sounds = robot_sounds - t.fall_sounds = ["robotFall"] + t.fall_sounds = ['robotFall'] t.style = 'spaz' # Bunny ################################### - t = Appearance("Easter Bunny") - t.color_texture = "bunnyColor" - t.color_mask_texture = "bunnyColorMask" + t = Appearance('Easter Bunny') + t.color_texture = 'bunnyColor' + t.color_mask_texture = 'bunnyColorMask' t.default_color = (1, 1, 1) t.default_highlight = (1, 0.5, 0.5) - t.icon_texture = "bunnyIcon" - t.icon_mask_texture = "bunnyIconColorMask" - t.head_model = "bunnyHead" - t.torso_model = "bunnyTorso" - t.pelvis_model = "bunnyPelvis" - t.upper_arm_model = "bunnyUpperArm" - t.forearm_model = "bunnyForeArm" - t.hand_model = "bunnyHand" - t.upper_leg_model = "bunnyUpperLeg" - t.lower_leg_model = "bunnyLowerLeg" - t.toes_model = "bunnyToes" + t.icon_texture = 'bunnyIcon' + t.icon_mask_texture = 'bunnyIconColorMask' + t.head_model = 'bunnyHead' + t.torso_model = 'bunnyTorso' + t.pelvis_model = 'bunnyPelvis' + t.upper_arm_model = 'bunnyUpperArm' + t.forearm_model = 'bunnyForeArm' + t.hand_model = 'bunnyHand' + t.upper_leg_model = 'bunnyUpperLeg' + t.lower_leg_model = 'bunnyLowerLeg' + t.toes_model = 'bunnyToes' bunny_sounds = ['bunny1', 'bunny2', 'bunny3', 'bunny4'] bunny_hit_sounds = ['bunnyHit1', 'bunnyHit2'] t.attack_sounds = bunny_sounds t.jump_sounds = ['bunnyJump'] t.impact_sounds = bunny_hit_sounds - t.death_sounds = ["bunnyDeath"] + t.death_sounds = ['bunnyDeath'] t.pickup_sounds = bunny_sounds - t.fall_sounds = ["bunnyFall"] + t.fall_sounds = ['bunnyFall'] t.style = 'bunny' diff --git a/assets/src/ba_data/python/bastd/actor/spazbot.py b/assets/src/ba_data/python/bastd/actor/spazbot.py index a5cc2e61..1b5e4b8c 100644 --- a/assets/src/ba_data/python/bastd/actor/spazbot.py +++ b/assets/src/ba_data/python/bastd/actor/spazbot.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/actor/text.py b/assets/src/ba_data/python/bastd/actor/text.py index 968547fc..0afccf5b 100644 --- a/assets/src/ba_data/python/bastd/actor/text.py +++ b/assets/src/ba_data/python/bastd/actor/text.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/actor/tipstext.py b/assets/src/ba_data/python/bastd/actor/tipstext.py index 5b98f39e..3bd77347 100644 --- a/assets/src/ba_data/python/bastd/actor/tipstext.py +++ b/assets/src/ba_data/python/bastd/actor/tipstext.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/actor/zoomtext.py b/assets/src/ba_data/python/bastd/actor/zoomtext.py index f2fedf3a..cade5ca0 100644 --- a/assets/src/ba_data/python/bastd/actor/zoomtext.py +++ b/assets/src/ba_data/python/bastd/actor/zoomtext.py @@ -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), diff --git a/assets/src/ba_data/python/bastd/game/assault.py b/assets/src/ba_data/python/bastd/game/assault.py index 110417e3..fd60dc01 100644 --- a/assets/src/ba_data/python/bastd/game/assault.py +++ b/assets/src/ba_data/python/bastd/game/assault.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/game/capturetheflag.py b/assets/src/ba_data/python/bastd/game/capturetheflag.py index 1688c7b8..68fe9b87 100644 --- a/assets/src/ba_data/python/bastd/game/capturetheflag.py +++ b/assets/src/ba_data/python/bastd/game/capturetheflag.py @@ -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()) diff --git a/assets/src/ba_data/python/bastd/game/chosenone.py b/assets/src/ba_data/python/bastd/game/chosenone.py index 07e81941..32a5613b 100644 --- a/assets/src/ba_data/python/bastd/game/chosenone.py +++ b/assets/src/ba_data/python/bastd/game/chosenone.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/game/conquest.py b/assets/src/ba_data/python/bastd/game/conquest.py index 79b86368..33b5eaed 100644 --- a/assets/src/ba_data/python/bastd/game/conquest.py +++ b/assets/src/ba_data/python/bastd/game/conquest.py @@ -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() diff --git a/assets/src/ba_data/python/bastd/game/deathmatch.py b/assets/src/ba_data/python/bastd/game/deathmatch.py index d1c677c4..a37e21ee 100644 --- a/assets/src/ba_data/python/bastd/game/deathmatch.py +++ b/assets/src/ba_data/python/bastd/game/deathmatch.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/game/easteregghunt.py b/assets/src/ba_data/python/bastd/game/easteregghunt.py index 7407dec3..514e8f10 100644 --- a/assets/src/ba_data/python/bastd/game/easteregghunt.py +++ b/assets/src/ba_data/python/bastd/game/easteregghunt.py @@ -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], diff --git a/assets/src/ba_data/python/bastd/game/elimination.py b/assets/src/ba_data/python/bastd/game/elimination.py index e04382dc..d31243c1 100644 --- a/assets/src/ba_data/python/bastd/game/elimination.py +++ b/assets/src/ba_data/python/bastd/game/elimination.py @@ -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') })) diff --git a/assets/src/ba_data/python/bastd/game/football.py b/assets/src/ba_data/python/bastd/game/football.py index bf47b161..3a2cea69 100644 --- a/assets/src/ba_data/python/bastd/game/football.py +++ b/assets/src/ba_data/python/bastd/game/football.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/game/hockey.py b/assets/src/ba_data/python/bastd/game/hockey.py index 3af62b0f..9aaca842 100644 --- a/assets/src/ba_data/python/bastd/game/hockey.py +++ b/assets/src/ba_data/python/bastd/game/hockey.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/game/keepaway.py b/assets/src/ba_data/python/bastd/game/keepaway.py index 56bd5f73..c7dc0085 100644 --- a/assets/src/ba_data/python/bastd/game/keepaway.py +++ b/assets/src/ba_data/python/bastd/game/keepaway.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/game/kingofthehill.py b/assets/src/ba_data/python/bastd/game/kingofthehill.py index 76b0e7b8..63331254 100644 --- a/assets/src/ba_data/python/bastd/game/kingofthehill.py +++ b/assets/src/ba_data/python/bastd/game/kingofthehill.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/game/meteorshower.py b/assets/src/ba_data/python/bastd/game/meteorshower.py index 9ec11f81..94f8609f 100644 --- a/assets/src/ba_data/python/bastd/game/meteorshower.py +++ b/assets/src/ba_data/python/bastd/game/meteorshower.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/game/ninjafight.py b/assets/src/ba_data/python/bastd/game/ninjafight.py index d80bf190..5f19131a 100644 --- a/assets/src/ba_data/python/bastd/game/ninjafight.py +++ b/assets/src/ba_data/python/bastd/game/ninjafight.py @@ -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() diff --git a/assets/src/ba_data/python/bastd/game/onslaught.py b/assets/src/ba_data/python/bastd/game/onslaught.py index 959c603e..50648987 100644 --- a/assets/src/ba_data/python/bastd/game/onslaught.py +++ b/assets/src/ba_data/python/bastd/game/onslaught.py @@ -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() diff --git a/assets/src/ba_data/python/bastd/game/race.py b/assets/src/ba_data/python/bastd/game/race.py index 0f755a93..ce5dc1b1 100644 --- a/assets/src/ba_data/python/bastd/game/race.py +++ b/assets/src/ba_data/python/bastd/game/race.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/game/runaround.py b/assets/src/ba_data/python/bastd/game/runaround.py index 7cb58478..62adc3e0 100644 --- a/assets/src/ba_data/python/bastd/game/runaround.py +++ b/assets/src/ba_data/python/bastd/game/runaround.py @@ -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(): diff --git a/assets/src/ba_data/python/bastd/game/targetpractice.py b/assets/src/ba_data/python/bastd/game/targetpractice.py index 348f555d..aff5f755 100644 --- a/assets/src/ba_data/python/bastd/game/targetpractice.py +++ b/assets/src/ba_data/python/bastd/game/targetpractice.py @@ -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. diff --git a/assets/src/ba_data/python/bastd/game/thelaststand.py b/assets/src/ba_data/python/bastd/game/thelaststand.py index 3b8c1fd4..0bb069c3 100644 --- a/assets/src/ba_data/python/bastd/game/thelaststand.py +++ b/assets/src/ba_data/python/bastd/game/thelaststand.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/mainmenu.py b/assets/src/ba_data/python/bastd/mainmenu.py index 5e1ea7c2..ff81f237 100644 --- a/assets/src/ba_data/python/bastd/mainmenu.py +++ b/assets/src/ba_data/python/bastd/mainmenu.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/maps.py b/assets/src/ba_data/python/bastd/maps.py index f55fbee2..aa467779 100644 --- a/assets/src/ba_data/python/bastd/maps.py +++ b/assets/src/ba_data/python/bastd/maps.py @@ -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', diff --git a/assets/src/ba_data/python/bastd/tutorial.py b/assets/src/ba_data/python/bastd/tutorial.py index 8523cb95..7d29dde8 100644 --- a/assets/src/ba_data/python/bastd/tutorial.py +++ b/assets/src/ba_data/python/bastd/tutorial.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/ui/account/link.py b/assets/src/ba_data/python/bastd/ui/account/link.py index ba3cef22..f25a3509 100644 --- a/assets/src/ba_data/python/bastd/ui/account/link.py +++ b/assets/src/ba_data/python/bastd/ui/account/link.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/ui/account/settings.py b/assets/src/ba_data/python/bastd/ui/account/settings.py index a8ed1588..3bbd23f9 100644 --- a/assets/src/ba_data/python/bastd/ui/account/settings.py +++ b/assets/src/ba_data/python/bastd/ui/account/settings.py @@ -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__) diff --git a/assets/src/ba_data/python/bastd/ui/account/viewer.py b/assets/src/ba_data/python/bastd/ui/account/viewer.py index f614a79c..5aaa952c 100644 --- a/assets/src/ba_data/python/bastd/ui/account/viewer.py +++ b/assets/src/ba_data/python/bastd/ui/account/viewer.py @@ -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), diff --git a/assets/src/ba_data/python/bastd/ui/appinvite.py b/assets/src/ba_data/python/bastd/ui/appinvite.py index f11475be..a043192f 100644 --- a/assets/src/ba_data/python/bastd/ui/appinvite.py +++ b/assets/src/ba_data/python/bastd/ui/appinvite.py @@ -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=[ diff --git a/assets/src/ba_data/python/bastd/ui/colorpicker.py b/assets/src/ba_data/python/bastd/ui/colorpicker.py index cd808fe6..53856e28 100644 --- a/assets/src/ba_data/python/bastd/ui/colorpicker.py +++ b/assets/src/ba_data/python/bastd/ui/colorpicker.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/ui/configerror.py b/assets/src/ba_data/python/bastd/ui/configerror.py index 00c7b5b8..3d6bfc64 100644 --- a/assets/src/ba_data/python/bastd/ui/configerror.py +++ b/assets/src/ba_data/python/bastd/ui/configerror.py @@ -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. diff --git a/assets/src/ba_data/python/bastd/ui/confirm.py b/assets/src/ba_data/python/bastd/ui/confirm.py index 567ed9a3..9693b287 100644 --- a/assets/src/ba_data/python/bastd/ui/confirm.py +++ b/assets/src/ba_data/python/bastd/ui/confirm.py @@ -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, diff --git a/assets/src/ba_data/python/bastd/ui/coop/browser.py b/assets/src/ba_data/python/bastd/ui/coop/browser.py index 6d051cfd..bc5b7d7a 100644 --- a/assets/src/ba_data/python/bastd/ui/coop/browser.py +++ b/assets/src/ba_data/python/bastd/ui/coop/browser.py @@ -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 } diff --git a/assets/src/ba_data/python/bastd/ui/coop/level.py b/assets/src/ba_data/python/bastd/ui/coop/level.py index df76226c..8a8d60d6 100644 --- a/assets/src/ba_data/python/bastd/ui/coop/level.py +++ b/assets/src/ba_data/python/bastd/ui/coop/level.py @@ -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)]), diff --git a/assets/src/ba_data/python/bastd/ui/creditslist.py b/assets/src/ba_data/python/bastd/ui/creditslist.py index 54713ab1..a69aa613 100644 --- a/assets/src/ba_data/python/bastd/ui/creditslist.py +++ b/assets/src/ba_data/python/bastd/ui/creditslist.py @@ -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), diff --git a/assets/src/ba_data/python/bastd/ui/debug.py b/assets/src/ba_data/python/bastd/ui/debug.py index f60ef67c..50b8c670 100644 --- a/assets/src/ba_data/python/bastd/ui/debug.py +++ b/assets/src/ba_data/python/bastd/ui/debug.py @@ -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), diff --git a/assets/src/ba_data/python/bastd/ui/feedback.py b/assets/src/ba_data/python/bastd/ui/feedback.py index 3aa106bd..b762abd0 100644 --- a/assets/src/ba_data/python/bastd/ui/feedback.py +++ b/assets/src/ba_data/python/bastd/ui/feedback.py @@ -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': diff --git a/assets/src/ba_data/python/bastd/ui/fileselector.py b/assets/src/ba_data/python/bastd/ui/fileselector.py index ab6b06f7..27c34818 100644 --- a/assets/src/ba_data/python/bastd/ui/fileselector.py +++ b/assets/src/ba_data/python/bastd/ui/fileselector.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/ui/gather.py b/assets/src/ba_data/python/bastd/ui/gather.py index 68c6ccbc..1e91325c 100644 --- a/assets/src/ba_data/python/bastd/ui/gather.py +++ b/assets/src/ba_data/python/bastd/ui/gather.py @@ -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, diff --git a/assets/src/ba_data/python/bastd/ui/getcurrency.py b/assets/src/ba_data/python/bastd/ui/getcurrency.py index 073ad598..b25457cb 100644 --- a/assets/src/ba_data/python/bastd/ui/getcurrency.py +++ b/assets/src/ba_data/python/bastd/ui/getcurrency.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/ui/helpui.py b/assets/src/ba_data/python/bastd/ui/helpui.py index 10464216..f9ecfb37 100644 --- a/assets/src/ba_data/python/bastd/ui/helpui.py +++ b/assets/src/ba_data/python/bastd/ui/helpui.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/ui/league/rankbutton.py b/assets/src/ba_data/python/bastd/ui/league/rankbutton.py index 7d964274..a1aecb5a 100644 --- a/assets/src/ba_data/python/bastd/ui/league/rankbutton.py +++ b/assets/src/ba_data/python/bastd/ui/league/rankbutton.py @@ -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] + diff --git a/assets/src/ba_data/python/bastd/ui/league/rankwindow.py b/assets/src/ba_data/python/bastd/ui/league/rankwindow.py index 3e88d5ed..066adfc7 100644 --- a/assets/src/ba_data/python/bastd/ui/league/rankwindow.py +++ b/assets/src/ba_data/python/bastd/ui/league/rankwindow.py @@ -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', diff --git a/assets/src/ba_data/python/bastd/ui/mainmenu.py b/assets/src/ba_data/python/bastd/ui/mainmenu.py index 9ee22c79..c3d9fd54 100644 --- a/assets/src/ba_data/python/bastd/ui/mainmenu.py +++ b/assets/src/ba_data/python/bastd/ui/mainmenu.py @@ -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 = [] diff --git a/assets/src/ba_data/python/bastd/ui/partyqueue.py b/assets/src/ba_data/python/bastd/ui/partyqueue.py index 19615265..582e9410 100644 --- a/assets/src/ba_data/python/bastd/ui/partyqueue.py +++ b/assets/src/ba_data/python/bastd/ui/partyqueue.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/ui/play.py b/assets/src/ba_data/python/bastd/ui/play.py index 294ed725..2ca24f32 100644 --- a/assets/src/ba_data/python/bastd/ui/play.py +++ b/assets/src/ba_data/python/bastd/ui/play.py @@ -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__) diff --git a/assets/src/ba_data/python/bastd/ui/playlist/addgame.py b/assets/src/ba_data/python/bastd/ui/playlist/addgame.py index 901710d6..f60827ad 100644 --- a/assets/src/ba_data/python/bastd/ui/playlist/addgame.py +++ b/assets/src/ba_data/python/bastd/ui/playlist/addgame.py @@ -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( diff --git a/assets/src/ba_data/python/bastd/ui/playlist/browser.py b/assets/src/ba_data/python/bastd/ui/playlist/browser.py index b9e025d3..b3138e4d 100644 --- a/assets/src/ba_data/python/bastd/ui/playlist/browser.py +++ b/assets/src/ba_data/python/bastd/ui/playlist/browser.py @@ -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__) diff --git a/assets/src/ba_data/python/bastd/ui/playlist/customizebrowser.py b/assets/src/ba_data/python/bastd/ui/playlist/customizebrowser.py index 512b83b2..dda12b80 100644 --- a/assets/src/ba_data/python/bastd/ui/playlist/customizebrowser.py +++ b/assets/src/ba_data/python/bastd/ui/playlist/customizebrowser.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/ui/playlist/edit.py b/assets/src/ba_data/python/bastd/ui/playlist/edit.py index c4d02381..1d5b123d 100644 --- a/assets/src/ba_data/python/bastd/ui/playlist/edit.py +++ b/assets/src/ba_data/python/bastd/ui/playlist/edit.py @@ -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), diff --git a/assets/src/ba_data/python/bastd/ui/playlist/editgame.py b/assets/src/ba_data/python/bastd/ui/playlist/editgame.py index f96369b6..60fc3aa0 100644 --- a/assets/src/ba_data/python/bastd/ui/playlist/editgame.py +++ b/assets/src/ba_data/python/bastd/ui/playlist/editgame.py @@ -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='', diff --git a/assets/src/ba_data/python/bastd/ui/playlist/mapselect.py b/assets/src/ba_data/python/bastd/ui/playlist/mapselect.py index dbce84f1..757f622f 100644 --- a/assets/src/ba_data/python/bastd/ui/playlist/mapselect.py +++ b/assets/src/ba_data/python/bastd/ui/playlist/mapselect.py @@ -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: diff --git a/assets/src/ba_data/python/bastd/ui/playlist/share.py b/assets/src/ba_data/python/bastd/ui/playlist/share.py index 49964d06..a6aa7721 100644 --- a/assets/src/ba_data/python/bastd/ui/playlist/share.py +++ b/assets/src/ba_data/python/bastd/ui/playlist/share.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/ui/playoptions.py b/assets/src/ba_data/python/bastd/ui/playoptions.py index 2c0ec134..f312e3fd 100644 --- a/assets/src/ba_data/python/bastd/ui/playoptions.py +++ b/assets/src/ba_data/python/bastd/ui/playoptions.py @@ -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) diff --git a/assets/src/ba_data/python/bastd/ui/popup.py b/assets/src/ba_data/python/bastd/ui/popup.py index 426cf6b1..92000b96 100644 --- a/assets/src/ba_data/python/bastd/ui/popup.py +++ b/assets/src/ba_data/python/bastd/ui/popup.py @@ -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 diff --git a/assets/src/ba_data/python/bastd/ui/profile/browser.py b/assets/src/ba_data/python/bastd/ui/profile/browser.py index 586d8ebd..81f81b1c 100644 --- a/assets/src/ba_data/python/bastd/ui/profile/browser.py +++ b/assets/src/ba_data/python/bastd/ui/profile/browser.py @@ -98,8 +98,8 @@ class ProfileBrowserWindow(ba.Window): maxwidth=300, color=ba.app.title_color, scale=0.9, - h_align="center", - v_align="center") + h_align='center', + v_align='center') if self._in_main_menu: ba.buttonwidget(edit=btn, @@ -160,8 +160,8 @@ class ProfileBrowserWindow(ba.Window): color=ba.app.infotextcolor, maxwidth=self._width * 0.83, scale=0.6, - h_align="center", - v_align="center") + h_align='center', + v_align='center') self._scrollwidget = ba.scrollwidget(parent=self._root_widget, highlight=False, diff --git a/assets/src/ba_data/python/bastd/ui/profile/edit.py b/assets/src/ba_data/python/bastd/ui/profile/edit.py index f418cd07..7d7a6e45 100644 --- a/assets/src/ba_data/python/bastd/ui/profile/edit.py +++ b/assets/src/ba_data/python/bastd/ui/profile/edit.py @@ -103,8 +103,8 @@ class EditProfileWindow(ba.Window): color=ba.app.title_color, maxwidth=290, scale=1.0, - h_align="center", - v_align="center") + h_align='center', + v_align='center') # Make a list of spaz icons. self.refresh_characters() @@ -546,7 +546,7 @@ class EditProfileWindow(ba.Window): elif picker_type == 'highlight': initial_color = self._highlight else: - raise Exception("invalid picker_type: " + picker_type) + raise Exception('invalid picker_type: ' + picker_type) colorpicker.ColorPicker( parent=self._root_widget, position=origin, diff --git a/assets/src/ba_data/python/bastd/ui/profile/upgrade.py b/assets/src/ba_data/python/bastd/ui/profile/upgrade.py index e66aa5bc..50ca401e 100644 --- a/assets/src/ba_data/python/bastd/ui/profile/upgrade.py +++ b/assets/src/ba_data/python/bastd/ui/profile/upgrade.py @@ -86,8 +86,8 @@ class ProfileUpgradeWindow(ba.Window): color=ba.app.title_color, maxwidth=self._width * 0.45, scale=1.0, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.textwidget(parent=self._root_widget, position=(self._width * 0.5, self._height - 100), @@ -97,8 +97,8 @@ class ProfileUpgradeWindow(ba.Window): color=ba.app.infotextcolor, maxwidth=self._width * 0.8, scale=0.7, - h_align="center", - v_align="center") + h_align='center', + v_align='center') self._status_text = ba.textwidget( parent=self._root_widget, @@ -109,8 +109,8 @@ class ProfileUpgradeWindow(ba.Window): color=(0.8, 0.4, 0.0), maxwidth=self._width * 0.8, scale=0.65, - h_align="center", - v_align="center") + h_align='center', + v_align='center') self._price_text = ba.textwidget(parent=self._root_widget, position=(self._width * 0.5, @@ -120,8 +120,8 @@ class ProfileUpgradeWindow(ba.Window): color=(0.2, 1, 0.2), maxwidth=self._width * 0.8, scale=1.5, - h_align="center", - v_align="center") + h_align='center', + v_align='center') self._tickets_text: Optional[ba.Widget] if not ba.app.toolbars: @@ -133,8 +133,8 @@ class ProfileUpgradeWindow(ba.Window): color=(0.2, 1, 0.2), maxwidth=100, scale=0.5, - h_align="right", - v_align="center") + h_align='right', + v_align='center') else: self._tickets_text = None diff --git a/assets/src/ba_data/python/bastd/ui/promocode.py b/assets/src/ba_data/python/bastd/ui/promocode.py index 0993dd86..af4aa198 100644 --- a/assets/src/ba_data/python/bastd/ui/promocode.py +++ b/assets/src/ba_data/python/bastd/ui/promocode.py @@ -82,8 +82,8 @@ class PromoCodeWindow(ba.Window): position=(125, height - 121), size=(280, 46), text='', - h_align="left", - v_align="center", + h_align='left', + v_align='center', max_chars=64, color=(0.9, 0.9, 0.9, 1.0), description=ba.Lstr(resource=self._r + '.codeText'), diff --git a/assets/src/ba_data/python/bastd/ui/report.py b/assets/src/ba_data/python/bastd/ui/report.py index 12cdc07c..01652805 100644 --- a/assets/src/ba_data/python/bastd/ui/report.py +++ b/assets/src/ba_data/python/bastd/ui/report.py @@ -61,8 +61,8 @@ class ReportPlayerWindow(ba.Window): size=(0, 0), color=(1, 1, 1, 0.8), scale=1.2, - h_align="center", - v_align="center", + h_align='center', + v_align='center', text=ba.Lstr(resource='reportThisPlayerReasonText'), maxwidth=self._width * 0.85) ba.buttonwidget(parent=self._root_widget, diff --git a/assets/src/ba_data/python/bastd/ui/serverdialog.py b/assets/src/ba_data/python/bastd/ui/serverdialog.py index 42dd5107..f8fc48a0 100644 --- a/assets/src/ba_data/python/bastd/ui/serverdialog.py +++ b/assets/src/ba_data/python/bastd/ui/serverdialog.py @@ -57,8 +57,8 @@ class ServerDialogWindow(ba.Window): size=(0, 0), color=(1.0, 3.0, 1.0), scale=txt_scale, - h_align="center", - v_align="center", + h_align='center', + v_align='center', text=txt, maxwidth=self._width * 0.85, max_height=(self._height - 110)) diff --git a/assets/src/ba_data/python/bastd/ui/settings/advanced.py b/assets/src/ba_data/python/bastd/ui/settings/advanced.py index 54beb78d..61c6dd1e 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/advanced.py +++ b/assets/src/ba_data/python/bastd/ui/settings/advanced.py @@ -67,7 +67,7 @@ class AdvancedSettingsWindow(ba.Window): scale_origin_stack_offset=scale_origin, scale=2.06 if app.small_ui else 1.4 if app.med_ui else 1.0, stack_offset=(0, -25) if app.small_ui else (0, 0))) - self._prev_lang = "" + self._prev_lang = '' self._prev_lang_list: List[str] = [] self._complete_langs_list: Optional[List] = None self._complete_langs_error = False @@ -119,8 +119,8 @@ class AdvancedSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.titleText'), color=app.title_color, - h_align="center", - v_align="top") + h_align='center', + v_align='top') if self._back_button is not None: ba.buttonwidget(edit=self._back_button, @@ -352,7 +352,7 @@ class AdvancedSettingsWindow(ba.Window): parent=self._subcontainer, position=(50, v), size=(self._sub_width - 100, 30), - configkey="Kick Idle Players", + configkey='Kick Idle Players', displayname=ba.Lstr(resource=self._r + '.kickIdlePlayersText'), scale=1.0, maxwidth=430) @@ -364,7 +364,7 @@ class AdvancedSettingsWindow(ba.Window): parent=self._subcontainer, position=(50, v), size=(self._sub_width - 100, 30), - configkey="Always Use Internal Keyboard", + configkey='Always Use Internal Keyboard', autoselect=True, displayname=ba.Lstr(resource=self._r + '.alwaysUseInternalKeyboardText'), @@ -429,7 +429,7 @@ class AdvancedSettingsWindow(ba.Window): parent=self._subcontainer, position=(80, v), size=(self._sub_width - 100, 30), - configkey="Enable Package Mods", + configkey='Enable Package Mods', autoselect=True, value_change_call=ba.WeakCall(self._show_restart_needed), displayname=ba.Lstr(resource=self._r + '.enablePackageModsText'), @@ -596,11 +596,11 @@ class AdvancedSettingsWindow(ba.Window): elif sel == self._language_inform_checkbox: sel_name = 'LangInform' else: - raise Exception("unrecognized selection") + raise Exception('unrecognized selection') elif sel == self._back_button: sel_name = 'Back' else: - raise Exception("unrecognized selection") + raise Exception('unrecognized selection') ba.app.window_states[self.__class__.__name__] = { 'sel_name': sel_name } diff --git a/assets/src/ba_data/python/bastd/ui/settings/allsettings.py b/assets/src/ba_data/python/bastd/ui/settings/allsettings.py index 5f4ba8bd..df29572e 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/allsettings.py +++ b/assets/src/ba_data/python/bastd/ui/settings/allsettings.py @@ -86,8 +86,8 @@ class AllSettingsWindow(ba.Window): size=(width, 25), text=ba.Lstr(resource=self._r + '.titleText'), color=ba.app.title_color, - h_align="center", - v_align="center", + h_align='center', + v_align='center', maxwidth=130) if self._back_button is not None: @@ -252,7 +252,7 @@ class AllSettingsWindow(ba.Window): elif sel == self._back_button: sel_name = 'Back' else: - raise Exception("unrecognized selection") + raise Exception('unrecognized selection') ba.app.window_states[self.__class__.__name__] = { 'sel_name': sel_name } diff --git a/assets/src/ba_data/python/bastd/ui/settings/audio.py b/assets/src/ba_data/python/bastd/ui/settings/audio.py index 0a18c4dc..b5f2c424 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/audio.py +++ b/assets/src/ba_data/python/bastd/ui/settings/audio.py @@ -104,8 +104,8 @@ class AudioSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.titleText'), color=ba.app.title_color, maxwidth=180, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.buttonwidget(edit=self._back_button, button_type='backSmall', @@ -116,7 +116,7 @@ class AudioSettingsWindow(ba.Window): parent=self._root_widget, position=(40, v), xoffset=10, - configkey="Sound Volume", + configkey='Sound Volume', displayname=ba.Lstr(resource=self._r + '.soundVolumeText'), minval=0.0, maxval=1.0, @@ -129,7 +129,7 @@ class AudioSettingsWindow(ba.Window): parent=self._root_widget, position=(40, v), xoffset=10, - configkey="Music Volume", + configkey='Music Volume', displayname=ba.Lstr(resource=self._r + '.musicVolumeText'), minval=0.0, maxval=1.0, @@ -149,8 +149,8 @@ class AudioSettingsWindow(ba.Window): '.headRelativeVRAudioText'), color=(0.8, 0.8, 0.8), maxwidth=230, - h_align="left", - v_align="center") + h_align='left', + v_align='center') popup = PopupMenu( parent=self._root_widget, @@ -176,8 +176,8 @@ class AudioSettingsWindow(ba.Window): color=(0.7, 0.8, 0.7), maxwidth=400, flatness=1.0, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= 30 else: self._vr_head_relative_audio_button = None @@ -266,7 +266,7 @@ class AudioSettingsWindow(ba.Window): elif sel == self._vr_head_relative_audio_button: sel_name = 'VRHeadRelative' 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__) diff --git a/assets/src/ba_data/python/bastd/ui/settings/controls.py b/assets/src/ba_data/python/bastd/ui/settings/controls.py index 0ac3c2c1..00e81723 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/controls.py +++ b/assets/src/ba_data/python/bastd/ui/settings/controls.py @@ -177,8 +177,8 @@ class ControlsSettingsWindow(ba.Window): size=(width, 25), text=ba.Lstr(resource=self._r + '.titleText'), color=ba.app.title_color, - h_align="center", - v_align="top") + h_align='center', + v_align='top') ba.buttonwidget(edit=btn, button_type='backSmall', size=(60, 60), diff --git a/assets/src/ba_data/python/bastd/ui/settings/gamepad.py b/assets/src/ba_data/python/bastd/ui/settings/gamepad.py index 45ac529b..046f9b12 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/gamepad.py +++ b/assets/src/ba_data/python/bastd/ui/settings/gamepad.py @@ -204,8 +204,8 @@ class GamepadSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.titleText'), color=ba.app.title_color, maxwidth=310, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= 48 ba.textwidget(parent=self._root_widget, @@ -214,8 +214,8 @@ class GamepadSettingsWindow(ba.Window): text=self._name, color=ba.app.infotextcolor, maxwidth=self._width * 0.9, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= self._spacing * 1 ba.textwidget(parent=self._root_widget, @@ -237,8 +237,8 @@ class GamepadSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.secondaryText'), color=ba.app.title_color, maxwidth=300, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= self._spacing * 1 ba.textwidget(parent=self._root_widget, @@ -478,7 +478,7 @@ class GamepadSettingsWindow(ba.Window): """(internal)""" assert self._settings is not None if not self._is_secondary: - raise Exception("enable value only applies to secondary editor") + raise Exception('enable value only applies to secondary editor') return self._settings.get('enableSecondary', False) def show_secondary_editor(self) -> None: @@ -793,8 +793,8 @@ class AwaitGamepadInputWindow(ba.Window): size=(width, 25), text=message, maxwidth=width * 0.9, - h_align="center", - v_align="center") + h_align='center', + v_align='center') if message2 is not None: ba.textwidget(parent=self._root_widget, position=(width * 0.5, height - 60), @@ -803,8 +803,8 @@ class AwaitGamepadInputWindow(ba.Window): maxwidth=width * 0.9, scale=0.47, color=(0.7, 1.0, 0.7, 0.6), - h_align="center", - v_align="center") + h_align='center', + v_align='center') self._counter = 5 self._count_down_text = ba.textwidget(parent=self._root_widget, h_align='center', diff --git a/assets/src/ba_data/python/bastd/ui/settings/gamepadadvanced.py b/assets/src/ba_data/python/bastd/ui/settings/gamepadadvanced.py index b3d67c15..cc8de99c 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/gamepadadvanced.py +++ b/assets/src/ba_data/python/bastd/ui/settings/gamepadadvanced.py @@ -61,8 +61,8 @@ class GamepadAdvancedSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.advancedTitleText'), maxwidth=320, color=ba.app.title_color, - h_align="center", - v_align="center") + h_align='center', + v_align='center') back_button = btn = ba.buttonwidget( parent=self._root_widget, @@ -435,8 +435,8 @@ class GamepadAdvancedSettingsWindow(ba.Window): size=(100, 30), text=displayname, color=(0.8, 0.8, 0.8, 1.0), - h_align="left", - v_align="center", + h_align='left', + v_align='center', scale=1.0, maxwidth=280) self._textwidgets[control] = ba.textwidget( @@ -445,15 +445,15 @@ class GamepadAdvancedSettingsWindow(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=self._parent_window.get_control_value_name(control), padding=2) btn = ba.buttonwidget(parent=self._subcontainer, autoselect=True, position=(330 + x_offset, position[1] + 4), size=(28, 28), - label="-", + label='-', on_activate_call=ba.Call(self._inc, control, min_val, max_val, -increment), @@ -463,7 +463,7 @@ class GamepadAdvancedSettingsWindow(ba.Window): autoselect=True, position=(380 + x_offset, position[1] + 4), size=(28, 28), - label="+", + label='+', on_activate_call=ba.Call( self._inc, control, min_val, max_val, increment), diff --git a/assets/src/ba_data/python/bastd/ui/settings/gamepadselect.py b/assets/src/ba_data/python/bastd/ui/settings/gamepadselect.py index 4c1b4fa1..daccdabf 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/gamepadselect.py +++ b/assets/src/ba_data/python/bastd/ui/settings/gamepadselect.py @@ -43,7 +43,7 @@ def gamepad_configure_callback(event: Dict[str, Any]) -> None: try: ba.containerwidget(edit=ba.app.main_menu_window, transition='out_left') except Exception: - ba.print_exception("Error transitioning out main_menu_window.") + ba.print_exception('Error transitioning out main_menu_window.') ba.playsound(ba.getsound('activateBeep')) ba.playsound(ba.getsound('swish')) inputdevice = event['input_device'] @@ -71,8 +71,8 @@ def gamepad_configure_callback(event: Dict[str, Any]) -> None: size=(width, 25), text=msg, scale=0.8, - h_align="center", - v_align="top") + h_align='center', + v_align='top') def _ok() -> None: from bastd.ui.settings import controls @@ -120,8 +120,8 @@ class GamepadSelectWindow(ba.Window): text=ba.Lstr(resource=self._r + '.titleText'), maxwidth=250, color=ba.app.title_color, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.buttonwidget(edit=btn, button_type='backSmall', @@ -137,8 +137,8 @@ class GamepadSelectWindow(ba.Window): text=ba.Lstr(resource=self._r + '.pressAnyButtonText'), maxwidth=width * 0.95, color=ba.app.infotextcolor, - h_align="center", - v_align="top") + h_align='center', + v_align='top') v -= spacing * 1.24 if ba.app.platform == 'android': ba.textwidget(parent=self._root_widget, @@ -148,8 +148,8 @@ class GamepadSelectWindow(ba.Window): text=ba.Lstr(resource=self._r + '.androidNoteText'), maxwidth=width * 0.95, color=(0.7, 0.9, 0.7, 0.5), - h_align="center", - v_align="top") + h_align='center', + v_align='top') _ba.capture_gamepad_input(gamepad_configure_callback) diff --git a/assets/src/ba_data/python/bastd/ui/settings/graphics.py b/assets/src/ba_data/python/bastd/ui/settings/graphics.py index 0fda19b6..6fe5477e 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/graphics.py +++ b/assets/src/ba_data/python/bastd/ui/settings/graphics.py @@ -112,8 +112,8 @@ class GraphicsSettingsWindow(ba.Window): size=(width, 25), text=ba.Lstr(resource=self._r + '.titleText'), color=ba.app.title_color, - h_align="center", - v_align="top") + h_align='center', + v_align='top') ba.buttonwidget(edit=btn, button_type='backSmall', @@ -128,7 +128,7 @@ class GraphicsSettingsWindow(ba.Window): position=(100, v), maxwidth=200, size=(300, 30), - configkey="Fullscreen", + configkey='Fullscreen', displayname=ba.Lstr(resource=self._r + ('.fullScreenCmdText' if app.platform == 'mac' else '.fullScreenCtrlText'))).widget @@ -145,7 +145,7 @@ class GraphicsSettingsWindow(ba.Window): self._gamma_controls = gmc = ConfigNumberEdit( parent=self._root_widget, position=(90, v), - configkey="Screen Gamma", + configkey='Screen Gamma', displayname=ba.Lstr(resource=self._r + '.gammaText'), minval=0.1, maxval=2.0, @@ -174,8 +174,8 @@ class GraphicsSettingsWindow(ba.Window): color=ba.app.heading_color, scale=0.65, maxwidth=150, - h_align="center", - v_align="center") + h_align='center', + v_align='center') popup.PopupMenu( parent=self._root_widget, position=(60, v - 50), @@ -202,8 +202,8 @@ class GraphicsSettingsWindow(ba.Window): color=ba.app.heading_color, scale=0.65, maxwidth=150, - h_align="center", - v_align="center") + h_align='center', + v_align='center') textures_popup = popup.PopupMenu( parent=self._root_widget, position=(230, v - 50), @@ -234,8 +234,8 @@ class GraphicsSettingsWindow(ba.Window): color=ba.app.heading_color, scale=0.65, maxwidth=150, - h_align="center", - v_align="center") + h_align='center', + v_align='center') # on standard android we have 'Auto', 'Native', and a few # HD standards @@ -308,8 +308,8 @@ class GraphicsSettingsWindow(ba.Window): color=ba.app.heading_color, scale=0.65, maxwidth=150, - h_align="center", - v_align="center") + h_align='center', + v_align='center') popup.PopupMenu( parent=self._root_widget, @@ -330,7 +330,7 @@ class GraphicsSettingsWindow(ba.Window): position=(69, v - 6), size=(210, 30), scale=0.86, - configkey="Show FPS", + configkey='Show FPS', displayname=ba.Lstr(resource=self._r + '.showFPSText'), maxwidth=130) @@ -341,7 +341,7 @@ class GraphicsSettingsWindow(ba.Window): position=(240, v - 6), size=(210, 30), scale=0.86, - configkey="TV Border", + configkey='TV Border', displayname=ba.Lstr(resource=self._r + '.tvBorderText'), maxwidth=130) diff --git a/assets/src/ba_data/python/bastd/ui/settings/keyboard.py b/assets/src/ba_data/python/bastd/ui/settings/keyboard.py index 98418d17..7ca300f1 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/keyboard.py +++ b/assets/src/ba_data/python/bastd/ui/settings/keyboard.py @@ -44,7 +44,7 @@ class ConfigKeyboardWindow(ba.Window): dname_raw += ' ' + self._unique_id.replace('#', 'P') self._displayname = ba.Lstr(translate=('inputDeviceNames', dname_raw)) self._width = 700 - if self._unique_id != "#1": + if self._unique_id != '#1': self._height = 450 else: self._height = 345 @@ -108,7 +108,7 @@ class ConfigKeyboardWindow(ba.Window): scale=0.83) v -= 20 - if self._unique_id != "#1": + if self._unique_id != '#1': v -= 20 v -= self._spacing ba.textwidget(parent=self._root_widget, @@ -120,8 +120,8 @@ class ConfigKeyboardWindow(ba.Window): maxwidth=self._width * 0.75, max_height=110, color=ba.app.infotextcolor, - h_align="center", - v_align="top") + h_align='center', + v_align='top') v -= 45 v -= 10 v -= self._spacing * 2.2 @@ -151,7 +151,7 @@ class ConfigKeyboardWindow(ba.Window): texture=ba.gettexture('downButton'), scale=1.0) - if self._unique_id == "#2": + if self._unique_id == '#2': self._capture_button(pos=(self._width * 0.5, v + 0.1 * dist), color=(0.4, 0.4, 0.6), button='buttonStart', @@ -277,8 +277,8 @@ class AwaitKeyboardInputWindow(ba.Window): position=(0, height - 60), size=(width, 25), text=ba.Lstr(resource='pressAnyKeyText'), - h_align="center", - v_align="top") + h_align='center', + v_align='top') self._counter = 5 self._count_down_text = ba.textwidget(parent=self._root_widget, @@ -304,9 +304,9 @@ class AwaitKeyboardInputWindow(ba.Window): ba.containerwidget(edit=self._root_widget, transition='out_left') def _button_callback(self, event: Dict[str, Any]) -> None: - self._settings[self._capture_button] = event["button"] + self._settings[self._capture_button] = event['button'] if event['type'] == 'BUTTONDOWN': - bname = event['input_device'].get_button_name(event["button"]) + bname = event['input_device'].get_button_name(event['button']) ba.textwidget(edit=self._capture_key_ui, text=bname) ba.playsound(ba.getsound('gunCocking')) self._die() diff --git a/assets/src/ba_data/python/bastd/ui/settings/ps3controller.py b/assets/src/ba_data/python/bastd/ui/settings/ps3controller.py index ca813f57..cc28369d 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/ps3controller.py +++ b/assets/src/ba_data/python/bastd/ui/settings/ps3controller.py @@ -57,8 +57,8 @@ class PS3ControllerSettingsWindow(ba.Window): subs=[('${APP_NAME}', ba.Lstr(resource='titleText'))]), color=ba.app.title_color, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.buttonwidget(edit=btn, button_type='backSmall', @@ -78,8 +78,8 @@ class PS3ControllerSettingsWindow(ba.Window): scale=1.0, text=ba.Lstr(resource=self._r + '.ouyaInstructionsText'), - h_align="center", - v_align="center") + h_align='center', + v_align='center') else: txts = ba.Lstr(resource=self._r + '.macInstructionsText').evaluate().split('\n\n\n') @@ -91,8 +91,8 @@ class PS3ControllerSettingsWindow(ba.Window): max_height=170, scale=1.0, text=txts[0].strip(), - h_align="center", - v_align="center") + h_align='center', + v_align='center') if txts: ba.textwidget(parent=self._root_widget, position=(width * 0.5, v - 280), @@ -102,8 +102,8 @@ class PS3ControllerSettingsWindow(ba.Window): max_height=170, scale=1.0, text=txts[1].strip(), - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.buttonwidget(parent=self._root_widget, position=(225, v - 176), diff --git a/assets/src/ba_data/python/bastd/ui/settings/remoteapp.py b/assets/src/ba_data/python/bastd/ui/settings/remoteapp.py index def0232b..0db78e6e 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/remoteapp.py +++ b/assets/src/ba_data/python/bastd/ui/settings/remoteapp.py @@ -57,8 +57,8 @@ class RemoteAppSettingsWindow(ba.Window): maxwidth=370, color=ba.app.title_color, scale=0.8, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.buttonwidget(edit=btn, button_type='backSmall', @@ -79,8 +79,8 @@ class RemoteAppSettingsWindow(ba.Window): ('${REMOTE_APP_NAME}', get_remote_app_name())]), max_height=100, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= 90 # hmm the itms:// version doesnt bounce through safari but is kinda @@ -95,8 +95,8 @@ class RemoteAppSettingsWindow(ba.Window): text='bombsquadgame.com/remote', maxwidth=width * 0.95, max_height=60, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= 30 ba.textwidget(parent=self._root_widget, @@ -107,8 +107,8 @@ class RemoteAppSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.bestResultsText'), maxwidth=width * 0.95, max_height=height * 0.19, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.checkboxwidget( parent=self._root_widget, diff --git a/assets/src/ba_data/python/bastd/ui/settings/touchscreen.py b/assets/src/ba_data/python/bastd/ui/settings/touchscreen.py index 2393f5de..7dbc3d80 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/touchscreen.py +++ b/assets/src/ba_data/python/bastd/ui/settings/touchscreen.py @@ -65,8 +65,8 @@ class TouchscreenSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.titleText'), color=ba.app.title_color, maxwidth=280, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.buttonwidget(edit=btn, button_type='backSmall', @@ -117,8 +117,8 @@ class TouchscreenSettingsWindow(ba.Window): color=(0, 0.9, 0.1, 0.7), maxwidth=self._sub_width * 0.9, scale=0.55, - h_align="center", - v_align="center") + h_align='center', + v_align='center') cur_val = ba.app.config.get('Touch Movement Control Type', 'swipe') ba.textwidget(parent=self._subcontainer, position=(h, v - 2), @@ -150,7 +150,7 @@ class TouchscreenSettingsWindow(ba.Window): parent=self._subcontainer, position=(h, v), xoffset=65, - configkey="Touch Controls Scale Movement", + configkey='Touch Controls Scale Movement', displayname=ba.Lstr(resource=self._r + '.movementControlScaleText'), changesound=False, @@ -187,7 +187,7 @@ class TouchscreenSettingsWindow(ba.Window): cfgui.ConfigNumberEdit(parent=self._subcontainer, position=(h, v), xoffset=65, - configkey="Touch Controls Scale Actions", + configkey='Touch Controls Scale Actions', displayname=ba.Lstr(resource=self._r + '.actionControlScaleText'), changesound=False, @@ -200,7 +200,7 @@ class TouchscreenSettingsWindow(ba.Window): position=(h, v), size=(400, 30), maxwidth=400, - configkey="Touch Controls Swipe Hidden", + configkey='Touch Controls Swipe Hidden', displayname=ba.Lstr(resource=self._r + '.swipeControlsHiddenText')) v -= 65 diff --git a/assets/src/ba_data/python/bastd/ui/settings/wiimote.py b/assets/src/ba_data/python/bastd/ui/settings/wiimote.py index ab731807..dfca0b33 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/wiimote.py +++ b/assets/src/ba_data/python/bastd/ui/settings/wiimote.py @@ -53,8 +53,8 @@ class WiimoteSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.titleText'), maxwidth=270, color=ba.app.title_color, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.buttonwidget(edit=btn, button_type='backSmall', @@ -71,8 +71,8 @@ class WiimoteSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.macInstructionsText'), maxwidth=width * 0.95, max_height=height * 0.5, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= 230 button_width = 200 v -= 30 @@ -91,8 +91,8 @@ class WiimoteSettingsWindow(ba.Window): scale=0.8, maxwidth=width * 0.95, text=ba.Lstr(resource=self._r + '.thanksText'), - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= 30 this_button_width = 200 ba.buttonwidget(parent=self._root_widget, @@ -138,8 +138,8 @@ class WiimoteListenWindow(ba.Window): text=ba.Lstr(resource=self._r + '.listeningText'), color=ba.app.title_color, maxwidth=320, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.textwidget(parent=self._root_widget, position=(15, height - 110), size=(width - 30, 30), @@ -147,8 +147,8 @@ class WiimoteListenWindow(ba.Window): text=ba.Lstr(resource=self._r + '.pressText'), maxwidth=width * 0.9, color=(0.7, 0.9, 0.7, 1.0), - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.textwidget(parent=self._root_widget, position=(15, height - 140), size=(width - 30, 30), @@ -156,15 +156,15 @@ class WiimoteListenWindow(ba.Window): scale=0.55, text=ba.Lstr(resource=self._r + '.pressText2'), maxwidth=width * 0.95, - h_align="center", - v_align="center") + h_align='center', + v_align='center') self._counter_text = ba.textwidget(parent=self._root_widget, position=(15, 23), size=(width - 30, 30), scale=1.2, - text="15", - h_align="center", - v_align="top") + text='15', + h_align='center', + v_align='top') for i in range(1, 15): ba.timer(1.0 * i, ba.WeakCall(self._decrement), @@ -203,9 +203,9 @@ class WiimoteLicenseWindow(ba.Window): position=(0, height - 48), 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') license_text = ( 'Copyright (c) 2007, DarwiinRemote Team\n' 'All rights reserved.\n' @@ -255,8 +255,8 @@ class WiimoteLicenseWindow(ba.Window): ba.textwidget(parent=self._root_widget, position=(100, height * 0.45), size=(0, 0), - h_align="left", - v_align="center", + h_align='left', + v_align='center', padding=4, color=(0.7, 0.9, 0.7, 1.0), scale=license_text_scale, diff --git a/assets/src/ba_data/python/bastd/ui/settings/xbox360controller.py b/assets/src/ba_data/python/bastd/ui/settings/xbox360controller.py index ce66d0bf..ac771431 100644 --- a/assets/src/ba_data/python/bastd/ui/settings/xbox360controller.py +++ b/assets/src/ba_data/python/bastd/ui/settings/xbox360controller.py @@ -63,8 +63,8 @@ class XBox360ControllerSettingsWindow(ba.Window): ba.Lstr(resource='titleText'))]), color=ba.app.title_color, maxwidth=400, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.buttonwidget(edit=btn, button_type='backSmall', @@ -84,8 +84,8 @@ class XBox360ControllerSettingsWindow(ba.Window): scale=0.7, text=ba.Lstr(resource=self._r + '.ouyaInstructionsText'), - h_align="center", - v_align="center") + h_align='center', + v_align='center') else: ba.textwidget(parent=self._root_widget, position=(width * 0.5, v - 1), @@ -96,8 +96,8 @@ class XBox360ControllerSettingsWindow(ba.Window): text=ba.Lstr(resource=self._r + '.macInstructionsText'), scale=0.7, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v -= 90 b_width = 300 btn = ba.buttonwidget( @@ -120,8 +120,8 @@ class XBox360ControllerSettingsWindow(ba.Window): scale=0.7, text=ba.Lstr(resource=self._r + '.macInstructions2Text'), - h_align="center", - v_align="center") + h_align='center', + v_align='center') def _back(self) -> None: from bastd.ui.settings import controls diff --git a/assets/src/ba_data/python/bastd/ui/soundtrack/browser.py b/assets/src/ba_data/python/bastd/ui/soundtrack/browser.py index 101bcaa7..044fd865 100644 --- a/assets/src/ba_data/python/bastd/ui/soundtrack/browser.py +++ b/assets/src/ba_data/python/bastd/ui/soundtrack/browser.py @@ -88,8 +88,8 @@ class SoundtrackBrowserWindow(ba.Window): maxwidth=300, text=ba.Lstr(resource=self._r + '.titleText'), color=ba.app.title_color, - h_align="center", - v_align="center") + h_align='center', + v_align='center') h = 43 + x_inset v = self._height - 60 @@ -261,7 +261,7 @@ class SoundtrackBrowserWindow(ba.Window): else: confirm.ConfirmWindow( ba.Lstr(resource=self._r + '.deleteConfirmText', - subs=[("${NAME}", self._selected_soundtrack)]), + subs=[('${NAME}', self._selected_soundtrack)]), self._do_delete_soundtrack, 450, 150) def _duplicate_soundtrack(self) -> None: @@ -485,7 +485,7 @@ class SoundtrackBrowserWindow(ba.Window): elif sel == self._back_button: sel_name = 'Back' else: - raise Exception("unrecognized selection") + raise Exception('unrecognized selection') ba.app.window_states[self.__class__.__name__] = sel_name except Exception: ba.print_exception('error saving state for', self.__class__) diff --git a/assets/src/ba_data/python/bastd/ui/soundtrack/edit.py b/assets/src/ba_data/python/bastd/ui/soundtrack/edit.py index 6440b2a9..cf0507ab 100644 --- a/assets/src/ba_data/python/bastd/ui/soundtrack/edit.py +++ b/assets/src/ba_data/python/bastd/ui/soundtrack/edit.py @@ -77,8 +77,8 @@ class SoundtrackEditWindow(ba.Window): ('.editSoundtrackText' if existing_soundtrack is not None else '.newSoundtrackText')), color=ba.app.title_color, - h_align="center", - v_align="center", + h_align='center', + v_align='center', maxwidth=280) v = self._height - 110 if 'Soundtracks' not in bs_config: @@ -138,8 +138,8 @@ class SoundtrackEditWindow(ba.Window): position=(120 + x_inset, v - 5), size=(self._width - (160 + 2 * x_inset), 43), text=self._soundtrack_name, - h_align="left", - v_align="center", + h_align='left', + v_align='center', max_chars=32, autoselect=True, description=ba.Lstr(resource=self._r + '.nameText'), @@ -334,7 +334,7 @@ class SoundtrackEditWindow(ba.Window): music = ba.app.music # Warn if volume is zero. - if ba.app.config.resolve("Music Volume") < 0.01: + if ba.app.config.resolve('Music Volume') < 0.01: ba.playsound(ba.getsound('error')) ba.screenmessage(ba.Lstr(resource=self._r + '.musicVolumeZeroWarning'), diff --git a/assets/src/ba_data/python/bastd/ui/soundtrack/entrytypeselect.py b/assets/src/ba_data/python/bastd/ui/soundtrack/entrytypeselect.py index cd0444ef..22304ea8 100644 --- a/assets/src/ba_data/python/bastd/ui/soundtrack/entrytypeselect.py +++ b/assets/src/ba_data/python/bastd/ui/soundtrack/entrytypeselect.py @@ -82,8 +82,8 @@ class SoundtrackEntryTypeSelectWindow(ba.Window): text=ba.Lstr(resource=self._r + '.selectASourceText'), color=ba.app.title_color, maxwidth=230, - h_align="center", - v_align="center") + h_align='center', + v_align='center') ba.textwidget(parent=self._root_widget, position=(self._width * 0.5, self._height - 56), @@ -92,8 +92,8 @@ class SoundtrackEntryTypeSelectWindow(ba.Window): color=ba.app.infotextcolor, scale=0.7, maxwidth=230, - h_align="center", - v_align="center") + h_align='center', + v_align='center') v = self._height - 155 diff --git a/assets/src/ba_data/python/bastd/ui/soundtrack/macmusicapp.py b/assets/src/ba_data/python/bastd/ui/soundtrack/macmusicapp.py index 27b2d3c6..64bef0ae 100644 --- a/assets/src/ba_data/python/bastd/ui/soundtrack/macmusicapp.py +++ b/assets/src/ba_data/python/bastd/ui/soundtrack/macmusicapp.py @@ -59,8 +59,8 @@ class MacMusicAppPlaylistSelectWindow(ba.Window): size=(self._width, 25), text=ba.Lstr(resource=self._r + '.selectAPlaylistText'), color=ba.app.title_color, - h_align="center", - v_align="center", + h_align='center', + v_align='center', maxwidth=200) self._scrollwidget = ba.scrollwidget(parent=self._root_widget, position=(40, v - 340), diff --git a/assets/src/ba_data/python/bastd/ui/store/browser.py b/assets/src/ba_data/python/bastd/ui/store/browser.py index 5e632ffa..953aab33 100644 --- a/assets/src/ba_data/python/bastd/ui/store/browser.py +++ b/assets/src/ba_data/python/bastd/ui/store/browser.py @@ -160,8 +160,8 @@ class StoreBrowserWindow(ba.Window): size=(0, 0), color=app.title_color, scale=1.5, - h_align="center", - v_align="center", + h_align='center', + v_align='center', text=ba.Lstr(resource='storeText'), maxwidth=420) @@ -372,8 +372,8 @@ class StoreBrowserWindow(ba.Window): position=(self._width * 0.5, self._height * 0.5), size=(0, 0), color=(1, 0.7, 1, 0.5), - h_align="center", - v_align="center", + h_align='center', + v_align='center', text=ba.Lstr(resource=self._r + '.loadingText'), maxwidth=self._scroll_width * 0.9) @@ -552,7 +552,7 @@ class StoreBrowserWindow(ba.Window): 'original_price': sale_info['op'] } except Exception: - ba.print_exception("Error parsing sales.") + ba.print_exception('Error parsing sales.') assert self.button_infos is not None for b_type, b_info in self.button_infos.items(): @@ -699,8 +699,8 @@ class StoreBrowserWindow(ba.Window): scale=1.3, transition_delay=0.1, color=(1, 0.3, 0.3, 1.0), - h_align="center", - v_align="center", + h_align='center', + v_align='center', text=ba.Lstr(resource=self._r + '.loadErrorText'), maxwidth=self._scroll_width * 0.9) else: @@ -864,8 +864,8 @@ class StoreBrowserWindow(ba.Window): scale=1.0, transition_delay=delay, color=(0.7, 0.9, 0.7, 1), - h_align="left", - v_align="center", + h_align='left', + v_align='center', text=ba.Lstr(resource=section['title']), maxwidth=self._width * 0.7) v -= title_spacing @@ -984,8 +984,8 @@ class StoreBrowserWindow(ba.Window): scale=1.3, transition_delay=0.1, color=(1, 1, 0.3, 1.0), - h_align="center", - v_align="center", + h_align='center', + v_align='center', text=ba.Lstr(resource=self._r + '.comingSoonText'), maxwidth=self._scroll_width * 0.9) @@ -1002,7 +1002,7 @@ class StoreBrowserWindow(ba.Window): sel_name = 'Tab:' + list(self._tab_buttons.keys())[list( self._tab_buttons.values()).index(sel)] else: - raise Exception("unrecognized selection") + raise Exception('unrecognized selection') ba.app.window_states[self.__class__.__name__] = { 'sel_name': sel_name, 'tab': self._current_tab diff --git a/assets/src/ba_data/python/bastd/ui/store/button.py b/assets/src/ba_data/python/bastd/ui/store/button.py index 53fda09f..7807873d 100644 --- a/assets/src/ba_data/python/bastd/ui/store/button.py +++ b/assets/src/ba_data/python/bastd/ui/store/button.py @@ -259,7 +259,7 @@ class StoreButton: if to_end > 0: sale_times.append(to_end) except Exception: - ba.print_exception("Error parsing sales") + ba.print_exception('Error parsing sales') if sale_times: sale_time = int(min(sale_times) * 1000) diff --git a/assets/src/ba_data/python/bastd/ui/teamnamescolors.py b/assets/src/ba_data/python/bastd/ui/teamnamescolors.py index 64bb08eb..8af30be8 100644 --- a/assets/src/ba_data/python/bastd/ui/teamnamescolors.py +++ b/assets/src/ba_data/python/bastd/ui/teamnamescolors.py @@ -86,8 +86,8 @@ class TeamNamesColorsWindow(popup.PopupWindow): position=(135, 0 + 201 - 90 * i), size=(280, 46), text=self._names[i], - h_align="left", - v_align="center", + h_align='left', + v_align='center', max_chars=self._max_name_length, color=self._colors[i], description=ba.Lstr(resource='nameText'), diff --git a/assets/src/ba_data/python/bastd/ui/telnet.py b/assets/src/ba_data/python/bastd/ui/telnet.py index 27adb9a9..2d412947 100644 --- a/assets/src/ba_data/python/bastd/ui/telnet.py +++ b/assets/src/ba_data/python/bastd/ui/telnet.py @@ -42,8 +42,8 @@ class TelnetAccessRequestWindow(ba.Window): ba.textwidget(parent=self._root_widget, position=(padding, padding + 33), size=(width - 2 * padding, height - 2 * padding), - h_align="center", - v_align="top", + h_align='center', + v_align='top', text=text) btn = ba.buttonwidget(parent=self._root_widget, position=(20, 20), diff --git a/assets/src/ba_data/python/bastd/ui/tournamententry.py b/assets/src/ba_data/python/bastd/ui/tournamententry.py index f40bc191..3ecec8ff 100644 --- a/assets/src/ba_data/python/bastd/ui/tournamententry.py +++ b/assets/src/ba_data/python/bastd/ui/tournamententry.py @@ -69,7 +69,7 @@ class TournamentEntryWindow(popup.PopupWindow): self._purchase_price_name = 'price.tournament_entry_1' else: if self._fee != 0: - raise Exception("invalid fee: " + str(self._fee)) + raise Exception('invalid fee: ' + str(self._fee)) self._purchase_name = 'tournament_entry_0' self._purchase_price_name = 'price.tournament_entry_0' @@ -294,7 +294,7 @@ class TournamentEntryWindow(popup.PopupWindow): self._have_valid_data = True self._last_query_time = ba.time(ba.TimeType.REAL) except Exception: - ba.print_exception("error using valid tourney data") + ba.print_exception('error using valid tourney data') self._have_valid_data = False else: self._have_valid_data = False diff --git a/assets/src/ba_data/python/bastd/ui/url.py b/assets/src/ba_data/python/bastd/ui/url.py index 445d6e4f..3f287dcc 100644 --- a/assets/src/ba_data/python/bastd/ui/url.py +++ b/assets/src/ba_data/python/bastd/ui/url.py @@ -74,8 +74,8 @@ class ShowURLWindow(ba.Window): position=(self._width * 0.5, self._height - 10), size=(0, 0), color=ba.app.title_color, - h_align="center", - v_align="center", + h_align='center', + v_align='center', text=ba.Lstr(resource='directBrowserToURLText'), maxwidth=self._width * 0.95) ba.textwidget(parent=self._root_widget, @@ -84,8 +84,8 @@ class ShowURLWindow(ba.Window): size=(0, 0), scale=1.3, color=ba.app.infotextcolor, - h_align="center", - v_align="center", + h_align='center', + v_align='center', text=address, maxwidth=self._width * 0.95) button_width = 200 diff --git a/assets/src/ba_data/python/bastd/ui/watch.py b/assets/src/ba_data/python/bastd/ui/watch.py index 5632f477..cc09b297 100644 --- a/assets/src/ba_data/python/bastd/ui/watch.py +++ b/assets/src/ba_data/python/bastd/ui/watch.py @@ -50,7 +50,7 @@ class WatchWindow(ba.Window): else: self._transition_out = 'out_right' scale_origin = None - ba.app.main_window = "Watch" + ba.app.main_window = 'Watch' self._tab_data: Dict[str, Any] = {} self._my_replays_scroll_width: Optional[float] = None self._my_replays_watch_replay_button: Optional[ba.Widget] = None @@ -101,8 +101,8 @@ class WatchWindow(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=400) @@ -293,7 +293,7 @@ class WatchWindow(ba.Window): _ba.new_replay_session(_ba.get_replays_dir() + '/' + self._my_replay_selected) except Exception: - ba.print_exception("exception running replay session") + ba.print_exception('exception running replay session') # drop back into a fresh main menu session # in case we half-launched or something.. from bastd import mainmenu @@ -448,7 +448,7 @@ class WatchWindow(ba.Window): names = [n for n in names if n.endswith('.brp')] names.sort(key=lambda x: x.lower()) except Exception: - ba.print_exception("error listing replays dir") + ba.print_exception('error listing replays dir') names = [] assert self._my_replays_scroll_width is not None @@ -482,7 +482,7 @@ class WatchWindow(ba.Window): elif sel == self._tab_container: sel_name = 'TabContainer' else: - raise Exception("unrecognized selection") + raise Exception('unrecognized selection') ba.app.window_states[self.__class__.__name__] = { 'sel_name': sel_name, 'tab': self._current_tab diff --git a/assets/src/ba_data/python/efro/entity/_entity.py b/assets/src/ba_data/python/efro/entity/_entity.py index 3b2aeb79..3b12c2e1 100644 --- a/assets/src/ba_data/python/efro/entity/_entity.py +++ b/assets/src/ba_data/python/efro/entity/_entity.py @@ -94,7 +94,7 @@ class EntityMixin: assert isinstance(self, CompoundValue) if not have_matching_fields(self, tvalue): raise ValueError( - f"Fields for target {type(tvalue)} do not match ours" + f'Fields for target {type(tvalue)} do not match ours' f" ({type(self)}); can't copy data.") self.d_data = copy.deepcopy(target_data) @@ -115,7 +115,7 @@ class EntityMixin: assert isinstance(self, CompoundValue) if not have_matching_fields(self, target): raise ValueError( - f"Fields for target {type(target)} do not match ours" + f'Fields for target {type(target)} do not match ours' f" ({type(self)}); can't steal data.") assert target.d_data is not None self.d_data = target.d_data diff --git a/assets/src/ba_data/python/efro/entity/_field.py b/assets/src/ba_data/python/efro/entity/_field.py index d0791186..4a0a4714 100644 --- a/assets/src/ba_data/python/efro/entity/_field.py +++ b/assets/src/ba_data/python/efro/entity/_field.py @@ -158,8 +158,8 @@ class CompoundField(BaseField, Generic[TC]): raise ValueError(f"Can't assign from unbound object {value}") if self.d_value.get_fields() != value1.get_fields(): raise ValueError(f"Can't assign to {self.d_value} from" - f" incompatible type {value.d_value}; " - f"sub-fields do not match.") + f' incompatible type {value.d_value}; ' + f'sub-fields do not match.') # If we're allowing this to go through, we can simply copy the # data from the passed in value. The fields match so it should diff --git a/assets/src/ba_data/python/efro/entity/_support.py b/assets/src/ba_data/python/efro/entity/_support.py index 0139f415..961c6b0e 100644 --- a/assets/src/ba_data/python/efro/entity/_support.py +++ b/assets/src/ba_data/python/efro/entity/_support.py @@ -209,7 +209,7 @@ class BoundListField(Generic[T]): def __setitem__(self, key: int, value: T) -> None: if not isinstance(key, int): - raise TypeError("Expected int index.") + raise TypeError('Expected int index.') self.d_data[key] = self.d_field.d_value.filter_input(value, error=True) @@ -260,7 +260,7 @@ class BoundDictField(Generic[TKey, T]): def __setitem__(self, key: TKey, value: T) -> None: if not isinstance(key, self._keytype): - raise TypeError("Expected str index.") + raise TypeError('Expected str index.') self.d_data[key] = self.d_field.d_value.filter_input(value, error=True) def __contains__(self, key: TKey) -> bool: diff --git a/assets/src/ba_data/python/efro/entity/_value.py b/assets/src/ba_data/python/efro/entity/_value.py index 386464e9..30e8abc3 100644 --- a/assets/src/ba_data/python/efro/entity/_value.py +++ b/assets/src/ba_data/python/efro/entity/_value.py @@ -130,7 +130,7 @@ class SimpleValue(TypedValue[T]): class StringValue(SimpleValue[str]): """Value consisting of a single string.""" - def __init__(self, default: str = "", store_default: bool = True) -> None: + def __init__(self, default: str = '', store_default: bool = True) -> None: super().__init__(default, store_default, str) @@ -180,8 +180,8 @@ def verify_time_input(data: Any, error: bool, allow_none: bool) -> Any: # Filter unallowed None values. if not allow_none and data is None: if error: - raise ValueError("datetime value cannot be None") - logging.error("ignoring datetime value of None") + raise ValueError('datetime value cannot be None') + logging.error('ignoring datetime value of None') data = (None if allow_none else datetime.datetime.now( datetime.timezone.utc)) @@ -192,9 +192,9 @@ def verify_time_input(data: Any, error: bool, allow_none: bool) -> Any: and (pytz_utc is None or data.tzinfo is not pytz_utc)): if error: raise ValueError( - "datetime values must have timezone set as timezone.utc") + 'datetime values must have timezone set as timezone.utc') logging.error( - "ignoring datetime value without timezone.utc set: %s %s", + 'ignoring datetime value without timezone.utc set: %s %s', type(datetime.timezone.utc), type(data.tzinfo)) data = (None if allow_none else datetime.datetime.now( datetime.timezone.utc)) @@ -292,7 +292,7 @@ class Float3Value(SimpleValue[Tuple[float, float, float]]): if (not isinstance(data, abc.Sequence) or len(data) != 3 or any(not isinstance(i, (int, float)) for i in data)): if error: - raise TypeError("Sequence of 3 float values expected.") + raise TypeError('Sequence of 3 float values expected.') logging.error('Ignoring non-3-float-sequence data for %s: %s', self, data) data = self.get_default_data() @@ -367,7 +367,7 @@ class BaseEnumValue(TypedValue[T]): except ValueError: if error: raise ValueError( - f"Invalid value for {self._enumtype}: {data}") + f'Invalid value for {self._enumtype}: {data}') logging.error('Ignoring invalid value for %s: %s', self._enumtype, data) data = self._default_data diff --git a/assets/src/ba_data/python/efro/executils.py b/assets/src/ba_data/python/efro/executils.py index 1ce7548f..d9a26046 100644 --- a/assets/src/ba_data/python/efro/executils.py +++ b/assets/src/ba_data/python/efro/executils.py @@ -52,17 +52,17 @@ class CallbackSet(Generic[CT]): def run(self, *args, **keywds): """Run all callbacks.""" - print("HELLO FROM RUN", *args, **keywds) + print('HELLO FROM RUN', *args, **keywds) def __init__(self) -> None: - print("CallbackSet()") + print('CallbackSet()') def __del__(self) -> None: - print("~CallbackSet()") + print('~CallbackSet()') def add(self, call: CT) -> None: """Add a callback to be run.""" - print("Would add call", call) + print('Would add call', call) # Define Call() which can be used in type-checking call-wrappers that behave diff --git a/assets/src/ba_data/python/efro/jsonutils.py b/assets/src/ba_data/python/efro/jsonutils.py index 383380bb..0ec2f492 100644 --- a/assets/src/ba_data/python/efro/jsonutils.py +++ b/assets/src/ba_data/python/efro/jsonutils.py @@ -58,8 +58,8 @@ class ExtendedJSONEncoder(json.JSONEncoder): 'datetime values must have timezone set as timezone.utc') return { TYPE_TAG: - "dt", - "v": [ + 'dt', + 'v': [ obj.year, obj.month, obj.day, obj.hour, obj.minute, obj.second, obj.microsecond ], @@ -84,7 +84,7 @@ class ExtendedJSONDecoder(json.JSONDecoder): if objtype == 'dt': vals = obj.get('v', []) if len(vals) != 7: - raise ValueError("malformed datetime value") + raise ValueError('malformed datetime value') return datetime.datetime( # type: ignore *vals, tzinfo=datetime.timezone.utc) return obj diff --git a/assets/src/server/server.py b/assets/src/server/server.py index 48c744bb..021ef81e 100755 --- a/assets/src/server/server.py +++ b/assets/src/server/server.py @@ -71,7 +71,7 @@ class App: # Print basic usage info in interactive mode. if sys.stdin.isatty(): - print("BallisticaCore Server wrapper starting up...") + print('BallisticaCore Server wrapper starting up...') # The server-binary will get relaunched after this amount of time # (combats memory leaks or other cruft that has built up). @@ -165,7 +165,7 @@ class App: # Pass along any commands that have come in through stdin. for incmd in self._input_commands: - print("WOULD PASS ALONG COMMAND", incmd) + print('WOULD PASS ALONG COMMAND', incmd) self._input_commands = [] # Request a restart after a while. @@ -190,7 +190,7 @@ class App: def _kill_process(self) -> None: """Forcefully end the server process.""" - print("Stopping server process...") + print('Stopping server process...') assert self._process is not None # First, ask it nicely to die and give it a moment. @@ -200,7 +200,7 @@ class App: self._process.wait(timeout=10) except subprocess.TimeoutExpired: self._process.kill() - print("Server process stopped.") + print('Server process stopped.') if __name__ == '__main__': diff --git a/config/toolconfigsrc/pylintrc b/config/toolconfigsrc/pylintrc index b1293b74..8d17ef52 100644 --- a/config/toolconfigsrc/pylintrc +++ b/config/toolconfigsrc/pylintrc @@ -106,3 +106,7 @@ max-parents=10 [IMPORTS] # We do quite a bit of this. Perhaps can reconsider if its a good idea later. disable=import-outside-toplevel + +[STRING] +# PEP-8 says to be consistent with quotes; let's remind ourself... +check-quote-consistency=yes diff --git a/tests/test_efro/test_entities.py b/tests/test_efro/test_entities.py index 5a0d2dd4..063ab689 100644 --- a/tests/test_efro/test_entities.py +++ b/tests/test_efro/test_entities.py @@ -96,7 +96,7 @@ def test_entity_values() -> None: # Simple float field. with pytest.raises(TypeError): - ent.fval = "foo" # type: ignore + ent.fval = 'foo' # type: ignore assert static_type_equals(ent.fval, float) ent.fval = 2 ent.fval = True diff --git a/tools/batools/build.py b/tools/batools/build.py index ac3a5d5a..1f110178 100644 --- a/tools/batools/build.py +++ b/tools/batools/build.py @@ -482,7 +482,7 @@ def checkenv() -> None: raise RuntimeError(f'{PYTHON_BIN} is required; please install it.') # Make sure they've got pip for that python version. - if subprocess.run(f"{PYTHON_BIN} -m pip --version", + if subprocess.run(f'{PYTHON_BIN} -m pip --version', shell=True, check=False, capture_output=True).returncode != 0: diff --git a/tools/efrotools/__init__.py b/tools/efrotools/__init__.py index 56f4ca7d..9e0935ba 100644 --- a/tools/efrotools/__init__.py +++ b/tools/efrotools/__init__.py @@ -213,7 +213,7 @@ def py_examine(filename: Path, line: int, column: int, # Insert a line after the provided one which is just the symbol so we # can ask for its value alone. - match = re.match(r"\s*", flines[line - 1]) + match = re.match(r'\s*', flines[line - 1]) whitespace = match.group() if match is not None else '' sline = whitespace + symbol + ' #@' flines = flines[:line] + [sline] + flines[line:] @@ -228,7 +228,7 @@ def py_examine(filename: Path, line: int, column: int, # Insert a line after the provided one which is just the symbol so we # can ask for its value alone. - match = re.match(r"\s*", flines[line - 1]) + match = re.match(r'\s*', flines[line - 1]) whitespace = match.group() if match is not None else '' if operation == 'mypy_infer': sline = whitespace + 'reveal_type(' + symbol + ')' diff --git a/tools/efrotools/code.py b/tools/efrotools/code.py index e3dd2837..3b18a02d 100644 --- a/tools/efrotools/code.py +++ b/tools/efrotools/code.py @@ -622,7 +622,7 @@ def _run_idea_inspections(projroot: Path, if not iprof.exists(): iprof = Path(projroot, '.idea/inspectionProfiles/Project_Default.xml') if not iprof.exists(): - raise Exception("No default inspection profile found.") + raise Exception('No default inspection profile found.') cmd = [str(inspect), str(projroot), str(iprof), tmpdir.name, '-v2'] if inspectdir is not None: cmd += ['-d', str(inspectdir)] @@ -632,7 +632,7 @@ def _run_idea_inspections(projroot: Path, """Print the time occasionally to make the log more informative.""" while running: time.sleep(60) - print("Heartbeat", datetime.datetime.now(), flush=True) + print('Heartbeat', datetime.datetime.now(), flush=True) if verbose: import threading @@ -652,7 +652,7 @@ def _run_idea_inspections(projroot: Path, result.stdout, bytes) else str(result.stdout)) print(f'{displayname} inspection failure stdout:\n{stdout}' + f'{displayname} inspection failure stderr:\n{stderr}') - raise RuntimeError(f"{displayname} inspection failed.") + raise RuntimeError(f'{displayname} inspection failed.') files = [f for f in os.listdir(tmpdir.name) if not f.startswith('.')] total_errors = 0 if files: @@ -660,7 +660,7 @@ def _run_idea_inspections(projroot: Path, total_errors += _parse_idea_results(Path(tmpdir.name, fname)) if total_errors > 0: raise RuntimeError( - f"{displayname} inspection found {total_errors} error(s).") + f'{displayname} inspection found {total_errors} error(s).') duration = time.time() - start_time print( diff --git a/tools/efrotools/efrocache.py b/tools/efrotools/efrocache.py index 81c95769..b137c6fd 100644 --- a/tools/efrotools/efrocache.py +++ b/tools/efrotools/efrocache.py @@ -257,8 +257,8 @@ def _upload_cache(fnames1: List[str], fnames2: List[str], hashes_str: str, _write_cache_files(fnames1, fnames2, staging_dir, mapping_file) - print(f"{CLRBLU}Starter cache includes {len(fnames1)} items;" - f" excludes {len(fnames2)}{CLREND}") + print(f'{CLRBLU}Starter cache includes {len(fnames1)} items;' + f' excludes {len(fnames2)}{CLREND}') # Sync all individual cache files to the staging server. print(f'{CLRBLU}Pushing cache to staging...{CLREND}', flush=True) diff --git a/tools/efrotools/ios.py b/tools/efrotools/ios.py index 1fe328d3..0db9edea 100644 --- a/tools/efrotools/ios.py +++ b/tools/efrotools/ios.py @@ -93,7 +93,7 @@ def push_ipa(root: pathlib.Path, modename: str) -> None: capture_output=True).stdout.decode().strip() built_app_path = pathlib.Path(app_dir, cfg.app_bundle_name) - workdir = pathlib.Path(root, 'build', "push_ipa") + workdir = pathlib.Path(root, 'build', 'push_ipa') workdir.mkdir(parents=True, exist_ok=True) pathlib.Path(root, 'build').mkdir(parents=True, exist_ok=True) diff --git a/tools/efrotools/jsontools.py b/tools/efrotools/jsontools.py index e620a5b7..e608cd44 100644 --- a/tools/efrotools/jsontools.py +++ b/tools/efrotools/jsontools.py @@ -54,7 +54,7 @@ class NoIndentEncoder(json.JSONEncoder): if isinstance(o, NoIndent): key = uuid.uuid4().hex self._replacement_map[key] = json.dumps(o.value, **self.kwargs) - return "@@%s@@" % (key, ) + return '@@%s@@' % (key, ) return super(NoIndentEncoder, self).default(o) def encode(self, o: Any) -> Any: diff --git a/tools/efrotools/pybuild.py b/tools/efrotools/pybuild.py index 6e6596df..0bd301c6 100644 --- a/tools/efrotools/pybuild.py +++ b/tools/efrotools/pybuild.py @@ -31,7 +31,7 @@ if TYPE_CHECKING: from typing import List, Dict, Any # Overall version we're using for the game currently. -PYTHON_VERSION_MAJOR = "3.7" +PYTHON_VERSION_MAJOR = '3.7' ENABLE_OPENSSL = True @@ -170,7 +170,7 @@ def build_apple(arch: str, debug: bool = False) -> None: dline = '--with-doc-strings --enable-ipv6 --without-ensurepip' splitlen = len(txt.split(dline)) if splitlen != 3: - raise Exception("unexpected configure lines") + raise Exception('unexpected configure lines') txt = txt.replace(dline, '--with-pydebug ' + dline) # Debug has a different name. @@ -178,7 +178,7 @@ def build_apple(arch: str, debug: bool = False) -> None: dline = 'python$(PYTHON_VER)m' splitlen = len(txt.split(dline)) if splitlen != 14: - raise Exception("unexpected configure lines") + raise Exception('unexpected configure lines') txt = txt.replace(dline, 'python$(PYTHON_VER)dm') efrotools.writefile('Makefile', txt) @@ -214,7 +214,7 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None: # gettext homebrew formula. if (subprocess.run('which autopoint', shell=True, check=False).returncode != 0): - print("Updating path for mac autopoint...") + print('Updating path for mac autopoint...') appath = subprocess.run('brew ls gettext | grep bin/autopoint', shell=True, check=True, @@ -233,7 +233,7 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None: # Set the packages we build. ftxt = efrotools.replace_one( ftxt, 'packages = (', "packages = ('zlib', 'sqlite', 'xz'," + - (" 'openssl'" if ENABLE_OPENSSL else "") + ")\n# packages = (") + (" 'openssl'" if ENABLE_OPENSSL else '') + ')\n# packages = (') # Don't wanna bother with gpg signing stuff. ftxt = efrotools.replace_one(ftxt, 'verify_source = True', @@ -253,7 +253,7 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None: ftxt = efrotools.readfile('pybuild/packages/python.py') # We currently build as a static lib. - ftxt = efrotools.replace_one(ftxt, " '--enable-shared',\n", "") + ftxt = efrotools.replace_one(ftxt, " '--enable-shared',\n", '') ftxt = efrotools.replace_one( ftxt, "super().__init__('https://github.com/python/cpython/')", "super().__init__('https://github.com/python/cpython/', branch='3.7')") @@ -266,7 +266,7 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None: "'./configure', '--with-pydebug',") # We don't use this stuff so lets strip it out to simplify. - ftxt = efrotools.replace_one(ftxt, "'--without-ensurepip',", "") + ftxt = efrotools.replace_one(ftxt, "'--without-ensurepip',", '') # This builds all modules as dynamic libs, but we want to be consistent # with our other embedded builds and just static-build the ones we @@ -290,12 +290,12 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None: # Check out a particular commit right after the clone. ftxt = efrotools.replace_one( ftxt, "'git', 'clone', '--single-branch', '-b'," - " self.branch, self.source_url, self.dest])", + ' self.branch, self.source_url, self.dest])', "'git', 'clone', '-b'," - " self.branch, self.source_url, self.dest])\n" - " # efro: hack to get the python we want.\n" + ' self.branch, self.source_url, self.dest])\n' + ' # efro: hack to get the python we want.\n' " print('DOING URL', self.source_url)\n" - " if self.source_url == " + ' if self.source_url == ' "'https://github.com/python/cpython/':\n" " run_in_dir(['git', 'checkout', '" + commit + "'], self.source_dir)") @@ -402,7 +402,7 @@ def android_patch() -> None: ' [A-Z]*=*) DEFS="$line$NL$DEFS"; continue;;') efrotools.writefile(fname, txt) - print("APPLIED EFROTOOLS ANDROID BUILD PATCHES.") + print('APPLIED EFROTOOLS ANDROID BUILD PATCHES.') def gather() -> None: diff --git a/tools/efrotools/snippets.py b/tools/efrotools/snippets.py index fd2d3270..ab272b1c 100644 --- a/tools/efrotools/snippets.py +++ b/tools/efrotools/snippets.py @@ -63,7 +63,7 @@ def snippets_main(globs: Dict[str, Any]) -> None: show_help = False retval = 0 if len(sys.argv) < 2: - print("ERROR: command expected.") + print('ERROR: command expected.') show_help = True retval = 255 else: @@ -89,8 +89,8 @@ def snippets_main(globs: Dict[str, Any]) -> None: retval = 255 if show_help: - print("Snippets contains project related commands too small" - " to warrant full scripts.") + print('Snippets contains project related commands too small' + ' to warrant full scripts.') print("Run 'snippets help ' for full command documentation.") print('Available commands:') for func, obj in sorted(funcs.items()): @@ -165,7 +165,7 @@ def spelling_all() -> None: if 'Typo: In word' in line ] words = [ - line.split('Typo: In word')[1].strip().replace("'", "") + line.split('Typo: In word')[1].strip().replace("'", '') for line in lines ] _spelling(words) @@ -297,7 +297,7 @@ def tool_config_install() -> None: from efrotools import get_config import textwrap if len(sys.argv) != 4: - raise Exception("expected 2 args") + raise Exception('expected 2 args') src = Path(sys.argv[2]) dst = Path(sys.argv[3]) with src.open() as infile: @@ -396,12 +396,12 @@ def sync_all() -> None: # Real mode for i in range(2): if i == 0: - print(CLRBLU + "Running sync pass 1:" - " (ensures all changes at dsts are pushed to src)" + + print(CLRBLU + 'Running sync pass 1:' + ' (ensures all changes at dsts are pushed to src)' + CLREND) else: - print(CLRBLU + "Running sync pass 2:" - " (ensures latest src is pulled to all dsts)" + CLREND) + print(CLRBLU + 'Running sync pass 2:' + ' (ensures latest src is pulled to all dsts)' + CLREND) for project in projects_str.split(':'): cmd = f'cd "{project}" && make sync-full' print(cmd) @@ -481,7 +481,7 @@ def makefile_target_list() -> None: title: str if len(sys.argv) != 3: - raise RuntimeError("Expected exactly one filename arg.") + raise RuntimeError('Expected exactly one filename arg.') with open(sys.argv[2]) as infile: lines = infile.readlines() diff --git a/tools/efrotools/statictest.py b/tools/efrotools/statictest.py index 48db7cfd..2517662e 100644 --- a/tools/efrotools/statictest.py +++ b/tools/efrotools/statictest.py @@ -62,7 +62,7 @@ class StaticTestFile: # Types Mypy gave us for lines self.linetypes_mypy: Dict[int, str] = {} - print(f"Running Mypy static testing on \"{filename}\"...") + print(f'Running Mypy static testing on "{filename}"...') with open(filename, 'r') as infile: fdata = infile.read() @@ -98,7 +98,7 @@ class StaticTestFile: lines = results.stdout.decode().splitlines() for line in lines: if ': error: ' in line: - print("Full mypy output:\n", results.stdout.decode()) + print('Full mypy output:\n', results.stdout.decode()) raise RuntimeError('Errors detected in mypy output.') if 'Revealed type is ' in line: finfo = line.split(' ')[0] @@ -136,15 +136,15 @@ class StaticTestFile: tree = ast.parse(line[offset:]) except Exception: raise RuntimeError( - f"{self._filename} line {lineno+1}: unable to " - f"parse line (static_type_equals() call cannot" - f" be split across lines).") from None + f'{self._filename} line {lineno+1}: unable to ' + f'parse line (static_type_equals() call cannot' + f' be split across lines).') from None assert isinstance(tree, ast.Module) if (len(tree.body) != 1 or not isinstance(tree.body[0], ast.Assert)): raise RuntimeError( - f"{self._filename} line {lineno+1}: expected " - f" a single assert statement.") + f'{self._filename} line {lineno+1}: expected ' + f' a single assert statement.') assertnode = tree.body[0] callnode = assertnode.test if (not isinstance(callnode, ast.Call) @@ -152,8 +152,8 @@ class StaticTestFile: or callnode.func.id != 'static_type_equals' or len(callnode.args) != 2): raise RuntimeError( - f"{self._filename} line {lineno+1}: expected " - f" a single static_type_equals() call with 2 args.") + f'{self._filename} line {lineno+1}: expected ' + f' a single static_type_equals() call with 2 args.') # Use the column offsets for the 2 args along with our end # paren offset to cut out the substrings representing the args. diff --git a/tools/snippets b/tools/snippets index 71302778..b4ec69bd 100755 --- a/tools/snippets +++ b/tools/snippets @@ -105,15 +105,15 @@ def resize_image() -> None: args: xres, yres, src, dst """ if len(sys.argv) != 6: - raise Exception("expected 5 args") + raise Exception('expected 5 args') width = int(sys.argv[2]) height = int(sys.argv[3]) src = sys.argv[4] dst = sys.argv[5] if not dst.endswith('.png'): - raise Exception("dst must be a png") + raise Exception('dst must be a png') if not src.endswith('.png'): - raise Exception("src must be a png") + raise Exception('src must be a png') print('Creating: ' + os.path.basename(dst), file=sys.stderr) # Switching to imagemagick from sips - hopefully this goes well @@ -251,7 +251,7 @@ def _python_build_apple(debug: bool) -> None: os.chdir(PROJROOT) archs = ('mac', 'ios', 'tvos') if len(sys.argv) != 3: - print("ERROR: expected one arg: " + ', '.join(archs)) + print('ERROR: expected one arg: ' + ', '.join(archs)) sys.exit(255) arch = sys.argv[2] if arch not in archs: @@ -275,7 +275,7 @@ def _python_build_android(debug: bool) -> None: os.chdir(PROJROOT) archs = ('arm', 'arm64', 'x86', 'x86_64') if len(sys.argv) != 3: - print("ERROR: expected one arg: " + ', '.join(archs)) + print('ERROR: expected one arg: ' + ', '.join(archs)) sys.exit(255) arch = sys.argv[2] if arch not in archs: @@ -318,7 +318,7 @@ def clean_orphaned_assets() -> None: fpath = os.path.join(root, fname) fpathrel = fpath[13:] # paths are relative to assets/build if fpathrel not in manifest: - print(f"Removing orphaned asset file: {fpath}") + print(f'Removing orphaned asset file: {fpath}') os.unlink(fpath) # Lastly, clear empty dirs. @@ -431,7 +431,7 @@ def get_modern_make() -> None: if subprocess.run(['which', 'gmake'], check=False, capture_output=True).returncode != 0: print( - "WARNING: this requires gmake (mac system make is too old)." + 'WARNING: this requires gmake (mac system make is too old).' " Install it with 'brew install make'", file=sys.stderr, flush=True) diff --git a/tools/stage_assets b/tools/stage_assets index 213b5b67..14b8d80c 100755 --- a/tools/stage_assets +++ b/tools/stage_assets @@ -238,20 +238,20 @@ def _sync_windows_extras(cfg: Config) -> None: # over. The Python stuff in Extras is also used by some scripts # so there may be arbitrary non-opt pycs hanging around. _run(f'mkdir -p "{cfg.dst}/{dirname}"') - cmd = ("rsync --recursive --update --delete --delete-excluded " - " --prune-empty-dirs" + cmd = ('rsync --recursive --update --delete --delete-excluded ' + ' --prune-empty-dirs' " --include '*.ico' --include '*.cat'" " --include '*.dll' --include '*.pyd'" " --include '*.py' --include '*." + OPT_PYC_SUFFIX + "'" " --include '*/' --exclude '*' \"" + - os.path.join(cfg.win_extras_src, dirname) + "/\" " - "\"" + cfg.dst + "/" + dirname + "/\"") + os.path.join(cfg.win_extras_src, dirname) + '/" ' + '"' + cfg.dst + '/' + dirname + '/"') _run(cmd) # Now sync the top level individual files. - cmd = ("rsync --update " + cfg.win_extras_src + "/*.dll " + - cfg.win_extras_src + "/*.exe" - " \"" + cfg.dst + "/\"") + cmd = ('rsync --update ' + cfg.win_extras_src + '/*.dll ' + + cfg.win_extras_src + '/*.exe' + ' "' + cfg.dst + '/"') _run(cmd) # If we're running under WSL we won't be able to launch these .exe files @@ -263,12 +263,12 @@ def _sync_pylib(cfg: Config) -> None: assert cfg.pylib_src_name is not None assert cfg.dst is not None _run(f'mkdir -p "{cfg.dst}/pylib"') - cmd = (f"rsync --recursive --update --delete --delete-excluded " - f" --prune-empty-dirs" + cmd = (f'rsync --recursive --update --delete --delete-excluded ' + f' --prune-empty-dirs' f" --include '*.py' --include '*.{OPT_PYC_SUFFIX}'" f" --include '*/' --exclude '*'" - f" \"{cfg.src}/{cfg.pylib_src_name}/\" " - f"\"{cfg.dst}/pylib/\"") + f' "{cfg.src}/{cfg.pylib_src_name}/" ' + f'"{cfg.dst}/pylib/"') _run(cmd) @@ -297,8 +297,8 @@ def main() -> None: # Now standard common game data. assert cfg.dst is not None _run('mkdir -p "' + cfg.dst + '/ba_data"') - cmd = ("rsync --recursive --update --delete --delete-excluded" - " --prune-empty-dirs") + cmd = ('rsync --recursive --update --delete --delete-excluded' + ' --prune-empty-dirs') if cfg.include_scripts: cmd += " --include '*.py' --include '*." + OPT_PYC_SUFFIX + "'" @@ -322,8 +322,8 @@ def main() -> None: if cfg.include_collide_models: cmd += " --include '*.cob'" - cmd += (" --include='*/' --exclude='*' \"" + cfg.src + "/ba_data/\" \"" + - cfg.dst + "/ba_data/\"") + cmd += (" --include='*/' --exclude='*' \"" + cfg.src + '/ba_data/" "' + + cfg.dst + '/ba_data/"') _run(cmd) # On Android we need to build a payload file so it knows diff --git a/tools/update_project b/tools/update_project index 7ca89748..5c8c9115 100755 --- a/tools/update_project +++ b/tools/update_project @@ -214,8 +214,8 @@ class App: # If there are any manual-only entries, list then and bail. # (Don't wanna allow auto-apply unless it fixes everything) if manual_changes: - print(f"{CLRRED}Found erroneous lines " - f"requiring manual correction:{CLREND}") + print(f'{CLRRED}Found erroneous lines ' + f'requiring manual correction:{CLREND}') for change in manual_changes: print(f'{CLRRED}{change[0]}:{change[1].line_number + 1}:' f' Expected line to be:\n {change[1].expected}{CLREND}') @@ -393,8 +393,8 @@ class App: 'tools/devtool', 'tools/version_utils', 'tools/vmshell' ]: if not contents.startswith('#!/usr/bin/env python3.7'): - print(f"{CLRRED}Incorrect shebang (first line) for " - f"{fname}.{CLREND}") + print(f'{CLRRED}Incorrect shebang (first line) for ' + f'{fname}.{CLREND}') sys.exit(255) else: copyrightline = 0