🐛 prediction spawning for wrong connection, payload capacity
This commit is contained in:
@@ -70,7 +70,7 @@ internal class SnapshotHandler : IHandler
|
|||||||
var player = _playerCache.GetPlayerByPeer(ownerPeerId);
|
var player = _playerCache.GetPlayerByPeer(ownerPeerId);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
RagonLog.Error($"Player not found with peerId: ${ownerPeerId}");
|
RagonLog.Error($"Player not found with peerId: {ownerPeerId}");
|
||||||
|
|
||||||
_playerCache.Dump();
|
_playerCache.Dump();
|
||||||
return;
|
return;
|
||||||
@@ -106,7 +106,7 @@ internal class SnapshotHandler : IHandler
|
|||||||
var player = _playerCache.GetPlayerByPeer(ownerPeerId);
|
var player = _playerCache.GetPlayerByPeer(ownerPeerId);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
RagonLog.Error($"Player not found with peerId: ${ownerPeerId}");
|
RagonLog.Error($"Player not found with peerId: {ownerPeerId}");
|
||||||
|
|
||||||
_playerCache.Dump();
|
_playerCache.Dump();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -186,20 +186,17 @@ public sealed class RagonEntityCache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pendingEntities.TryGetValue(attachId, out var pendingEntity))
|
if (_pendingEntities.TryGetValue(attachId, out var pendingEntity) && hasAuthority)
|
||||||
{
|
{
|
||||||
_pendingEntities.Remove(attachId);
|
_pendingEntities.Remove(attachId);
|
||||||
_entityMap.Add(entityId, pendingEntity);
|
_entityMap.Add(entityId, pendingEntity);
|
||||||
|
_entityList.Add(pendingEntity);
|
||||||
if (hasAuthority)
|
|
||||||
_entityList.Add(pendingEntity);
|
|
||||||
|
|
||||||
hasCreated = false;
|
hasCreated = false;
|
||||||
|
|
||||||
return pendingEntity;
|
return pendingEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var entity = new RagonEntity(entityType, sceneId);
|
var entity = new RagonEntity(entityType, sceneId);
|
||||||
|
|
||||||
_entityMap.Add(entityId, entity);
|
_entityMap.Add(entityId, entity);
|
||||||
@@ -217,7 +214,6 @@ public sealed class RagonEntityCache
|
|||||||
{
|
{
|
||||||
if (_entityMap.TryGetValue(entityId, out var entity))
|
if (_entityMap.TryGetValue(entityId, out var entity))
|
||||||
{
|
{
|
||||||
|
|
||||||
_entityMap.Remove(entityId);
|
_entityMap.Remove(entityId);
|
||||||
_entityList.Remove(entity);
|
_entityList.Remove(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ namespace Ragon.Client
|
|||||||
Create(null, new RagonRoomParameters() {Scene = sceneName, Min = minPlayers, Max = maxPlayers});
|
Create(null, new RagonRoomParameters() {Scene = sceneName, Min = minPlayers, Max = maxPlayers});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Create(string roomId, string sceneNa, int minPlayers, int maxPlayers)
|
public void Create(string roomId, string sceneName, int minPlayers, int maxPlayers)
|
||||||
{
|
{
|
||||||
Create(roomId, new RagonRoomParameters() {Scene = sceneNa, Min = minPlayers, Max = maxPlayers});
|
Create(roomId, new RagonRoomParameters() {Scene = sceneName, Min = minPlayers, Max = maxPlayers});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Create(string roomId, RagonRoomParameters parameters)
|
public void Create(string roomId, RagonRoomParameters parameters)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Ragon.Protocol
|
|||||||
public int ReadOffset => _read;
|
public int ReadOffset => _read;
|
||||||
public int WriteOffset => _write;
|
public int WriteOffset => _write;
|
||||||
public int Length => ((_write - 1) >> 3) + 1;
|
public int Length => ((_write - 1) >> 3) + 1;
|
||||||
public int Capacity => _write - _read;
|
public int Capacity => _write - _read - 1;
|
||||||
|
|
||||||
public RagonBuffer(int capacity = 128)
|
public RagonBuffer(int capacity = 128)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class RagonPayload
|
|||||||
|
|
||||||
public void Read(RagonBuffer buffer)
|
public void Read(RagonBuffer buffer)
|
||||||
{
|
{
|
||||||
_size = buffer.Capacity - 1;
|
_size = buffer.Capacity;
|
||||||
buffer.ReadArray(_data, _size);
|
buffer.ReadArray(_data, _size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class RagonEvent
|
|||||||
|
|
||||||
public void Read(RagonBuffer buffer)
|
public void Read(RagonBuffer buffer)
|
||||||
{
|
{
|
||||||
_size = buffer.Capacity - 1;
|
_size = buffer.Capacity;
|
||||||
buffer.ReadArray(_data, _size);
|
buffer.ReadArray(_data, _size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Ragon.Server.Logging;
|
||||||
|
|
||||||
|
public interface IRagonLogger
|
||||||
|
{
|
||||||
|
public void Warning(string tag, string message);
|
||||||
|
public void Info(string tag, string message);
|
||||||
|
public void Error(string tag, string message);
|
||||||
|
public void Trace(string tag, string message);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user