🐛 checking authority on destroy object
This commit is contained in:
@@ -35,7 +35,7 @@ public sealed class EntityDestroyOperation: BaseOperation
|
||||
var room = context.Room;
|
||||
var entityId = Reader.ReadUShort();
|
||||
|
||||
if (room.Entities.TryGetValue(entityId, out var entity))
|
||||
if (room.Entities.TryGetValue(entityId, out var entity) && entity.Owner.Connection.Id == player.Connection.Id)
|
||||
{
|
||||
var payload = new RagonPayload();
|
||||
payload.Read(Reader);
|
||||
@@ -47,5 +47,9 @@ public sealed class EntityDestroyOperation: BaseOperation
|
||||
|
||||
_logger.Trace($"Player {context.Connection.Id}|{context.LobbyPlayer.Name} destoyed entity {entity.Id}");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Trace($"Entity ${entity.Id} not found or Player {context.Connection.Id}|{context.LobbyPlayer.Name} have not authority");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user