From f928e80d7826a6a32027be8e9541f9ab2e1725bf Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Thu, 16 Jul 2020 16:05:26 -0700 Subject: [PATCH] Tidying --- .efrocachemap | 24 +++++++++---------- .idea/dictionaries/ericf.xml | 1 + assets/src/ba_data/python/_ba.py | 2 +- assets/src/ba_data/python/ba/_hooks.py | 9 ++++--- .../src/ba_data/python/bastd/ui/mainmenu.py | 4 ++++ docs/ba_module.md | 4 ++-- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 0a2147eb..a52dc74f 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4135,16 +4135,16 @@ "assets/build/windows/x64/vc_redist.x64.exe": "https://files.ballistica.net/cache/ba1/ea/19/8b8787d81abcdce158ba608cd24f", "assets/build/windows/x64/vcruntime140_1d.dll": "https://files.ballistica.net/cache/ba1/11/d8/ff6344b429b00c24d9a1930d4338", "assets/build/windows/x64/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/20/33/0825e11e6518f87ece3009309933", - "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2f/d2/729e7d4c7e884bcdc6749a52c069", - "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b8/45/60a8069130b52e85422236921806", - "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/80/84/06b8fd82adb7a10dfc2c5a6b622b", - "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/54/fa/b6d33c93285c9d686bf455374ce3", - "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/bf/db/d010f67fb908315d89e7a0e38fb7", - "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6a/34/66068c15c8e349743d82be4b0e98", - "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e2/03/89949b43cdf17f571e549a85e439", - "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d1/a0/5ffc17a4b0c4c93ee3de59a1597b", - "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/87/17/e01ce11e3c4869da04e0a8824ee8", - "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/8f/30/dc9361159cb9b1c735e8957a0a66", - "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/07/c2/fbed8e21c1b973f9b30267b49386", - "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a3/2f/04346dd3c73a959eef8d59c43991" + "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/99/82/fccd083509e35606a05e8f4be12b", + "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2d/db/1ba0b8fda62bb9673ae9a2d72263", + "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f6/c5/1d925d0f72e30e745db0c69f3492", + "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1f/a3/c2a5a5ac6b9e0756d5acc7872cd2", + "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8d/68/1b60db385be21968a1e62c0d8909", + "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1d/02/9eeac67f0678cdab9ee567975d46", + "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/3d/4d/fddd748467190c6a6b90f7c428ac", + "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/da/ab/18a3841614075e089a7c3fe1a352", + "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/d8/70/4b2203294c25113fe81e316b63f2", + "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/6c/d9/3d25b18546efcdafc10107b0c970", + "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/77/58/4cfb2e7779068f1d0edbaa521e8f", + "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/4b/45/4ebd1210c99b29c76c73228c3406" } \ No newline at end of file diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 075831cb..5b2a603d 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -202,6 +202,7 @@ bombsquadgame bools bootlocale + borhani botdist botlist botpos diff --git a/assets/src/ba_data/python/_ba.py b/assets/src/ba_data/python/_ba.py index ca9209ab..45a72cb6 100644 --- a/assets/src/ba_data/python/_ba.py +++ b/assets/src/ba_data/python/_ba.py @@ -1761,7 +1761,7 @@ def disconnect_from_host() -> None: def do_once() -> bool: """do_once() -> bool - Register a call at a location and return whether one already happened. + Return whether this is the first time running a line of code. Category: General Utility Functions diff --git a/assets/src/ba_data/python/ba/_hooks.py b/assets/src/ba_data/python/ba/_hooks.py index 0c5e95c0..0f45ad13 100644 --- a/assets/src/ba_data/python/ba/_hooks.py +++ b/assets/src/ba_data/python/ba/_hooks.py @@ -269,9 +269,12 @@ 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'), - color=(1, 0, 0)) - _ba.playsound(_ba.getsound('error')) + + # Can be called without a context; need a context for getsound. + with _ba.Context('ui'): + _ba.screenmessage(Lstr(resource='internal.controllerForMenusOnlyText'), + color=(1, 0, 0)) + _ba.playsound(_ba.getsound('error')) def quit_window() -> None: diff --git a/assets/src/ba_data/python/bastd/ui/mainmenu.py b/assets/src/ba_data/python/bastd/ui/mainmenu.py index 292b4171..f021f9da 100644 --- a/assets/src/ba_data/python/bastd/ui/mainmenu.py +++ b/assets/src/ba_data/python/bastd/ui/mainmenu.py @@ -824,6 +824,10 @@ class MainMenuWindow(ba.Window): return h, v, scale def _change_replay_speed(self, offs: int) -> None: + if not self._replay_speed_text: + if ba.do_once(): + print('_change_replay_speed called without widget') + return _ba.set_replay_speed_exponent(_ba.get_replay_speed_exponent() + offs) actual_speed = pow(2.0, _ba.get_replay_speed_exponent()) ba.textwidget(edit=self._replay_speed_text, diff --git a/docs/ba_module.md b/docs/ba_module.md index 6173809a..50fa5e0b 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-07-15 for Ballistica version 1.5.22 build 20140

+

last updated on 2020-07-16 for Ballistica version 1.5.22 build 20144

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!


@@ -6127,7 +6127,7 @@ are applied to the Widget.

ba.do_once()

do_once() -> bool

-

Register a call at a location and return whether one already happened.

+

Return whether this is the first time running a line of code.

Category: General Utility Functions