From 34107cbd5f4f0ce6f00fe35089da0dda925de740 Mon Sep 17 00:00:00 2001 From: Edmand46 Date: Sun, 14 Aug 2022 11:17:22 +0400 Subject: [PATCH] feat: added checking of owner --- Ragon/Sources/Game/GameRoom.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Ragon/Sources/Game/GameRoom.cs b/Ragon/Sources/Game/GameRoom.cs index 14eb605..a346b26 100755 --- a/Ragon/Sources/Game/GameRoom.cs +++ b/Ragon/Sources/Game/GameRoom.cs @@ -124,11 +124,6 @@ namespace Ragon.Core { _serializer.Clear(); _serializer.FromSpan(ref payloadRawData); - - if (operation != RagonOperation.REPLICATE_ENTITY_STATE) - { - _logger.Trace(operation); - } switch (operation) { @@ -137,6 +132,12 @@ namespace Ragon.Core var entityId = _serializer.ReadUShort(); if (_entities.TryGetValue(entityId, out var ent)) { + if (ent.OwnerId != peerId) + { + _logger.Warn($"Not owner can't change properties of object {entityId}"); + return; + } + var mask = _serializer.ReadLong(); for (var i = 0; i < ent.Properties.Length; i++) { @@ -146,10 +147,9 @@ namespace Ragon.Core ent.Properties[i].Write(ref propertyPayload); } } + if (_entitiesDirtySet.Add(ent)) - { _entitiesDirty.Add(ent); - } } break;