Fixed networking references errors.

This commit is contained in:
MapleWheels
2026-02-03 19:48:35 -05:00
committed by Maplewheels
parent cae3741953
commit 9cc20a03c0
6 changed files with 21 additions and 32 deletions
@@ -50,7 +50,7 @@ partial class NetworkingService : INetworkingService
throw new NotImplementedException(); throw new NotImplementedException();
} }
public INetWriteMessage Start(Guid netId) public IWriteMessage Start(Guid netId)
{ {
var message = new WriteOnlyMessage(); var message = new WriteOnlyMessage();
@@ -67,7 +67,7 @@ partial class NetworkingService : INetworkingService
message.WriteBytes(netId.ToByteArray(), 0, 16); message.WriteBytes(netId.ToByteArray(), 0, 16);
} }
return message.ToNetWriteMessage(); return message;
} }
public void RequestId(Guid netId) public void RequestId(Guid netId)
@@ -15,7 +15,7 @@ partial class NetworkingService : INetworkingService
private ushort currentId = 0; private ushort currentId = 0;
public INetWriteMessage Start(Guid netId) public IWriteMessage Start(Guid netId)
{ {
var message = new WriteOnlyMessage(); var message = new WriteOnlyMessage();
@@ -32,7 +32,7 @@ partial class NetworkingService : INetworkingService
message.WriteBytes(netId.ToByteArray(), 0, 16); message.WriteBytes(netId.ToByteArray(), 0, 16);
} }
return message.ToNetWriteMessage(); return message;
} }
public void NetMessageReceived(IReadMessage netMessage, ClientPacketHeader header, Client client = null) public void NetMessageReceived(IReadMessage netMessage, ClientPacketHeader header, Client client = null)
@@ -82,12 +82,12 @@ public class SettingList<T> : ISettingList<T> where T : IEquatable<T>
public Guid InstanceId { get; } public Guid InstanceId { get; }
public NetSync SyncType { get; } public NetSync SyncType { get; }
public ClientPermissions WritePermissions { get; } public ClientPermissions WritePermissions { get; }
public void ReadNetMessage(INetReadMessage message) public void ReadNetMessage(IReadMessage message)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void WriteNetMessage(INetWriteMessage message) public void WriteNetMessage(IWriteMessage message)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@@ -2,6 +2,7 @@
using System.Numerics; using System.Numerics;
using Barotrauma.LuaCs.Configuration; using Barotrauma.LuaCs.Configuration;
using Barotrauma.LuaCs.Data; using Barotrauma.LuaCs.Data;
using Barotrauma.Networking;
using FluentResults; using FluentResults;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Vector2 = Microsoft.Xna.Framework.Vector2; using Vector2 = Microsoft.Xna.Framework.Vector2;
@@ -27,15 +28,15 @@ public class ConfigInitializers : IService
public bool IsDisposed => false; public bool IsDisposed => false;
private Result<ISettingEntry<T>> CreateConfigEntry<T>(IConfigInfo configInfo, private Result<ISettingEntry<T>> CreateConfigEntry<T>(IConfigInfo configInfo,
Action<SettingEntry<T>, INetReadMessage> readHandler, Action<SettingEntry<T>, IReadMessage> readHandler,
Action<SettingEntry<T>, INetWriteMessage> writeHandler) Action<SettingEntry<T>, IWriteMessage> writeHandler)
where T : IEquatable<T> where T : IEquatable<T>
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
private Result<ISettingList<T>> CreateConfigList<T>(IConfigInfo configInfo, private Result<ISettingList<T>> CreateConfigList<T>(IConfigInfo configInfo,
Action<ISettingList<T>, INetReadMessage> readHandler, Action<ISettingList<T>, INetWriteMessage> writeHandler) Action<ISettingList<T>, IReadMessage> readHandler, Action<ISettingList<T>, IWriteMessage> writeHandler)
where T : IEquatable<T> where T : IEquatable<T>
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@@ -46,28 +46,6 @@ internal partial class NetworkingService : INetworkingService
#endif #endif
} }
public void RegisterNetVar(INetworkSyncEntity netVar)
{
netVars[netVar.InstanceId] = netVar;
netReceives[netVar.InstanceId] = (IReadMessage netMessage) =>
{
INetReadMessage internalMind = new NetReadMessage();
internalMind.SetMessage(netMessage);
netVar.ReadNetMessage(internalMind);
};
}
public void SendNetVar(INetworkSyncEntity netVar)
{
if (netVars.ContainsKey(netVar.InstanceId))
{
INetWriteMessage message = Start(netVar.InstanceId);
netVar.WriteNetMessage(message);
Send(message.Message);
}
}
public void Receive(Guid netId, NetMessageReceived callback) public void Receive(Guid netId, NetMessageReceived callback)
{ {
#if SERVER #if SERVER
@@ -125,4 +103,14 @@ internal partial class NetworkingService : INetworkingService
{ {
IsDisposed = true; IsDisposed = true;
} }
public void RegisterNetVar(INetworkSyncEntity netVar)
{
throw new NotImplementedException();
}
public void SendNetVar(INetworkSyncEntity netVar)
{
throw new NotImplementedException();
}
} }
@@ -13,7 +13,7 @@ internal partial interface INetworkingService : IReusableService, ILuaCsNetworki
bool IsActive { get; } bool IsActive { get; }
bool IsSynchronized { get; } bool IsSynchronized { get; }
public INetWriteMessage Start(Guid netId); public IWriteMessage Start(Guid netId);
public void Receive(Guid netId, NetMessageReceived action); public void Receive(Guid netId, NetMessageReceived action);
#if SERVER #if SERVER
public void Send(IWriteMessage netMessage, NetworkConnection connection = null, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable); public void Send(IWriteMessage netMessage, NetworkConnection connection = null, DeliveryMethod deliveryMethod = DeliveryMethod.Reliable);