From 124b1e545d6ce028799956c079f07ca9364c924b Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Fri, 20 Feb 2026 19:32:03 -0300 Subject: [PATCH] Fix missing ILuaCsNetworking API --- .../ClientSource/LuaCs/Services/NetworkingService.cs | 3 +++ .../ServerSource/LuaCs/Services/NetworkingService.cs | 3 +++ .../SharedSource/LuaCs/Compatibility/ILuaCsNetworking.cs | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/Services/NetworkingService.cs b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/Services/NetworkingService.cs index 4cde8a52b..49acd7436 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/LuaCs/Services/NetworkingService.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/LuaCs/Services/NetworkingService.cs @@ -76,6 +76,9 @@ partial class NetworkingService : INetworkingService, IEventServerConnected, IEv GameMain.Client.ClientPeer.Send(netMessage, deliveryMethod); } + public void Send(IWriteMessage netMessage, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable) + => SendToServer(netMessage, deliveryMethod); + private void RequestId(NetId netId) { if (idToPacket.ContainsKey(netId)) { return; } diff --git a/Barotrauma/BarotraumaServer/ServerSource/LuaCs/Services/NetworkingService.cs b/Barotrauma/BarotraumaServer/ServerSource/LuaCs/Services/NetworkingService.cs index fd5bcd90c..756b29c83 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/LuaCs/Services/NetworkingService.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/LuaCs/Services/NetworkingService.cs @@ -180,4 +180,7 @@ partial class NetworkingService : INetworkingService, IEventClientRawNetMessageR GameMain.Server.ServerPeer.Send(netMessage, connection, deliveryMethod); } } + + public void Send(IWriteMessage netMessage, NetworkConnection connection = null, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable) + => SendToClient(netMessage, connection, deliveryMethod); } diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Compatibility/ILuaCsNetworking.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Compatibility/ILuaCsNetworking.cs index aafcd5712..cbdbbb0bc 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Compatibility/ILuaCsNetworking.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Compatibility/ILuaCsNetworking.cs @@ -1,6 +1,13 @@ -namespace Barotrauma.LuaCs.Compatibility; +using Barotrauma.Networking; + +namespace Barotrauma.LuaCs.Compatibility; public interface ILuaCsNetworking : ILuaCsShim { void Receive(string netId, LuaCsAction action); +#if SERVER + void Send(IWriteMessage mesage, NetworkConnection connection = null, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable); +#elif CLIENT + void Send(IWriteMessage mesage, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable); +#endif }