🚧 plugin system, webhook system

This commit is contained in:
2023-04-09 10:52:18 +04:00
parent f2edc94958
commit bfd6c1b54b
60 changed files with 762 additions and 267 deletions
@@ -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");
}
}
}
}