From 43788993e68418fcccdacb82a6b8a1bf79090e46 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Wed, 22 Sep 2021 12:44:36 -0500 Subject: [PATCH] added send_untyped() and send_async_untyped() to messaging system --- .efrocachemap | 4 ++-- docs/ba_module.md | 2 +- tools/efro/message.py | 18 +++++++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 0564d36d..52eaab7a 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -420,7 +420,7 @@ "assets/build/ba_data/audio/zoeOw.ogg": "https://files.ballistica.net/cache/ba1/14/f1/4f2995d78fc20dd79dfb39c5d554", "assets/build/ba_data/audio/zoePickup01.ogg": "https://files.ballistica.net/cache/ba1/57/ac/6ed0caecd25dc23688debed24c45", "assets/build/ba_data/audio/zoeScream01.ogg": "https://files.ballistica.net/cache/ba1/32/08/38dac4a79ab2acee76a75d32a310", - "assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/92/29/7452e88375b37e2e73929106d520", + "assets/build/ba_data/data/langdata.json": "https://files.ballistica.net/cache/ba1/1f/21/0f8b5de13f6bd5fb1e13564d7c58", "assets/build/ba_data/data/languages/arabic.json": "https://files.ballistica.net/cache/ba1/0f/0e/7184059414320d32104463e41038", "assets/build/ba_data/data/languages/belarussian.json": "https://files.ballistica.net/cache/ba1/e2/58/c2c5964370df118c51528dc4bfa2", "assets/build/ba_data/data/languages/chinese.json": "https://files.ballistica.net/cache/ba1/28/96/397e5c164a595c2b6c2d3eb2d4f1", @@ -450,7 +450,7 @@ "assets/build/ba_data/data/languages/spanish.json": "https://files.ballistica.net/cache/ba1/bc/71/83c7c31a4f6467ed2ec8b86a4b71", "assets/build/ba_data/data/languages/swedish.json": "https://files.ballistica.net/cache/ba1/50/9f/be006ba19be6a69a57837eb6dca0", "assets/build/ba_data/data/languages/thai.json": "https://files.ballistica.net/cache/ba1/dd/de/c197fa9aff42e4422bc66b95ad88", - "assets/build/ba_data/data/languages/turkish.json": "https://files.ballistica.net/cache/ba1/a4/d9/93b754bae8c86791f6d8d3b600e1", + "assets/build/ba_data/data/languages/turkish.json": "https://files.ballistica.net/cache/ba1/65/e4/b9308f15437972209b4d3fce7abd", "assets/build/ba_data/data/languages/ukrainian.json": "https://files.ballistica.net/cache/ba1/c3/61/d5bcf2bcad50104b26d22d3365a4", "assets/build/ba_data/data/languages/venetian.json": "https://files.ballistica.net/cache/ba1/4b/da/7e444f86c768aee70779a0f7a28f", "assets/build/ba_data/data/languages/vietnamese.json": "https://files.ballistica.net/cache/ba1/8b/65/adfbe450da3f61677bd909fff707", diff --git a/docs/ba_module.md b/docs/ba_module.md index fdfc7837..28ec2ada 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2021-09-21 for Ballistica version 1.6.5 build 20393

+

last updated on 2021-09-22 for Ballistica version 1.6.5 build 20393

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/efro/message.py b/tools/efro/message.py index f7b1a57f..ee335c95 100644 --- a/tools/efro/message.py +++ b/tools/efro/message.py @@ -64,7 +64,7 @@ class ErrorResponse(Response): instead results in a local exception being raised. """ error_message: Annotated[str, IOAttrs('m')] - error_type: Annotated[ErrorType, IOAttrs('t')] + error_type: Annotated[ErrorType, IOAttrs('e')] @ioprepped @@ -581,6 +581,22 @@ class BoundMessageSender: """Protocol associated with this sender.""" return self._sender.protocol + def send_untyped(self, message: Message) -> Optional[Response]: + """Send a message synchronously. + + Whenever possible, use the send() call provided by generated + subclasses instead of this; it will provide better type safety. + """ + return self._sender.send(self._obj, message) + + async def send_async_untyped(self, message: Message) -> Optional[Response]: + """Send a message asynchronously. + + Whenever possible, use the send_async() call provided by generated + subclasses instead of this; it will provide better type safety. + """ + return await self._sender.send_async(self._obj, message) + class MessageReceiver: """Facilitates receiving & responding to messages from a remote source.