diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index bf5347e9..96f5078e 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -34,6 +34,7 @@ activitytypes activityutils actorclass + adbcfaca adbpath addgame addr @@ -791,6 +792,7 @@ icns iconpicker iconscale + ident idevices ifeq ifneq diff --git a/assets/src/ba_data/python/ba/_assetmanager.py b/assets/src/ba_data/python/ba/_assetmanager.py index 18bbbcdb..69da0579 100644 --- a/assets/src/ba_data/python/ba/_assetmanager.py +++ b/assets/src/ba_data/python/ba/_assetmanager.py @@ -24,6 +24,7 @@ from __future__ import annotations from typing import TYPE_CHECKING from pathlib import Path +import threading import urllib.request import logging import weakref @@ -56,6 +57,7 @@ class AssetManager: def __init__(self, rootdir: Path) -> None: print('AssetManager()') assert isinstance(rootdir, Path) + self.thread_ident = threading.get_ident() self._rootdir = rootdir self._started = False if not self._rootdir.is_dir(): @@ -139,6 +141,7 @@ class AssetGather: """Wrangles a gather of assets.""" def __init__(self, manager: AssetManager) -> None: + assert threading.get_ident() == manager.thread_ident self._manager = weakref.ref(manager) self._valid = True print('AssetGather()') @@ -168,7 +171,6 @@ def fetch_url(url: str, filename: Path, asset_gather: AssetGather) -> None: # pylint: disable=too-many-locals import socket - import threading # We don't want to keep the provided AssetGather alive, but we want # to abort if it dies. @@ -186,7 +188,7 @@ def fetch_url(url: str, filename: Path, asset_gather: AssetGather) -> None: print('dir', type(req.fp), dir(req.fp)) print('WOULD DO IT', flush=True) # req.close() - req.fp.close() + # req.fp.close() threading.Thread(target=doit).run() @@ -228,3 +230,4 @@ def fetch_url(url: str, filename: Path, asset_gather: AssetGather) -> None: status = f'{file_size_dl:20,} Bytes [{percent:.2%}] received' sys.stdout.write('\r' + status) sys.stdout.flush() + print('done with', req.fp) diff --git a/assets/src/ba_data/python/ba/_meta.py b/assets/src/ba_data/python/ba/_meta.py index bf946e19..6a027665 100644 --- a/assets/src/ba_data/python/ba/_meta.py +++ b/assets/src/ba_data/python/ba/_meta.py @@ -175,7 +175,7 @@ class DirectoryScan: flines = infile.readlines() meta_lines = { lnum: l[1:].split() - for lnum, l in enumerate(flines) if 'bs_meta' in l + for lnum, l in enumerate(flines) if 'ba_meta' in l } toplevel = len(subpath.parts) <= 1 required_api = self.get_api_requirement(subpath, meta_lines, toplevel) @@ -213,25 +213,25 @@ class DirectoryScan: def _process_module_meta_tags(self, subpath: pathlib.Path, flines: List[str], meta_lines: Dict[int, List[str]]) -> None: - """Pull data from a module based on its bs_meta tags.""" + """Pull data from a module based on its ba_meta tags.""" for lindex, mline in meta_lines.items(): - # meta_lines is just anything containing 'bs_meta'; make sure - # the bs_meta is in the right place. - if mline[0] != 'bs_meta': + # meta_lines is just anything containing 'ba_meta'; make sure + # the ba_meta is in the right place. + if mline[0] != 'ba_meta': self.results['warnings'] += ( 'Warning: ' + str(subpath) + - ': malformed bs_meta statement on line ' + + ': malformed ba_meta statement on line ' + str(lindex + 1) + '.\n') elif (len(mline) == 4 and mline[1] == 'require' and mline[2] == 'api'): # Ignore 'require api X' lines in this pass. pass elif len(mline) != 3 or mline[1] != 'export': - # Currently we only support 'bs_meta export FOO'; + # Currently we only support 'ba_meta export FOO'; # complain for anything else we see. self.results['warnings'] += ( 'Warning: ' + str(subpath) + - ': unrecognized bs_meta statement on line ' + + ': unrecognized ba_meta statement on line ' + str(lindex + 1) + '.\n') else: # Looks like we've got a valid export line! @@ -273,7 +273,7 @@ class DirectoryScan: if classname is None: self.results['warnings'] += ( 'Warning: ' + str(subpath) + ': class definition not found' - ' below "bs_meta export" statement on line ' + + ' below "ba_meta export" statement on line ' + str(lindexorig + 1) + '.\n') return classname @@ -285,7 +285,7 @@ class DirectoryScan: Malformed api requirement strings will be logged as warnings. """ lines = [ - l for l in meta_lines.values() if len(l) == 4 and l[0] == 'bs_meta' + l for l in meta_lines.values() if len(l) == 4 and l[0] == 'ba_meta' and l[1] == 'require' and l[2] == 'api' and l[3].isdigit() ] @@ -297,14 +297,14 @@ class DirectoryScan: if len(lines) > 1: self.results['warnings'] += ( 'Warning: ' + str(subpath) + - ': multiple "# bs_meta api require " lines found;' + ': multiple "# ba_meta api require " lines found;' ' ignoring module.\n') elif not lines and toplevel and meta_lines: # If we're a top-level module containing meta lines but # no valid api require, complain. self.results['warnings'] += ( 'Warning: ' + str(subpath) + - ': no valid "# bs_meta api require " line found;' + ': no valid "# ba_meta api require " line found;' ' ignoring module.\n') return None diff --git a/assets/src/ba_data/python/bastd/__init__.py b/assets/src/ba_data/python/bastd/__init__.py index ca8e8eea..ab76b753 100644 --- a/assets/src/ba_data/python/bastd/__init__.py +++ b/assets/src/ba_data/python/bastd/__init__.py @@ -20,4 +20,4 @@ # ----------------------------------------------------------------------------- """BallisticaCore standard library: games, UI, etc.""" -# bs_meta require api 6 +# ba_meta require api 6 diff --git a/assets/src/ba_data/python/bastd/game/assault.py b/assets/src/ba_data/python/bastd/game/assault.py index de53d940..d21d3217 100644 --- a/assets/src/ba_data/python/bastd/game/assault.py +++ b/assets/src/ba_data/python/bastd/game/assault.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Defines assault minigame.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -35,7 +35,7 @@ if TYPE_CHECKING: from typing import Any, Type, List, Dict, Tuple, Sequence, Union -# bs_meta export game +# ba_meta export game class AssaultGame(ba.TeamGameActivity): """Game where you score by touching the other team's flag.""" diff --git a/assets/src/ba_data/python/bastd/game/capturetheflag.py b/assets/src/ba_data/python/bastd/game/capturetheflag.py index bf7d0c4f..e6c25a97 100644 --- a/assets/src/ba_data/python/bastd/game/capturetheflag.py +++ b/assets/src/ba_data/python/bastd/game/capturetheflag.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Defines a capture-the-flag game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -68,7 +68,7 @@ class CTFFlag(stdflag.Flag): return self._team -# bs_meta export game +# ba_meta export game class CaptureTheFlagGame(ba.TeamGameActivity): """Game of stealing other team's flag and returning it to your base.""" diff --git a/assets/src/ba_data/python/bastd/game/chosenone.py b/assets/src/ba_data/python/bastd/game/chosenone.py index d37cfd7d..ae518606 100644 --- a/assets/src/ba_data/python/bastd/game/chosenone.py +++ b/assets/src/ba_data/python/bastd/game/chosenone.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Provides the chosen-one mini-game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -36,7 +36,7 @@ if TYPE_CHECKING: Union) -# bs_meta export game +# ba_meta export game class ChosenOneGame(ba.TeamGameActivity): """ Game involving trying to remain the one 'chosen one' diff --git a/assets/src/ba_data/python/bastd/game/conquest.py b/assets/src/ba_data/python/bastd/game/conquest.py index b50c6560..6c3c31e1 100644 --- a/assets/src/ba_data/python/bastd/game/conquest.py +++ b/assets/src/ba_data/python/bastd/game/conquest.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Provides the Conquest game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -56,7 +56,7 @@ class ConquestFlag(Flag): return self._team -# bs_meta export game +# ba_meta export game class ConquestGame(ba.TeamGameActivity): """A game where teams try to claim all flags on the map.""" diff --git a/assets/src/ba_data/python/bastd/game/deathmatch.py b/assets/src/ba_data/python/bastd/game/deathmatch.py index f33caca6..aab05b82 100644 --- a/assets/src/ba_data/python/bastd/game/deathmatch.py +++ b/assets/src/ba_data/python/bastd/game/deathmatch.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """DeathMatch game and support classes.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -34,7 +34,7 @@ if TYPE_CHECKING: from typing import Any, Type, List, Dict, Tuple, Union, Sequence -# bs_meta export game +# ba_meta export game class DeathMatchGame(ba.TeamGameActivity): """A game type based on acquiring kills.""" diff --git a/assets/src/ba_data/python/bastd/game/easteregghunt.py b/assets/src/ba_data/python/bastd/game/easteregghunt.py index bed71560..9cd8a7c0 100644 --- a/assets/src/ba_data/python/bastd/game/easteregghunt.py +++ b/assets/src/ba_data/python/bastd/game/easteregghunt.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Provides an easter egg hunt game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -38,7 +38,7 @@ if TYPE_CHECKING: from typing import Any, Type, Dict, List, Tuple, Optional -# bs_meta export game +# ba_meta export game class EasterEggHuntGame(ba.TeamGameActivity): """A game where score is based on collecting eggs""" diff --git a/assets/src/ba_data/python/bastd/game/elimination.py b/assets/src/ba_data/python/bastd/game/elimination.py index cec0d2f8..bca538c3 100644 --- a/assets/src/ba_data/python/bastd/game/elimination.py +++ b/assets/src/ba_data/python/bastd/game/elimination.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Elimination mini-game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -163,7 +163,7 @@ class Icon(ba.Actor): ba.timer(0.6, self.update_for_lives) -# bs_meta export game +# ba_meta export game class EliminationGame(ba.TeamGameActivity): """Game type where last player(s) left alive win.""" diff --git a/assets/src/ba_data/python/bastd/game/football.py b/assets/src/ba_data/python/bastd/game/football.py index 06793e82..c38f9654 100644 --- a/assets/src/ba_data/python/bastd/game/football.py +++ b/assets/src/ba_data/python/bastd/game/football.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Implements football games (both co-op and teams varieties).""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -65,7 +65,7 @@ class FootballFlag(stdflag.Flag): self.node.connectattr('position', self.light, 'position') -# bs_meta export game +# ba_meta export game class FootballTeamGame(ba.TeamGameActivity): """Football game for teams mode.""" diff --git a/assets/src/ba_data/python/bastd/game/hockey.py b/assets/src/ba_data/python/bastd/game/hockey.py index 0bea85e5..1a085841 100644 --- a/assets/src/ba_data/python/bastd/game/hockey.py +++ b/assets/src/ba_data/python/bastd/game/hockey.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Hockey game and support classes.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -105,7 +105,7 @@ class Puck(ba.Actor): super().handlemessage(msg) -# bs_meta export game +# ba_meta export game class HockeyGame(ba.TeamGameActivity): """Ice hockey game.""" diff --git a/assets/src/ba_data/python/bastd/game/keepaway.py b/assets/src/ba_data/python/bastd/game/keepaway.py index 75bb1fbf..368af196 100644 --- a/assets/src/ba_data/python/bastd/game/keepaway.py +++ b/assets/src/ba_data/python/bastd/game/keepaway.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Defines a keep-away game type.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -36,7 +36,7 @@ if TYPE_CHECKING: Union) -# bs_meta export game +# ba_meta export game class KeepAwayGame(ba.TeamGameActivity): """Game where you try to keep the flag away from your enemies.""" diff --git a/assets/src/ba_data/python/bastd/game/kingofthehill.py b/assets/src/ba_data/python/bastd/game/kingofthehill.py index a602a33e..a2b233b3 100644 --- a/assets/src/ba_data/python/bastd/game/kingofthehill.py +++ b/assets/src/ba_data/python/bastd/game/kingofthehill.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Defines the King of the Hill game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -38,7 +38,7 @@ if TYPE_CHECKING: Union) -# bs_meta export game +# ba_meta export game class KingOfTheHillGame(ba.TeamGameActivity): """Game where a team wins by holding a 'hill' for a set amount of time.""" diff --git a/assets/src/ba_data/python/bastd/game/meteorshower.py b/assets/src/ba_data/python/bastd/game/meteorshower.py index 13bf7603..7bea8644 100644 --- a/assets/src/ba_data/python/bastd/game/meteorshower.py +++ b/assets/src/ba_data/python/bastd/game/meteorshower.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Defines a bomb-dodging mini-game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -37,7 +37,7 @@ if TYPE_CHECKING: from bastd.actor.onscreentimer import OnScreenTimer -# bs_meta export game +# ba_meta export game class MeteorShowerGame(ba.TeamGameActivity): """Minigame involving dodging falling bombs.""" diff --git a/assets/src/ba_data/python/bastd/game/ninjafight.py b/assets/src/ba_data/python/bastd/game/ninjafight.py index 300ec46d..9c4eae95 100644 --- a/assets/src/ba_data/python/bastd/game/ninjafight.py +++ b/assets/src/ba_data/python/bastd/game/ninjafight.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Provides Ninja Fight mini-game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -37,7 +37,7 @@ if TYPE_CHECKING: from typing import Any, Type, Dict, List, Optional -# bs_meta export game +# ba_meta export game class NinjaFightGame(ba.TeamGameActivity): """ A co-op game where you try to defeat a group diff --git a/assets/src/ba_data/python/bastd/game/race.py b/assets/src/ba_data/python/bastd/game/race.py index 5429fd46..9590d0e5 100644 --- a/assets/src/ba_data/python/bastd/game/race.py +++ b/assets/src/ba_data/python/bastd/game/race.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Defines Race mini-game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -58,7 +58,7 @@ class RaceRegion(ba.Actor): }) -# bs_meta export game +# ba_meta export game class RaceGame(ba.TeamGameActivity): """Game of racing around a track.""" diff --git a/assets/src/ba_data/python/bastd/game/targetpractice.py b/assets/src/ba_data/python/bastd/game/targetpractice.py index d9d471d5..9e6615c1 100644 --- a/assets/src/ba_data/python/bastd/game/targetpractice.py +++ b/assets/src/ba_data/python/bastd/game/targetpractice.py @@ -20,7 +20,7 @@ # ----------------------------------------------------------------------------- """Implements Target Practice game.""" -# bs_meta require api 6 +# ba_meta require api 6 # (see bombsquadgame.com/apichanges) from __future__ import annotations @@ -37,7 +37,7 @@ if TYPE_CHECKING: from bastd.actor.bomb import Bomb, Blast -# bs_meta export game +# ba_meta export game class TargetPracticeGame(ba.TeamGameActivity): """Game where players try to hit targets with bombs.""" diff --git a/docs/ba_module.md b/docs/ba_module.md index c8fba124..6c958fcd 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,6 +1,6 @@ - -

