diff --git a/.efrocachemap b/.efrocachemap index fc567c7c..a3e05fad 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3966,26 +3966,26 @@ "assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e", "assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/72/82/86956fae909ac2fe2a1abd84a361", "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", - "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/88/d6/2de73f757e3bdbfeaec03f563c8a", + "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5a/bd/c4f53db2e9c242c3ec20ea993d0c", "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/74/1d/fc9e33e565475daaac80da5252f0", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/09/93/182c306fdfe104a925794984a763", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c1/43/f37d6f9200d7c72d06ad158e6a6b", - "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/db/dd/51cd186c11c6399c8e39c306652b", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d5/ec/fc764a22eecbe3d9718a7f74f445", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/13/58/58ef70e856ea2b396a337ad6a6ec", + "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/6d/4a/9ba90e9fd61755076d5fbcb58ae3", "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/7b/ac1a200be0f37078af0991faca3b", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/94/5f/f596a1c6ec46b059997038b2ad98", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/36/4b/54a3508504842e449bc4632facc7", - "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ad/6a/39489935b6d36077d0180d365f65", - "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1c/30/37cb8de37563ece076f3df06407e", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/61/d5/8d839aa2b10e2c267c661f22f131", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/92/db/36e17bb4062382cd0d07818415d1", - "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f1/39/d44269765fa93903c0b8896b4f62", - "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f2/e3/64b2d15ae4c8f2d060f0ac782512", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/48/10/c493cee7128f6c5caa0c450df55d", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/68/2c/c65363cd1d7dd78f425fd9586258", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/b5/7c/ccec2d40ddafa91261b086d1173c", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/78/f4/3356065ce9b87d87fbd29acd8cac", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/b7/9b/e3f766f96f89650642a5ddc6a4ea", - "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/20/13/4b60da93efe23ac4c7cf9a350bc7", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/55/d2/4567b7d25fe0a029d32768bd46af", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8b/e0/ecbdbf83e5a7616badddfe77f18f", + "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d6/63/7efe2c4dbeaf51d8a82db50a57fe", + "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ef/2a/69c1beeac35c146d64114c08e91e", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/09/cb/4817cd1ac9cc3f531880ac94ca50", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5e/5f/06e653fe68ae2c2e0854049bc82d", + "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/98/91/df35b46c01a9b41c711119804803", + "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9b/32/302e9723c2a9639c2535f9c5a4ea", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/dc/80/0586887648abd48e1ad560f29b38", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c0/91/0146b1d2b7d37164e70587320f75", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c8/28/adc7da698869a06ed823e5db852b", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/2c/2b/95ea5843e16a38e454140d9645bb", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/fa/55/d98fc407a25d56e3248c7fd0d582", + "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/79/87/02fd242badf5b6a3e108624522db", "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5f/7c/427e8a1af1c95bf40211adb1a10e", "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5e/fe/0366d7ace626419f14c2bd80e266", "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9b/2c/7be9dce2d9aff8cf04508d07dff0", @@ -4002,14 +4002,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/66/bb/3f0591d11d845c285ceb0e322121", "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/81/a4/21f0084dde2fc524b4683b5efed0", "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9f/03/dbe0091c812e01eb84b66de55b36", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/6a/c2/6784b83d7cc684260cf162fbee4c", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/28/1e/781487d4d6464f27a43b3bb1c2f4", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/38/1a/a53ba81dd431860600bc5c21e0fa", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/f8/6f/0d0cf942205991c889722a116aab", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/65/c8/47bc70c1b14593f5928d5d2c2b90", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/ef/01/0bd5c7939ae809ddf0334927d24e", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/90/dc/491604fafce64d74578ab8f49f7b", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/12/2d/96d202ba712d4efdcb61591e6e40", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/d9/52/cdf3f127aba14e60602cc69c9276", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/04/c9/aacaa7d3bd8a8bc2241134ed0260", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/fe/ea/eb5e2898022397cb0e4767ac7750", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/3c/e1/79d74d48c4ba188fca80a1911bed", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/89/85/396c695524487fc4617051a1068f", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/62/ff/49923c4896cde6c1ade47f98c79c", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/db/0b/8f5e7a6bbdedde91e4b02d4b9e4e", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/bb/0b/6133175db0936836a527b1ebddb1", "src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/f2/6c/5a0a4695dcc2a11e7941b8777e80", "src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/65/ac/d5c4162a71028c1bfa73ebc1f881" } \ No newline at end of file diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index eec6298a..b5a502f7 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -940,6 +940,7 @@ getlevels getlocalconfig getlog + getlogin getmaps getmodel getname @@ -1744,6 +1745,7 @@ prch prec precommand + preconfig preexec prefablib preflightfast @@ -2382,6 +2384,7 @@ touchpad tournamententry tournamentscores + tpartial tpimport tpimportex tpimports diff --git a/assets/src/ba_data/python/bastd/actor/spawner.py b/assets/src/ba_data/python/bastd/actor/spawner.py index e40d1866..b1ed9c11 100644 --- a/assets/src/ba_data/python/bastd/actor/spawner.py +++ b/assets/src/ba_data/python/bastd/actor/spawner.py @@ -39,18 +39,24 @@ class Spawner: The spawn position. """ - def __init__(self, spawner: Spawner, data: Any, pt: Sequence[float]): + def __init__( + self, + spawner: Spawner, + data: Any, + pt: Sequence[float], # pylint: disable=invalid-name + ): """Instantiate with the given values.""" self.spawner = spawner self.data = data self.pt = pt # pylint: disable=invalid-name - def __init__(self, - data: Any = None, - pt: Sequence[float] = (0, 0, 0), - spawn_time: float = 1.0, - send_spawn_message: bool = True, - spawn_callback: Callable[[], Any] = None): + def __init__( + self, + data: Any = None, + pt: Sequence[float] = (0, 0, 0), # pylint: disable=invalid-name + spawn_time: float = 1.0, + send_spawn_message: bool = True, + spawn_callback: Callable[[], Any] = None): """Instantiate a Spawner. Requires some custom data, a position, diff --git a/ballisticacore-cmake/.idea/dictionaries/ericf.xml b/ballisticacore-cmake/.idea/dictionaries/ericf.xml index 8da45e13..3d773165 100644 --- a/ballisticacore-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticacore-cmake/.idea/dictionaries/ericf.xml @@ -439,6 +439,7 @@ getinputdevice getline getlog + getlogin getmodel getname getnodes @@ -820,6 +821,7 @@ ppre pptabcom precalc + preconfig predeclare prefs preloaded @@ -1100,6 +1102,7 @@ touchpad toucs toutf + tpartial tpimport tpimportex tpimports diff --git a/docs/ba_module.md b/docs/ba_module.md index 2287f607..32679699 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2021-11-04 for Ballistica version 1.6.6 build 20406

+

last updated on 2021-11-26 for Ballistica version 1.6.6 build 20410

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/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index f215e8ab..f261b69c 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't modify them here. -const int kAppBuildNumber = 20408; +const int kAppBuildNumber = 20410; const char* kAppVersion = "1.6.6"; // Our standalone globals. diff --git a/tools/batools/build.py b/tools/batools/build.py index 2d61119b..0508bd22 100644 --- a/tools/batools/build.py +++ b/tools/batools/build.py @@ -31,7 +31,7 @@ class PipRequirement: # Note: we look directly for modules when possible instead of just pip # entries; this accounts for manual installations or other nonstandard setups. PIP_REQUIREMENTS = [ - PipRequirement(modulename='pylint', minversion=[2, 11, 1]), + PipRequirement(modulename='pylint', minversion=[2, 12, 1]), PipRequirement(modulename='mypy', minversion=[0, 910]), PipRequirement(modulename='yapf', minversion=[0, 31, 0]), PipRequirement(modulename='cpplint', minversion=[1, 5, 5]), diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 7e840575..1fc9df2e 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -571,8 +571,8 @@ class Generator: getattr(cls, name) for name in dir(cls) if any(isinstance(getattr(cls, name), t) for t in method_types) and ( - not name.startswith('_') or name == '__init__') - and '_no_init' not in name + not name.startswith('_') or name == '__init__') and + '_no_init' not in name and '_no_init_or_replace_init' not in name ] methods: list[FunctionInfo] = [] @@ -580,7 +580,7 @@ class Generator: for mth in methods_raw: # Protocols seem to give this... - if mth.__name__ == '_no_init': + if mth.__name__ in {'_no_init', '_no_init_or_replace_init'}: continue # Keep a list of inherited methods but don't do a full diff --git a/tools/efro/call.py b/tools/efro/call.py index 1ea3d98f..9087a0f7 100644 --- a/tools/efro/call.py +++ b/tools/efro/call.py @@ -266,8 +266,9 @@ if TYPE_CHECKING: def Call(*_args: Any, **_keywds: Any) -> Any: ... + # (Type-safe Partial) # A convenient wrapper around functools.partial which adds type-safety # (though it does not support keyword arguments). - partial = Call + tpartial = Call else: - partial = functools.partial + tpartial = functools.partial diff --git a/tools/efro/terminal.py b/tools/efro/terminal.py index cd064090..d0351d54 100644 --- a/tools/efro/terminal.py +++ b/tools/efro/terminal.py @@ -75,6 +75,10 @@ def _default_color_enabled() -> bool: if not sys.__stdout__.isatty(): return False + # Another common way to say the terminal can't do fancy stuff like color: + if os.environ.get('TERM') == 'dumb': + return False + # On windows, try to enable ANSI color mode. if platform.system() == 'Windows': return _windows_enable_color() diff --git a/tools/efro/util.py b/tools/efro/util.py index 285505f0..147b18c8 100644 --- a/tools/efro/util.py +++ b/tools/efro/util.py @@ -14,7 +14,7 @@ from typing import TYPE_CHECKING, cast, TypeVar, Generic if TYPE_CHECKING: import asyncio from efro.call import Call as Call # 'as Call' so we re-export. - from typing import Any, Callable, Optional + from typing import Any, Callable, Optional, NoReturn T = TypeVar('T') TVAL = TypeVar('TVAL') @@ -604,3 +604,11 @@ def compact_id(num: int) -> str: return _compact_id( num, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz') + + +def assert_never(value: NoReturn) -> NoReturn: + """Trick for checking exhaustive handling of Enums, etc. + + See https://github.com/python/typing/issues/735 + """ + assert False, f'Unhandled value: {value} ({type(value).__name__})' diff --git a/tools/efrotools/code.py b/tools/efrotools/code.py index 92ec456d..e6b31aaf 100644 --- a/tools/efrotools/code.py +++ b/tools/efrotools/code.py @@ -432,7 +432,7 @@ def _apply_pylint_run_to_cache(projroot: Path, run: Any, dirtyfiles: list[str], # If there's any cyclic-import errors, just mark all deps as dirty; # don't want to add the logic to figure out which ones the cycles cover # since they all seems to appear as errors for the last file in the list. - cycles: int = run.linter.stats.get('by_msg', {}).get('cyclic-import', 0) + cycles: int = run.linter.stats.by_msg.get('cyclic-import', 0) have_dep_cycles: bool = cycles > 0 if have_dep_cycles: print(f'Found {cycles} cycle-errors; keeping all dirty files dirty.') @@ -444,7 +444,7 @@ def _apply_pylint_run_to_cache(projroot: Path, run: Any, dirtyfiles: list[str], reversedeps = {} # Make sure these are all proper module names; no foo.bar.__init__ stuff. - for key, val in run.linter.stats['dependencies'].items(): + for key, val in run.linter.stats.dependencies.items(): sval = [_filter_module_name(m) for m in val] reversedeps[_filter_module_name(key)] = sval deps: dict[str, set[str]] = {} @@ -519,7 +519,7 @@ def _apply_pylint_run_to_cache(projroot: Path, run: Any, dirtyfiles: list[str], # Once again need to convert any foo.bar.__init__ to foo.bar. stats_by_module: dict[str, Any] = { _filter_module_name(key): val - for key, val in run.linter.stats['by_module'].items() + for key, val in run.linter.stats.by_module.items() } errcount = 0