From 93376256988d996421fcad0dcd7c48da1e5c18f1 Mon Sep 17 00:00:00 2001 From: NicEastvillage Date: Thu, 6 Aug 2026 09:06:09 +0200 Subject: [PATCH 1/3] Deprecate console commands in DesiredGameState and allow match manages to bypass state setting --- RLBotCS/Server/BridgeMessage/RunConsoleCommand.cs | 11 +++++++++++ RLBotCS/Server/BridgeMessage/SetGameState.cs | 8 +++++++- RLBotCS/Server/FlatBuffersSession.cs | 10 +++++++++- flatbuffers-schema | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 RLBotCS/Server/BridgeMessage/RunConsoleCommand.cs diff --git a/RLBotCS/Server/BridgeMessage/RunConsoleCommand.cs b/RLBotCS/Server/BridgeMessage/RunConsoleCommand.cs new file mode 100644 index 00000000..90ff60cb --- /dev/null +++ b/RLBotCS/Server/BridgeMessage/RunConsoleCommand.cs @@ -0,0 +1,11 @@ +using RLBot.Flat; + +namespace RLBotCS.Server.BridgeMessage; + +readonly struct RunConsoleCommand(ConsoleCommandT command) : IBridgeMessage +{ + public void HandleMessage(BridgeContext context) + { + context.MatchCommandQueue.AddConsoleCommand(command.Command); + } +} diff --git a/RLBotCS/Server/BridgeMessage/SetGameState.cs b/RLBotCS/Server/BridgeMessage/SetGameState.cs index d946f2d7..859500e4 100644 --- a/RLBotCS/Server/BridgeMessage/SetGameState.cs +++ b/RLBotCS/Server/BridgeMessage/SetGameState.cs @@ -1,4 +1,5 @@ -using RLBot.Flat; +using Microsoft.Extensions.Logging; +using RLBot.Flat; using RLBotCS.Conversion; namespace RLBotCS.Server.BridgeMessage; @@ -7,6 +8,11 @@ readonly struct SetGameState(DesiredGameStateT GameState) : IBridgeMessage { public void HandleMessage(BridgeContext context) { + if (GameState.ConsoleCommands.Count > 0) + { + context.Logger.LogWarning("Running console commands through the DesiredGameState message is deprecated. " + + "Use the ConsoleCommand message type instead."); + } foreach (var command in GameState.ConsoleCommands) context.MatchCommandQueue.AddConsoleCommand(command.Command); diff --git a/RLBotCS/Server/FlatBuffersSession.cs b/RLBotCS/Server/FlatBuffersSession.cs index 306a4801..2f5ba5e7 100644 --- a/RLBotCS/Server/FlatBuffersSession.cs +++ b/RLBotCS/Server/FlatBuffersSession.cs @@ -304,12 +304,20 @@ await _bridge.WriteAsync( break; case InterfaceMessage.DesiredGameState: - if (!_stateSettingIsEnabled) + if (!_stateSettingIsEnabled && _agentId != "") break; var desiredGameState = msg.MessageAsDesiredGameState().UnPack(); await _bridge.WriteAsync(new SetGameState(desiredGameState)); break; + + case InterfaceMessage.ConsoleCommand: + if (!_stateSettingIsEnabled && _agentId != "") + break; + + var command = msg.MessageAsConsoleCommand().UnPack(); + await _bridge.WriteAsync(new RunConsoleCommand(command)); + break; case InterfaceMessage.RenderingStatus: var renderingStatus = msg.MessageAsRenderingStatus().UnPack(); diff --git a/flatbuffers-schema b/flatbuffers-schema index c2648b4f..58595eb5 160000 --- a/flatbuffers-schema +++ b/flatbuffers-schema @@ -1 +1 @@ -Subproject commit c2648b4fa30d9d3b228466d51746c84ee2f20a6c +Subproject commit 58595eb5a96ff99dbcee1e734824503b60cd82fb From 53ce838859305add2a6466fdab8d6f2710dd6934 Mon Sep 17 00:00:00 2001 From: NicEastvillage Date: Thu, 6 Aug 2026 09:10:20 +0200 Subject: [PATCH 2/3] Format --- RLBotCS/Server/BridgeMessage/SetGameState.cs | 6 ++++-- RLBotCS/Server/FlatBuffersSession.cs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RLBotCS/Server/BridgeMessage/SetGameState.cs b/RLBotCS/Server/BridgeMessage/SetGameState.cs index 859500e4..924519a1 100644 --- a/RLBotCS/Server/BridgeMessage/SetGameState.cs +++ b/RLBotCS/Server/BridgeMessage/SetGameState.cs @@ -10,8 +10,10 @@ public void HandleMessage(BridgeContext context) { if (GameState.ConsoleCommands.Count > 0) { - context.Logger.LogWarning("Running console commands through the DesiredGameState message is deprecated. " + - "Use the ConsoleCommand message type instead."); + context.Logger.LogWarning( + "Running console commands through the DesiredGameState message is deprecated. " + + "Use the ConsoleCommand message type instead." + ); } foreach (var command in GameState.ConsoleCommands) context.MatchCommandQueue.AddConsoleCommand(command.Command); diff --git a/RLBotCS/Server/FlatBuffersSession.cs b/RLBotCS/Server/FlatBuffersSession.cs index 2f5ba5e7..fcf59c85 100644 --- a/RLBotCS/Server/FlatBuffersSession.cs +++ b/RLBotCS/Server/FlatBuffersSession.cs @@ -310,11 +310,11 @@ await _bridge.WriteAsync( var desiredGameState = msg.MessageAsDesiredGameState().UnPack(); await _bridge.WriteAsync(new SetGameState(desiredGameState)); break; - + case InterfaceMessage.ConsoleCommand: if (!_stateSettingIsEnabled && _agentId != "") break; - + var command = msg.MessageAsConsoleCommand().UnPack(); await _bridge.WriteAsync(new RunConsoleCommand(command)); break; From bbbec0d9bb4dc77a551ad8e5633593cafb5ff71f Mon Sep 17 00:00:00 2001 From: NicEastvillage Date: Sat, 8 Aug 2026 18:47:11 +0200 Subject: [PATCH 3/3] Update schema --- flatbuffers-schema | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flatbuffers-schema b/flatbuffers-schema index 58595eb5..f90c844f 160000 --- a/flatbuffers-schema +++ b/flatbuffers-schema @@ -1 +1 @@ -Subproject commit 58595eb5a96ff99dbcee1e734824503b60cd82fb +Subproject commit f90c844f2f5118e28647d39b71cbde5a2cd6accf