last updated on 2020-03-12 for Ballistica version 1.5.0 build 20001

+ +

last updated on 2020-03-20 for Ballistica version 1.5.0 build 20001

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


diff --git a/tools/efrotools/pybuild.py b/tools/efrotools/pybuild.py index 3d624248..31b3be0d 100644 --- a/tools/efrotools/pybuild.py +++ b/tools/efrotools/pybuild.py @@ -223,19 +223,11 @@ def build_android(rootdir: str, arch: str, debug: bool = False) -> None: os.environ['PATH'] += (':' + appathout) print(f'ADDED "{appathout}" TO SYS PATH...') - # Commit from Dec 6th, 2018. Looks like right after this one the repo - # switched to ndk r19 beta 2 and now seems to require r19, so we can - # try switching back to master one r19 comes down the pipe. - # noinspection PyUnreachableCode - if False: # pylint: disable=using-constant-test - efrotools.run('git checkout eb587c52db349fecfc4666c6bf7e077352513035') - - # Commit from ~March 14 2019. Looks like right after this the project - # switched to compiling python as a shared library which would be a pretty - # big change. - # noinspection PyUnreachableCode - if False: # pylint: disable=using-constant-test - efrotools.run('git checkout b3024bf350fd5134542ee974a9a28921a687a8a0') + # Commit from Jan 8, 2020. Right after this, the build system was switched + # a a completely new minimal one which will take some work to update here. + # Punting on that for now... + if True: # pylint: disable=using-constant-test + efrotools.run('git checkout 9adbcfaca37f40b7a86381f83f0f6af4187233ae') ftxt = efrotools.readfile('pybuild/env.py') # Set the packages we build.