renamed bascenev1's screenmessage to broadcastmessage to differentiate it from local-only screenmessage

This commit is contained in:
Eric 2023-06-16 10:23:40 -07:00
parent d606e6e3b5
commit 7b73f28862
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
17 changed files with 103 additions and 75 deletions

56
.efrocachemap generated
View File

@ -4072,26 +4072,26 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/18/4b/787a9267e17be3c49966072581a5", "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/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/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/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/19/f6/8953c543e33d3f09fbd5b7c34eba", "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/2b/46/66ec5b8877329621369e74fc1c50", "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/09/eb/97daa4a4840c83f0e9862e3e7fb5", "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/c8/e7/c70e60b2b59821119d12120eb104", "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/ee/79/a5b6790b4d224325d8ba4a4cdc78", "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/fc/cd/f1ce0b65bec1ef59aae8db3dfe04", "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/d6/59/78a04deb39a2242277f8f337c787", "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/93/53/3503a8386b4c732003d32f89827b", "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/15/a3/7bf99f886870865cc6932415d2ef", "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/d6/22/78303e63ad4954ca5b58f5a25c7f", "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/09/1b/7bbb9bfc39329265c3e5741d8194", "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/23/21/33f75e30409b0aaf6e29ea104d11", "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/80/bb/0cd610d2073e45bdaad5ee553859", "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/92/19/6288c866d989b27adda46771f0e3", "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/b4/eb/bd01bf247b58405e0a1810c315f7", "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/8f/6d/0908960ed304d38cb743e090a9af", "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/1f/7c/f3310f6ac02db02a883893bfd6d2", "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/15/ea/3b3b51407118ef827ccd28d86540", "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/89/e3/037522509a9c638209809fbe09d4", "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/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_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", "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_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/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/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.lib": "https://files.ballistica.net/cache/ba1/1c/30/dbf3906b8c1bec2d72df632d6099",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/a7/ab/4d5efa27ace9ab6e723b93407a82", "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/44/a9/e159585e3d38436d371eda33de0a", "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/d9/2e/9220f51060965122103686234f9f", "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/97/82/1b50c1588b38b520017652ec2d07", "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/18/2f/9ab3cc8b8edc51a8b8d74b082c0b", "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/b5/4f/869073acc4b40f54c1b61488ad9d", "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/e3/d1/c4b05ee74e45e759dea864ba3ad7", "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/__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/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", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/ea/6a/6a4721b144e5e297b542d2a0eea2",

View File

@ -342,6 +342,7 @@
<w>bpresult</w> <w>bpresult</w>
<w>brandassets</w> <w>brandassets</w>
<w>bridgit</w> <w>bridgit</w>
<w>broadcastmessage</w>
<w>bsac</w> <w>bsac</w>
<w>bsactor</w> <w>bsactor</w>
<w>bscampaign</w> <w>bscampaign</w>

View File

@ -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 - 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 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 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 addresses. Try `print(_babase.native_stack_trace())` if you want to make sure
its working. 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) ### 1.7.19 (build 20997, api 7, 2023-01-19)

View File

@ -224,6 +224,7 @@
<w>bpresult</w> <w>bpresult</w>
<w>bresult</w> <w>bresult</w>
<w>bridgit</w> <w>bridgit</w>
<w>broadcastmessage</w>
<w>broadcom</w> <w>broadcom</w>
<w>bsac</w> <w>bsac</w>
<w>bscfg</w> <w>bscfg</w>

View File

