🚧 plugin system, webhook system
This commit is contained in:
@@ -17,29 +17,25 @@
|
||||
using NLog;
|
||||
using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Server;
|
||||
namespace Ragon.Server.Handler;
|
||||
|
||||
public sealed class EntityStateOperation: IRagonOperation
|
||||
{
|
||||
private ILogger _logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly ILogger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public void Handle(RagonContext context, RagonBuffer reader, RagonBuffer writer)
|
||||
{
|
||||
var room = context.Room;
|
||||
var player = context.RoomPlayer;
|
||||
var entitiesCount = reader.ReadUShort();
|
||||
|
||||
for (var entityIndex = 0; entityIndex < entitiesCount; entityIndex++)
|
||||
{
|
||||
var entityId = reader.ReadUShort();
|
||||
if (room.Entities.TryGetValue(entityId, out var entity) && entity.Owner.Connection.Id == context.Connection.Id)
|
||||
{
|
||||
entity.State.Read(reader);
|
||||
room.Track(entity);
|
||||
}
|
||||
if (room.Entities.TryGetValue(entityId, out var entity))
|
||||
entity.Read(player, reader);
|
||||
else
|
||||
{
|
||||
_logger.Error($"Entity with Id {entityId} not found, replication interrupted");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user