-Changed NetworkSync interfaces.
This commit is contained in:
@@ -9,7 +9,7 @@ using OneOf;
|
|||||||
|
|
||||||
namespace Barotrauma.LuaCs.Data;
|
namespace Barotrauma.LuaCs.Data;
|
||||||
|
|
||||||
public class SettingEntry<T> : SettingBase, ISettingBase<T>, INetworkSyncEntity where T : IEquatable<T>, IConvertible
|
public class SettingEntry<T> : SettingBase, ISettingBase<T>, INetworkSyncVar where T : IEquatable<T>, IConvertible
|
||||||
{
|
{
|
||||||
public class Factory : ISettingBase.IFactory<ISettingBase<T>>
|
public class Factory : ISettingBase.IFactory<ISettingBase<T>>
|
||||||
{
|
{
|
||||||
@@ -109,7 +109,7 @@ public class SettingEntry<T> : SettingBase, ISettingBase<T>, INetworkSyncEntity
|
|||||||
|
|
||||||
// -- Networking
|
// -- Networking
|
||||||
protected IEntityNetworkingService NetworkingService;
|
protected IEntityNetworkingService NetworkingService;
|
||||||
public ulong InstanceId => NetworkingService?.GetNetworkIdForInstance(this) ?? 0ul;
|
public Guid InstanceId => NetworkingService?.GetNetworkIdForInstance(this) ?? Guid.Empty;
|
||||||
public void SetNetworkOwner(IEntityNetworkingService networkingService)
|
public void SetNetworkOwner(IEntityNetworkingService networkingService)
|
||||||
{
|
{
|
||||||
NetworkingService = networkingService;
|
NetworkingService = networkingService;
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ using Barotrauma.Networking;
|
|||||||
|
|
||||||
namespace Barotrauma.LuaCs;
|
namespace Barotrauma.LuaCs;
|
||||||
|
|
||||||
public interface INetworkSyncEntity
|
public interface INetworkSyncVar
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Network-synchronized object ID. Used for networking send/receive message events.
|
/// Network-synchronized object ID. Used for networking send/receive message events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ulong InstanceId { get; }
|
Guid InstanceId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the <see cref="IEntityNetworkingService"/> that is currently managing this instance. The <see cref="InstanceId"/>
|
/// Sets the <see cref="IEntityNetworkingService"/> that is currently managing this instance. The <see cref="InstanceId"/>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ internal partial class NetworkingService : INetworkingService
|
|||||||
ReceiveIds
|
ReceiveIds
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<Guid, INetworkSyncEntity> netVars = new Dictionary<Guid, INetworkSyncEntity>();
|
private Dictionary<Guid, INetworkSyncVar> netVars = new Dictionary<Guid, INetworkSyncVar>();
|
||||||
private Dictionary<Guid, NetMessageReceived> netReceives = new Dictionary<Guid, NetMessageReceived>();
|
private Dictionary<Guid, NetMessageReceived> netReceives = new Dictionary<Guid, NetMessageReceived>();
|
||||||
private Dictionary<ushort, Guid> packetToId = new Dictionary<ushort, Guid>();
|
private Dictionary<ushort, Guid> packetToId = new Dictionary<ushort, Guid>();
|
||||||
private Dictionary<Guid, ushort> idToPacket = new Dictionary<Guid, ushort>();
|
private Dictionary<Guid, ushort> idToPacket = new Dictionary<Guid, ushort>();
|
||||||
@@ -104,17 +104,17 @@ internal partial class NetworkingService : INetworkingService
|
|||||||
IsDisposed = true;
|
IsDisposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ulong GetNetworkIdForInstance(INetworkSyncEntity entity)
|
public Guid GetNetworkIdForInstance(INetworkSyncVar var)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterNetVar(INetworkSyncEntity netVar)
|
public void RegisterNetVar(INetworkSyncVar netVar)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendNetVar(INetworkSyncEntity netVar)
|
public void SendNetVar(INetworkSyncVar netVar)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -25,7 +25,7 @@ internal partial interface INetworkingService : IReusableService, ILuaCsNetworki
|
|||||||
|
|
||||||
public interface IEntityNetworkingService
|
public interface IEntityNetworkingService
|
||||||
{
|
{
|
||||||
public ulong GetNetworkIdForInstance(INetworkSyncEntity entity);
|
public Guid GetNetworkIdForInstance(INetworkSyncVar var);
|
||||||
public void RegisterNetVar(INetworkSyncEntity netVar);
|
public void RegisterNetVar(INetworkSyncVar netVar);
|
||||||
public void SendNetVar(INetworkSyncEntity netVar);
|
public void SendNetVar(INetworkSyncVar netVar);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user