@ -60,7 +60,7 @@ def _cmd(command_data: bytes) -> None:
# Note: we have to do transient messages if # Note: we have to do transient messages if
# clients is specified, so they won't show up # clients is specified, so they won't show up
# in replays. # in replays.
bascenev1.screenmessage( bascenev1.broadcastmessage(
command.message, command.message,
color=command.color, color=command.color,
clients=command.clients, clients=command.clients,

View File

@ -28,7 +28,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be # Build number and version of the ballistica binary we expect to be
# using. # using.
TARGET_BALLISTICA_BUILD = 21118 TARGET_BALLISTICA_BUILD = 21119
TARGET_BALLISTICA_VERSION = '1.7.20' TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None _g_env_config: EnvConfig | None = None

View File

@ -48,6 +48,7 @@ from babase import (
Plugin, Plugin,
pushcall, pushcall,
safecolor, safecolor,
screenmessage,
set_analytics_screen, set_analytics_screen,
storagename, storagename,
timestring, timestring,
@ -113,7 +114,7 @@ from _bascenev1 import (
release_gamepad_input, release_gamepad_input,
release_keyboard_input, release_keyboard_input,
reset_random_player_names, reset_random_player_names,
screenmessage, broadcastmessage,
SessionData, SessionData,
SessionPlayer, SessionPlayer,
set_admins, set_admins,
@ -386,11 +387,12 @@ __all__ = [
'release_keyboard_input', 'release_keyboard_input',
'reset_random_player_names', 'reset_random_player_names',
'safecolor', 'safecolor',
'screenmessage',
'SceneV1AppMode', 'SceneV1AppMode',
'ScoreConfig', 'ScoreConfig',
'ScoreScreenActivity', 'ScoreScreenActivity',
'ScoreType', 'ScoreType',
'screenmessage', 'broadcastmessage',
'Session', 'Session',
'SessionData', 'SessionData',
'SessionPlayer', 'SessionPlayer',

View File

@ -10,6 +10,7 @@ import logging
from typing import TYPE_CHECKING, TypeVar from typing import TYPE_CHECKING, TypeVar
import babase import babase
import _bascenev1 import _bascenev1
from bascenev1._activity import Activity from bascenev1._activity import Activity
from bascenev1._player import PlayerInfo from bascenev1._player import PlayerInfo
@ -1315,7 +1316,7 @@ class GameActivity(Activity[PlayerT, TeamT]):
if m not in unowned_maps if m not in unowned_maps
] ]
if not valid_maps: if not valid_maps:
babase.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr(resource='noValidMapsErrorText') babase.Lstr(resource='noValidMapsErrorText')
) )
raise RuntimeError('No valid maps') raise RuntimeError('No valid maps')

View File

@ -242,7 +242,7 @@ class Session:
# Print a rejection message *only* to the client trying to # Print a rejection message *only* to the client trying to
# join (prevents spamming everyone else in the game). # join (prevents spamming everyone else in the game).
_bascenev1.getsound('error').play() _bascenev1.getsound('error').play()
_bascenev1.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='playerLimitReachedText', resource='playerLimitReachedText',
subs=[('${COUNT}', str(self.max_players))], subs=[('${COUNT}', str(self.max_players))],
@ -283,7 +283,7 @@ class Session:
sessionteam = sessionplayer.sessionteam sessionteam = sessionplayer.sessionteam
assert sessionteam is not None assert sessionteam is not None
babase.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='playerLeftText', resource='playerLeftText',
subs=[('${PLAYER}', sessionplayer.getname(full=True))], subs=[('${PLAYER}', sessionplayer.getname(full=True))],
@ -655,7 +655,7 @@ class Session:
# Get our next activity going. # Get our next activity going.
self._complete_end_activity(activity, {}) self._complete_end_activity(activity, {})
else: else:
babase.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='notEnoughPlayersText', resource='notEnoughPlayersText',
subs=[('${COUNT}', str(min_players))], subs=[('${COUNT}', str(min_players))],
@ -721,7 +721,7 @@ class Session:
): ):
pass_to_activity = False pass_to_activity = False
with self.context: with self.context:
babase.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='playerDelayedJoinText', resource='playerDelayedJoinText',
subs=[ subs=[

View File

@ -437,7 +437,7 @@ class Stats:
# Report non-kill scorings. # Report non-kill scorings.
try: try:
if screenmessage and not kill: if screenmessage and not kill:
_bascenev1.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='nameScoresText', subs=[('${NAME}', name)] resource='nameScoresText', subs=[('${NAME}', name)]
), ),
@ -475,7 +475,7 @@ class Stats:
try: try:
if killed and _bascenev1.getactivity().announce_player_deaths: if killed and _bascenev1.getactivity().announce_player_deaths:
if killer is player: if killer is player:
_bascenev1.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='nameSuicideText', subs=[('${NAME}', name)] resource='nameSuicideText', subs=[('${NAME}', name)]
), ),
@ -485,7 +485,7 @@ class Stats:
) )
elif killer is not None: elif killer is not None:
if killer.team is player.team: if killer.team is player.team:
_bascenev1.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='nameBetrayedText', resource='nameBetrayedText',
subs=[ subs=[
@ -498,7 +498,7 @@ class Stats:
image=killer.get_icon(), image=killer.get_icon(),
) )
else: else:
_bascenev1.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='nameKilledText', resource='nameKilledText',
subs=[ subs=[
@ -511,7 +511,7 @@ class Stats:
image=killer.get_icon(), image=killer.get_icon(),
) )
else: else:
_bascenev1.screenmessage( _bascenev1.broadcastmessage(
babase.Lstr( babase.Lstr(
resource='nameDiedText', subs=[('${NAME}', name)] resource='nameDiedText', subs=[('${NAME}', name)]
), ),

View File

@ -278,7 +278,7 @@ class Spaz(bs.Actor):
) )
self._turbo_filter_times[source] = t_ms self._turbo_filter_times[source] = t_ms
# (uncomment to debug; prints what this count is at) # (uncomment to debug; prints what this count is at)
# bs.screenmessage( str(source) + " " # bs.broadcastmessage( str(source) + " "
# + str(self._turbo_filter_counts[source])) # + str(self._turbo_filter_counts[source]))
if self._turbo_filter_counts[source] == 15: if self._turbo_filter_counts[source] == 15:
# Knock 'em out. That'll learn 'em. # Knock 'em out. That'll learn 'em.
@ -290,7 +290,7 @@ class Spaz(bs.Actor):
assert bs.app.classic is not None assert bs.app.classic is not None
if now > bs.app.classic.last_spaz_turbo_warn_time + 30.0: if now > bs.app.classic.last_spaz_turbo_warn_time + 30.0:
bs.app.classic.last_spaz_turbo_warn_time = now bs.app.classic.last_spaz_turbo_warn_time = now
bs.screenmessage( bs.broadcastmessage(
bs.Lstr( bs.Lstr(
translate=( translate=(
'statements', 'statements',

View File

@ -260,7 +260,7 @@ class RaceGame(bs.TeamGameActivity[Player, Team]):
if player.is_alive(): if player.is_alive():
assert player.actor assert player.actor
player.actor.handlemessage(bs.DieMessage()) player.actor.handlemessage(bs.DieMessage())
bs.screenmessage( bs.broadcastmessage(
bs.Lstr( bs.Lstr(
translate=( translate=(
'statements', 'statements',
@ -392,7 +392,7 @@ class RaceGame(bs.TeamGameActivity[Player, Team]):
isinstance(self.session, bs.DualTeamSession) isinstance(self.session, bs.DualTeamSession)
and self._entire_team_must_finish and self._entire_team_must_finish
): ):
bs.screenmessage( bs.broadcastmessage(
bs.Lstr( bs.Lstr(
translate=( translate=(
'statements', 'statements',

View File

@ -459,7 +459,7 @@ class TutorialActivity(bs.Activity[Player, Team]):
assert isinstance(tval, int) assert isinstance(tval, int)
diff = tval diff = tval
a.cycle_times.append(diff) a.cycle_times.append(diff)
bs.screenmessage( bs.broadcastmessage(
'cycle time: ' 'cycle time: '
+ str(diff) + str(diff)
+ ' (average: ' + ' (average: '

View File

@ -35,6 +35,34 @@ static auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds)
&color_obj, &log)) { &color_obj, &log)) {
return nullptr; 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); std::string message_str = g_base->python->GetPyLString(message_obj);
Vector3f color{1, 1, 1}; Vector3f color{1, 1, 1};
if (color_obj != Py_None) { if (color_obj != Py_None) {
@ -66,8 +94,8 @@ static PyMethodDef PyScreenMessageDef = {
"Category: **General Utility Functions**\n" "Category: **General Utility Functions**\n"
"\n" "\n"
"Note that this version of the function is purely for local display.\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" "To broadcast screen messages in network play, look for methods such as\n"
"this call provided by the scene-version packages.", "broadcastmessage() provided by the scene-version packages.",
}; };
// -------------------------- get_camera_position ------------------------------ // -------------------------- get_camera_position ------------------------------

View File

@ -29,21 +29,6 @@ namespace ballistica::base {
/// extra functionality. /// extra functionality.
class ContextRef { class ContextRef {
public: 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. /// Return a description of the context we're pointing at.
auto GetDescription() const -> std::string; auto GetDescription() const -> std::string;

View File

@ -621,9 +621,9 @@ static PyMethodDef PyGetActivityDef = {
"If doraise is False, None will be returned instead in that case.", "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* { -> PyObject* {
BA_PYTHON_TRY; BA_PYTHON_TRY;
const char* message = nullptr; const char* message = nullptr;
@ -732,6 +732,7 @@ static auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds)
texture = SceneV1Python::GetPySceneTexture(image_obj); texture = SceneV1Python::GetPySceneTexture(image_obj);
} }
} }
if (output_stream) { if (output_stream) {
// FIXME: for now we just do bottom messages. // FIXME: for now we just do bottom messages.
if (texture == nullptr && !top) { if (texture == nullptr && !top) {
@ -766,12 +767,12 @@ static auto PyScreenMessage(PyObject* self, PyObject* args, PyObject* keywds)
BA_PYTHON_CATCH; BA_PYTHON_CATCH;
} }
static PyMethodDef PyScreenMessageDef = { static PyMethodDef PyBroadcastMessageDef = {
"screenmessage", // name "broadcastmessage", // name
(PyCFunction)PyScreenMessage, // method (PyCFunction)PyBroadcastMessage, // method
METH_VARARGS | METH_KEYWORDS, // flags METH_VARARGS | METH_KEYWORDS, // flags
"screenmessage(message: str | babase.Lstr,\n" "broadcastmessage(message: str | babase.Lstr,\n"
" color: Sequence[float] | None = None,\n" " color: Sequence[float] | None = None,\n"
" top: bool = False,\n" " top: bool = False,\n"
" image: dict[str, Any] | None = None,\n" " image: dict[str, Any] | None = None,\n"
@ -780,7 +781,7 @@ static PyMethodDef PyScreenMessageDef = {
" transient: bool = False)" " transient: bool = False)"
" -> None\n" " -> None\n"
"\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" "\n"
"Category: **General Utility Functions**\n" "Category: **General Utility Functions**\n"
"\n" "\n"
@ -1730,7 +1731,7 @@ auto PythonMethodsScene::GetMethods() -> std::vector<PyMethodDef> {
PyRegisterActivityDef, PyRegisterActivityDef,
PyRegisterSessionDef, PyRegisterSessionDef,
PyIsInReplayDef, PyIsInReplayDef,
PyScreenMessageDef, PyBroadcastMessageDef,
PyGetRandomNamesDef, PyGetRandomNamesDef,
PyResetRandomPlayerNamesDef, PyResetRandomPlayerNamesDef,
PySetReplaySpeedExponentDef, PySetReplaySpeedExponentDef,

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica { namespace ballistica {
// These are set automatically via script; don't modify them here. // 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"; const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int { auto MonolithicMain(const core::CoreConfig& core_config) -> int {