From e0c827cd0ecf940c901fef2c7e0bf5331d464168 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Mon, 1 Jun 2020 18:12:44 -0700 Subject: [PATCH] Added server admin functionality. --- .efrocachemap | 36 ++++++++++----------- .idea/dictionaries/ericf.xml | 1 + assets/src/ba_data/python/_ba.py | 18 ++++++++++- assets/src/ba_data/python/ba/_servermode.py | 6 ++++ docs/ba_module.md | 2 +- tools/snippets | 4 +-- 6 files changed, 45 insertions(+), 22 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index ce583a6d..c6f8425d 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -420,24 +420,24 @@ "assets/build/ba_data/audio/zoeOw.ogg": "https://files.ballistica.net/cache/ba1/75/1d/868bb04cf691736035c917d02762", "assets/build/ba_data/audio/zoePickup01.ogg": "https://files.ballistica.net/cache/ba1/44/2a/8535b446284235cb503947ece074", "assets/build/ba_data/audio/zoeScream01.ogg": "https://files.ballistica.net/cache/ba1/f5/d3/8e941851c4310465646c4167afc1", - "assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/da/06/8e06488b46a0a213abde3cfeb364", + "assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/98/6d/e6de20b119fd6a5914982cd468b6", "assets/build/ba_data/data/languages/arabic.json": "https://files.ballistica.net/cache/ba1/b8/ed/e18bec56ff1d094aae86517a7854", "assets/build/ba_data/data/languages/belarussian.json": "https://files.ballistica.net/cache/ba1/49/5f/b29bb65369040892fe6601801637", - "assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/0c/cd/798753aa6c55f3a4cdccda0b23ab", + "assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/15/1b/3e0690b975c7cafbfa65e3aafad3", "assets/build/ba_data/data/languages/chinesetraditional.json": "https://files.ballistica.net/cache/ba1/aa/91/2411c0728bae33619c21237a2689", "assets/build/ba_data/data/languages/croatian.json": "https://files.ballistica.net/cache/ba1/bb/9c/360fc084e6254a087096993af219", "assets/build/ba_data/data/languages/czech.json": "https://files.ballistica.net/cache/ba1/f2/90/62968ad28a2499a8d182a5740a85", "assets/build/ba_data/data/languages/danish.json": "https://files.ballistica.net/cache/ba1/3f/46/e4da3c1d2b0ebf916df55c608b28", "assets/build/ba_data/data/languages/dutch.json": "https://files.ballistica.net/cache/ba1/5b/a3/a46a77f0cc498e1f1e369d772414", - "assets/build/ba_data/data/languages/english.json": "https://files.ballistica.net/cache/ba1/94/bb/79fd4608f4a3e22526442ba77090", + "assets/build/ba_data/data/languages/english.json": "https://files.ballistica.net/cache/ba1/b4/fe/f33399347c16a13f17e920c7e33c", "assets/build/ba_data/data/languages/esperanto.json": "https://files.ballistica.net/cache/ba1/6e/fd/685a4e1da031474d47a1d9eb2731", "assets/build/ba_data/data/languages/french.json": "https://files.ballistica.net/cache/ba1/95/9b/66e9080c82ef76387832dedee9b4", "assets/build/ba_data/data/languages/german.json": "https://files.ballistica.net/cache/ba1/9d/00/a8c4ef9f0a25e789c046bd741203", - "assets/build/ba_data/data/languages/gibberish.json": "https://files.ballistica.net/cache/ba1/d7/54/541b617f3c00e3914ee5faef9d10", + "assets/build/ba_data/data/languages/gibberish.json": "https://files.ballistica.net/cache/ba1/e7/ff/638467708af1e2eea569e9225906", "assets/build/ba_data/data/languages/greek.json": "https://files.ballistica.net/cache/ba1/17/78/3fd0dca40e632ce53d03a944e7fa", "assets/build/ba_data/data/languages/hindi.json": "https://files.ballistica.net/cache/ba1/7a/64/04464dc6ee8a45632857fa436bff", "assets/build/ba_data/data/languages/hungarian.json": "https://files.ballistica.net/cache/ba1/4d/4b/0790110201c9adb1b521e9a55e63", - "assets/build/ba_data/data/languages/indonesian.json": "https://files.ballistica.net/cache/ba1/4f/1e/334843131d672fa6b5f6f1056e56", + "assets/build/ba_data/data/languages/indonesian.json": "https://files.ballistica.net/cache/ba1/8e/e7/38e093014a917418e6cf7aa9315d", "assets/build/ba_data/data/languages/italian.json": "https://files.ballistica.net/cache/ba1/a5/05/fbdf4d90b85609e4fa258e1ce814", "assets/build/ba_data/data/languages/korean.json": "https://files.ballistica.net/cache/ba1/0a/84/bbb6ed2abf66509406f534cbbb52", "assets/build/ba_data/data/languages/persian.json": "https://files.ballistica.net/cache/ba1/c2/fc/dd1c15cf9ecb411d9defbd000c06", @@ -447,7 +447,7 @@ "assets/build/ba_data/data/languages/russian.json": "https://files.ballistica.net/cache/ba1/78/5e/d24967ddaa15e0a574bd274544db", "assets/build/ba_data/data/languages/serbian.json": "https://files.ballistica.net/cache/ba1/e7/d8/ace32888249fc8b8cca0e2edb48b", "assets/build/ba_data/data/languages/slovak.json": "https://files.ballistica.net/cache/ba1/b7/0a/fab820b96e7aa587ee56427ecdc2", - "assets/build/ba_data/data/languages/spanish.json": "https://files.ballistica.net/cache/ba1/bf/1f/f9f707434db43126746a5be6e878", + "assets/build/ba_data/data/languages/spanish.json": "https://files.ballistica.net/cache/ba1/90/d9/0f8f5b03bbe2dfebfb544cee6bd6", "assets/build/ba_data/data/languages/swedish.json": "https://files.ballistica.net/cache/ba1/50/9f/be006ba19be6a69a57837eb6dca0", "assets/build/ba_data/data/languages/turkish.json": "https://files.ballistica.net/cache/ba1/b6/c9/999c95ff8d917126352a306d89a3", "assets/build/ba_data/data/languages/ukrainian.json": "https://files.ballistica.net/cache/ba1/e0/f7/f6daa488dc29e303dea69aae864b", @@ -4132,16 +4132,16 @@ "assets/build/windows/x64/python.exe": "https://files.ballistica.net/cache/ba1/25/a7/dc87c1be41605eb6fefd0145144c", "assets/build/windows/x64/python37.dll": "https://files.ballistica.net/cache/ba1/b9/e4/d912f56e42e9991bcbb4c804cfcb", "assets/build/windows/x64/pythonw.exe": "https://files.ballistica.net/cache/ba1/6c/bb/b6f52c306aa4e88061510e96cefe", - "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1e/d6/ebdfb7bda48f2dec85c5df52ced9", - "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4a/0e/d344541dc2ae2a6eaf1024c99f7c", - "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/68/c3/fe2482149437800c83fed338140e", - "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/74/00/78f77d5ab9cc74a2f624f3a7253b", - "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ea/d1/017aaa42a7ace25a7b1f782632e5", - "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4f/b3/b149964180b661161e5f86109d99", - "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/7c/97/177b59dcf24b839ca2d932200bb8", - "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d8/55/9edbc1eea06cf354fe37b50d68d2", - "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/fc/ec/eb46555d63e5e3fd55497d1c1079", - "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/71/73/b8d329287a0a46cc8ed2ef08a7d9", - "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/62/79/66fc05a4388c4b5a9e9a7fd68a46", - "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c3/5d/eb6c20729c0572e717c907482205" + "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/96/a0/04fd3bb8245edd1d4e5845cc4629", + "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6e/7e/82399a3b10f5a9d73a76c1cfb16e", + "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/30/f0/cfd79764333c0282c8ffdec3c942", + "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/02/51/5ac1a2bc29cf8639ba65629fa009", + "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5c/ff/e78f3f17b45eea5d0359e68c311a", + "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/53/bf/dade39164bd18003c8bd51b05119", + "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/7c/7e/30bfdd3a09b468014a4cde5cf3b7", + "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7a/cf/b25179f9e1db8b6b774ba6a31e82", + "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/71/fd/90b17177aee6354de45cc205f65c", + "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/c2/ac/d87356932ec11dc4bac0d988145e", + "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ce/7b/6ec6f8b2da73e1b2b64b64192712", + "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/78/78/3639288018f221c9e978f391abd8" } \ No newline at end of file diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index cc614da7..58339e57 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -2045,6 +2045,7 @@ vartype vcxproj venv + verlines versioning versionpredicate vert diff --git a/assets/src/ba_data/python/_ba.py b/assets/src/ba_data/python/_ba.py index e85e61f2..f33fbb95 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=172645630847706592745162067676099526148 +# SOURCES_HASH=247084187994045015646460724420234222242 # I'm sorry Pylint. I know this file saddens you. Be strong. # pylint: disable=useless-suppression @@ -3347,6 +3347,14 @@ def scrollwidget(edit: ba.Widget = None, return ba.Widget() +def set_admins(admins: List[str]) -> None: + """set_admins(admins: List[str]) -> None + + (internal) + """ + return None + + def set_analytics_screen(screen: str) -> None: """set_analytics_screen(screen: str) -> None @@ -3379,6 +3387,14 @@ def set_debug_speed_exponent(speed: int) -> None: return None +def set_enable_default_kick_voting(enable: bool) -> None: + """set_enable_default_kick_voting(enable: bool) -> None + + (internal) + """ + return None + + def set_have_mods(have_mods: bool) -> None: """set_have_mods(have_mods: bool) -> None diff --git a/assets/src/ba_data/python/ba/_servermode.py b/assets/src/ba_data/python/ba/_servermode.py index 0ffd8fa8..882aa6ac 100644 --- a/assets/src/ba_data/python/ba/_servermode.py +++ b/assets/src/ba_data/python/ba/_servermode.py @@ -65,6 +65,7 @@ def _cmd(command_data: bytes) -> None: if isinstance(command, ScreenMessageCommand): assert _ba.app.server is not None + # Note: we have to do transient messages if # clients is specified, so they won't show up # in replays. @@ -241,6 +242,7 @@ class ServerController: f' joinable from the internet.{poststr}{Clr.RST}') def _prepare_to_serve(self) -> None: + """Run in a timer to do prep before beginning to serve.""" signed_in = _ba.get_account_state() == 'signed_in' if not signed_in: @@ -339,6 +341,10 @@ class ServerController: _ba.set_authenticate_clients(self._config.authenticate_clients) + _ba.set_enable_default_kick_voting( + self._config.enable_default_kick_voting) + _ba.set_admins(self._config.admins) + # Call set-enabled last (will push state to the cloud). _ba.set_public_party_max_size(self._config.max_party_size) _ba.set_public_party_name(self._config.party_name) diff --git a/docs/ba_module.md b/docs/ba_module.md index 79375f9e..34fb6596 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-06-01 for Ballistica version 1.5.0 build 20037

+

last updated on 2020-06-01 for Ballistica version 1.5.0 build 20039

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/snippets b/tools/snippets index 09733841..2a052e4b 100755 --- a/tools/snippets +++ b/tools/snippets @@ -113,9 +113,9 @@ def resize_image() -> None: src = sys.argv[4] dst = sys.argv[5] if not dst.endswith('.png'): - raise Exception('dst must be a png') + raise RuntimeError(f'dst must be a png; got "{dst}"') if not src.endswith('.png'): - raise Exception('src must be a png') + raise RuntimeError(f'src must be a png; got "{src}"') print('Creating: ' + os.path.basename(dst), file=sys.stderr) efrotools.run(f'convert "{src}" -resize {width}x{height} "{dst}"')