From 7b73f28862f8bdf68d47bf0032d6495035bf9f12 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 16 Jun 2023 10:23:40 -0700 Subject: [PATCH] renamed bascenev1's screenmessage to broadcastmessage to differentiate it from local-only screenmessage --- .efrocachemap | 56 +++++++++---------- .idea/dictionaries/ericf.xml | 1 + CHANGELOG.md | 11 +++- .../.idea/dictionaries/ericf.xml | 1 + .../ba_data/python/baclassic/_servermode.py | 2 +- src/assets/ba_data/python/baenv.py | 2 +- .../ba_data/python/bascenev1/__init__.py | 6 +- .../ba_data/python/bascenev1/_gameactivity.py | 3 +- .../ba_data/python/bascenev1/_session.py | 8 +-- src/assets/ba_data/python/bascenev1/_stats.py | 10 ++-- .../ba_data/python/bascenev1lib/actor/spaz.py | 4 +- .../ba_data/python/bascenev1lib/game/race.py | 4 +- .../ba_data/python/bascenev1lib/tutorial.py | 2 +- .../python/methods/python_methods_graphics.cc | 32 ++++++++++- src/ballistica/base/support/context.h | 15 ----- .../python/methods/python_methods_scene.cc | 19 ++++--- src/ballistica/shared/ballistica.cc | 2 +- 17 files changed, 103 insertions(+), 75 deletions(-) diff --git a/.efrocachemap b/.efrocachemap index 9e3b052f..a0c79555 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4072,26 +4072,26 @@ "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/18/4b/787a9267e17be3c49966072581a5", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/20/f6/4ce9bc3c1f3732f6adf8237fbe9b", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/a5/30/9058181df0b1255bf6950cbc7813", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/98/3d/59c2774d92c554917bdbd9edb743", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/19/f6/8953c543e33d3f09fbd5b7c34eba", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/2b/46/66ec5b8877329621369e74fc1c50", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/09/eb/97daa4a4840c83f0e9862e3e7fb5", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/c8/e7/c70e60b2b59821119d12120eb104", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/ee/79/a5b6790b4d224325d8ba4a4cdc78", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/fc/cd/f1ce0b65bec1ef59aae8db3dfe04", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d6/59/78a04deb39a2242277f8f337c787", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/93/53/3503a8386b4c732003d32f89827b", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/15/a3/7bf99f886870865cc6932415d2ef", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d6/22/78303e63ad4954ca5b58f5a25c7f", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/09/1b/7bbb9bfc39329265c3e5741d8194", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/23/21/33f75e30409b0aaf6e29ea104d11", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/80/bb/0cd610d2073e45bdaad5ee553859", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/92/19/6288c866d989b27adda46771f0e3", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b4/eb/bd01bf247b58405e0a1810c315f7", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/8f/6d/0908960ed304d38cb743e090a9af", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/1f/7c/f3310f6ac02db02a883893bfd6d2", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/15/ea/3b3b51407118ef827ccd28d86540", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/89/e3/037522509a9c638209809fbe09d4", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1f/1b/b04b31054b65e8bfdc40534d452d", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e6/34/ff4ce608cddf75f01c7eff1d21e1", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/1f/0c/3a98c68eaf81fac66ae5bcc78236", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/23/5e/bfff34c598b06e86199fecb404c0", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a4/6c/c67786baba022816883f6095f0ca", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/2a/92/5ee2257569d5000a11c48ec666e0", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/f4/b9/70fdee7e0058f90cbd001051187d", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/df/8e/3402bd0d7b9a30941c2a76920a1c", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/27/d6/5d60019a10d5fc40d6b26b53dba0", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/20/48/d088312af59adeb596db8196d8a9", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/5a/73/d4bbe844928c71aece7779fbf0ef", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/79/a5/cb9984a630f18d9d43be72ea22fd", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/8a/fa/babadd97a86a505a38abc8e71f81", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/a4/4d/eb069364cb2ced2ba4bab9dc9e94", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a4/7a/739366db05e974d46d30954879cc", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3c/80/f2fa67168ae81563b6f21b7678d9", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/55/be/64590d708b8d9069f10f59c5f211", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/c0/2d/a02f1bd08dd91ddb861baf1be2d7", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/df/37/b25c4f3ddd53c9c6688b4660afb9", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e6/00/d7d194778893769a4a4d5af1dc80", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d9/56/b0a16db98621500b473844ec39d6", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/57/f9/f304c67d9958574b6b35de2ad13d", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/04/55/a41ad832c081ff421039827d16c1", @@ -4108,14 +4108,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/88/1a/1ea680450c3c9bc97147df4bf99d", "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/91/b3/31b980ca2a000871408cbc7923e3", "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/67/d1/8b98ad3d0d67bf6bc23c2c9167cf", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/d6/cb/5a23b50c0301080fab7871b2cc5b", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/a7/ab/4d5efa27ace9ab6e723b93407a82", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/44/a9/e159585e3d38436d371eda33de0a", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/d9/2e/9220f51060965122103686234f9f", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/97/82/1b50c1588b38b520017652ec2d07", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/18/2f/9ab3cc8b8edc51a8b8d74b082c0b", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/b5/4f/869073acc4b40f54c1b61488ad9d", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/e3/d1/c4b05ee74e45e759dea864ba3ad7", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/1c/30/dbf3906b8c1bec2d72df632d6099", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/c1/cc/dd517bc59c5cc0f4e3d23ac4eac6", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/fa/63/7a26568ee4f87c41495dfc9a97e0", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/2b/1c/7394f271641c26792cfa93da8a7b", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/34/1b/c726dfb7e0e750399fa7ba169c84", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/ff/19/62b199f7a9fbe4ec47ea15c3a234", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/67/80/58ceb85465bea71878893398996f", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/2a/32/d36cdfc0a36804ea78e477cece0c", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/ea/6a/6a4721b144e5e297b542d2a0eea2", diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 32985481..76bd39a7 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -342,6 +342,7 @@ bpresult brandassets bridgit + broadcastmessage bsac bsactor bscampaign diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e07731..b9851540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.20 (build 21118, api 8, 2023-06-15) +### 1.7.20 (build 21119, api 8, 2023-06-16) - This seems like a good time for a `refactoring` release in anticipation of changes coming in 1.8. Basically this means that a lot of things will be @@ -338,6 +338,15 @@ few megs but allows us to log nice full stack traces instead of just addresses. Try `print(_babase.native_stack_trace())` if you want to make sure its working. +- (build 21118) Fixed an issue where certain messages such as player-left + weren't being send to clients. +- (build 21118) renamed `bascenev1.screenmessage()` to + `bascenev1.broadcastmessage()` to make it more clear that it behaves + differently (sending messages to all connected clients instead of just the + local screen). There is still a `bascenev1.screenmessage()` but that is now + the same local-only version available in babase. Added a temporary warning if + calling screenmessage() in a situation that in previous versions would have + done a broadcast. ### 1.7.19 (build 20997, api 7, 2023-01-19) diff --git a/ballisticakit-cmake/.idea/dictionaries/ericf.xml b/ballisticakit-cmake/.idea/dictionaries/ericf.xml index 9f3ae3a2..4334c9da 100644 --- a/ballisticakit-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticakit-cmake/.idea/dictionaries/ericf.xml @@ -224,6 +224,7 @@ bpresult bresult bridgit + broadcastmessage broadcom bsac bscfg diff --git a/src/assets/ba_data/python/baclassic/_servermode.py b/src/assets/ba_data/python/baclassic/_servermode.py index 3c7339f7..25bc2c81 100644 --- a/src/assets/ba_data/python/baclassic/_servermode.py +++ b/src/assets/ba_data/python/baclassic/_servermode.py @@ -60,7 +60,7 @@ def _cmd(command_data: bytes) -> None: # Note: we have to do transient messages if # clients is specified, so they won't show up # in replays. - bascenev1.screenmessage( + bascenev1.broadcastmessage( command.message, color=command.color, clients=command.clients, diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index c7a51f93..260c9ace 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -28,7 +28,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21118 +TARGET_BALLISTICA_BUILD = 21119 TARGET_BALLISTICA_VERSION = '1.7.20' _g_env_config: EnvConfig | None = None diff --git a/src/assets/ba_data/python/bascenev1/__init__.py b/src/assets/ba_data/python/bascenev1/__init__.py index 11fde317..7b44deeb 100644 --- a/src/assets/ba_data/python/bascenev1/__init__.py +++ b/src/assets/ba_data/python/bascenev1/__init__.py @@ -48,6 +48,7 @@ from babase import ( Plugin, pushcall, safecolor, + screenmessage, set_analytics_screen, storagename, timestring, @@ -113,7 +114,7 @@ from _bascenev1 import ( release_gamepad_input, release_keyboard_input, reset_random_player_names, - screenmessage, + broadcastmessage, SessionData, SessionPlayer, set_admins, @@ -386,11 +387,12 @@ __all__ = [ 'release_keyboard_input', 'reset_random_player_names', 'safecolor', + 'screenmessage', 'SceneV1AppMode', 'ScoreConfig', 'ScoreScreenActivity', 'ScoreType', - 'screenmessage', + 'broadcastmessage', 'Session', 'SessionData', 'SessionPlayer', diff --git a/src/assets/ba_data/python/bascenev1/_gameactivity.py b/src/assets/ba_data/python/bascenev1/_gameactivity.py index ea5d8c51..80e51a3f 100644 --- a/src/assets/ba_data/python/bascenev1/_gameactivity.py +++ b/src/assets/ba_data/python/bascenev1/_gameactivity.py @@ -10,6 +10,7 @@ import logging from typing import TYPE_CHECKING, TypeVar import babase + import _bascenev1 from bascenev1._activity import Activity from bascenev1._player import PlayerInfo @@ -1315,7 +1316,7 @@ class GameActivity(Activity[PlayerT, TeamT]): if m not in unowned_maps ] if not valid_maps: - babase.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr(resource='noValidMapsErrorText') ) raise RuntimeError('No valid maps') diff --git a/src/assets/ba_data/python/bascenev1/_session.py b/src/assets/ba_data/python/bascenev1/_session.py index 72abd1d0..ffef80cd 100644 --- a/src/assets/ba_data/python/bascenev1/_session.py +++ b/src/assets/ba_data/python/bascenev1/_session.py @@ -242,7 +242,7 @@ class Session: # Print a rejection message *only* to the client trying to # join (prevents spamming everyone else in the game). _bascenev1.getsound('error').play() - _bascenev1.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='playerLimitReachedText', subs=[('${COUNT}', str(self.max_players))], @@ -283,7 +283,7 @@ class Session: sessionteam = sessionplayer.sessionteam assert sessionteam is not None - babase.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='playerLeftText', subs=[('${PLAYER}', sessionplayer.getname(full=True))], @@ -655,7 +655,7 @@ class Session: # Get our next activity going. self._complete_end_activity(activity, {}) else: - babase.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='notEnoughPlayersText', subs=[('${COUNT}', str(min_players))], @@ -721,7 +721,7 @@ class Session: ): pass_to_activity = False with self.context: - babase.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='playerDelayedJoinText', subs=[ diff --git a/src/assets/ba_data/python/bascenev1/_stats.py b/src/assets/ba_data/python/bascenev1/_stats.py index bd377707..4f3a0dbe 100644 --- a/src/assets/ba_data/python/bascenev1/_stats.py +++ b/src/assets/ba_data/python/bascenev1/_stats.py @@ -437,7 +437,7 @@ class Stats: # Report non-kill scorings. try: if screenmessage and not kill: - _bascenev1.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='nameScoresText', subs=[('${NAME}', name)] ), @@ -475,7 +475,7 @@ class Stats: try: if killed and _bascenev1.getactivity().announce_player_deaths: if killer is player: - _bascenev1.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='nameSuicideText', subs=[('${NAME}', name)] ), @@ -485,7 +485,7 @@ class Stats: ) elif killer is not None: if killer.team is player.team: - _bascenev1.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='nameBetrayedText', subs=[ @@ -498,7 +498,7 @@ class Stats: image=killer.get_icon(), ) else: - _bascenev1.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='nameKilledText', subs=[ @@ -511,7 +511,7 @@ class Stats: image=killer.get_icon(), ) else: - _bascenev1.screenmessage( + _bascenev1.broadcastmessage( babase.Lstr( resource='nameDiedText', subs=[('${NAME}', name)] ), diff --git a/src/assets/ba_data/python/bascenev1lib/actor/spaz.py b/src/assets/ba_data/python/bascenev1lib/actor/spaz.py index b88d40a6..3f545a28 100644 --- a/src/assets/ba_data/python/bascenev1lib/actor/spaz.py +++ b/src/assets/ba_data/python/bascenev1lib/actor/spaz.py @@ -278,7 +278,7 @@ class Spaz(bs.Actor): ) self._turbo_filter_times[source] = t_ms # (uncomment to debug; prints what this count is at) - # bs.screenmessage( str(source) + " " + # bs.broadcastmessage( str(source) + " " # + str(self._turbo_filter_counts[source])) if self._turbo_filter_counts[source] == 15: # Knock 'em out. That'll learn 'em. @@ -290,7 +290,7 @@ class Spaz(bs.Actor): assert bs.app.classic is not None if now > bs.app.classic.last_spaz_turbo_warn_time + 30.0: bs.app.classic.last_spaz_turbo_warn_time = now - bs.screenmessage( + bs.broadcastmessage( bs.Lstr( translate=( 'statements', diff --git a/src/assets/ba_data/python/bascenev1lib/game/race.py b/src/assets/ba_data/python/bascenev1lib/game/race.py index dcdaa68e..2dd20f73 100644 --- a/src/assets/ba_data/python/bascenev1lib/game/race.py +++ b/src/assets/ba_data/python/bascenev1lib/game/race.py @@ -260,7 +260,7 @@ class RaceGame(bs.TeamGameActivity[Player, Team]): if player.is_alive(): assert player.actor player.actor.handlemessage(bs.DieMessage()) - bs.screenmessage( + bs.broadcastmessage( bs.Lstr( translate=( 'statements', @@ -392,7 +392,7 @@ class RaceGame(bs.TeamGameActivity[Player, Team]): isinstance(self.session, bs.DualTeamSession) and self._entire_team_must_finish ): - bs.screenmessage( + bs.broadcastmessage( bs.Lstr( translate=( 'statements', diff --git a/src/assets/ba_data/python/bascenev1lib/tutorial.py b/src/assets/ba_data/python/bascenev1lib/tutorial.py index cbd79bad..b6f71680 100644 --- a/src/assets/ba_data/python/bascenev1lib/tutorial.py +++ b/src/assets/ba_data/python/bascenev1lib/tutorial.py @@ -459,7 +459,7 @@ class TutorialActivity(bs.Activity[Player, Team]): assert isinstance(tval, int) diff = tval a.cycle_times.append(diff) - bs.screenmessage( + bs.broadcastmessage( 'cycle time: ' + str(diff) + ' (average: ' diff --git a/src/ballistica/base/python/methods/python_methods_graphics.cc b/src/ballistica/base/python/methods/python_methods_graphics.cc index ba6f5107..6e311d74 100644 --- a/src/ballistica/base/python/methods/python_methods_graphics.cc +++ b/src/ballistica/base/python/methods/python_methods_graphics.cc @@ -35,6 +35,34 @@ static auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds) &color_obj, &log)) { return nullptr; } + + // TEMP - we used to have a single ba.screenmessage() call that would + // broadcast messages to all clients when called by a server in a game context + // and simply print them locally in other cases. In 1.7.20 the broadcast form + // has been moved to bascenev1.broadcastmessage(). But there's probably lots + // of code out there using screenmessage() not realizing it won't do what they + // intended anymore. So for now let's issue a warning when it *would* have + // done the broadcast thing. (just assuming that's the case any time there's a + // non-empty context) + static bool did_warning{}; + if (!did_warning && !g_base->CurrentContext().IsEmpty()) { + did_warning = true; + auto* envval = getenv("BA_SUPPRESS_SCREEN_MESSAGE_WARNING"); + bool suppress = (envval && strcmp(envval, "1") == 0); + if (!suppress) { + Log(LogLevel::kWarning, + "FIXME! screenmessage() is being called in a gameplay situation.\n" + "The screenmessage call used to send messages to all players but now " + "only prints them locally.\n" + "Please change your code to use bascenev1.broadcastmessage() to get " + "the old behavior.\n" + "You can set env var BA_SUPPRESS_SCREEN_MESSAGE_WARNING=1 to " + "suppress " + "this warning."); + g_base->PrintPythonStackTrace(); + } + } + std::string message_str = g_base->python->GetPyLString(message_obj); Vector3f color{1, 1, 1}; if (color_obj != Py_None) { @@ -66,8 +94,8 @@ static PyMethodDef PyScreenMessageDef = { "Category: **General Utility Functions**\n" "\n" "Note that this version of the function is purely for local display.\n" - "To broadcast screen messages in network play, see the versions of\n" - "this call provided by the scene-version packages.", + "To broadcast screen messages in network play, look for methods such as\n" + "broadcastmessage() provided by the scene-version packages.", }; // -------------------------- get_camera_position ------------------------------ diff --git a/src/ballistica/base/support/context.h b/src/ballistica/base/support/context.h index 4f468467..e1d603f8 100644 --- a/src/ballistica/base/support/context.h +++ b/src/ballistica/base/support/context.h @@ -29,21 +29,6 @@ namespace ballistica::base { /// extra functionality. class ContextRef { public: - /// The current global context-ref; - // static auto Current() -> const ContextRef& { - // assert(g_base); - // assert(g_base->InLogicThread()); // Up to caller to ensure this. - // return *g_base->context_ref; - // } - - /// Set the current global context from this one. - // static void SetCurrent(const ContextRef& context) { - // assert(g_base); - // // Context system is currently limited to logic-thread. - // BA_PRECONDITION(g_base->InLogicThread()); - // g_base->context_ref->SetTarget(context.Get()); - // } - /// Return a description of the context we're pointing at. auto GetDescription() const -> std::string; diff --git a/src/ballistica/scene_v1/python/methods/python_methods_scene.cc b/src/ballistica/scene_v1/python/methods/python_methods_scene.cc index 748fb2f9..d16a3145 100644 --- a/src/ballistica/scene_v1/python/methods/python_methods_scene.cc +++ b/src/ballistica/scene_v1/python/methods/python_methods_scene.cc @@ -621,9 +621,9 @@ static PyMethodDef PyGetActivityDef = { "If doraise is False, None will be returned instead in that case.", }; -// ---------------------------- screenmessage ---------------------------------- +// -------------------------- broadcastmessage --------------------------------- -static auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds) +static auto PyBroadcastMessage(PyObject* self, PyObject* args, PyObject* keywds) -> PyObject* { BA_PYTHON_TRY; const char* message = nullptr; @@ -732,6 +732,7 @@ static auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds) texture = SceneV1Python::GetPySceneTexture(image_obj); } } + if (output_stream) { // FIXME: for now we just do bottom messages. if (texture == nullptr && !top) { @@ -766,12 +767,12 @@ static auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds) BA_PYTHON_CATCH; } -static PyMethodDef PyScreenMessageDef = { - "screenmessage", // name - (PyCFunction)PyScreenMessage, // method - METH_VARARGS | METH_KEYWORDS, // flags +static PyMethodDef PyBroadcastMessageDef = { + "broadcastmessage", // name + (PyCFunction)PyBroadcastMessage, // method + METH_VARARGS | METH_KEYWORDS, // flags - "screenmessage(message: str | babase.Lstr,\n" + "broadcastmessage(message: str | babase.Lstr,\n" " color: Sequence[float] | None = None,\n" " top: bool = False,\n" " image: dict[str, Any] | None = None,\n" @@ -780,7 +781,7 @@ static PyMethodDef PyScreenMessageDef = { " transient: bool = False)" " -> None\n" "\n" - "Print a message to the local client's screen, in a given color.\n" + "Broadcast a screen-message to clients in the current session.\n" "\n" "Category: **General Utility Functions**\n" "\n" @@ -1730,7 +1731,7 @@ auto PythonMethodsScene::GetMethods() -> std::vector { PyRegisterActivityDef, PyRegisterSessionDef, PyIsInReplayDef, - PyScreenMessageDef, + PyBroadcastMessageDef, PyGetRandomNamesDef, PyResetRandomPlayerNamesDef, PySetReplaySpeedExponentDef, diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 9d2a84bd..8037e85c 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21118; +const int kEngineBuildNumber = 21119; const char* kEngineVersion = "1.7.20"; auto MonolithicMain(const core::CoreConfig& core_config) -> int {