feat: added checks and new ragon serializer methods

This commit is contained in:
2022-08-14 15:39:22 +04:00
parent f2934bc8ee
commit 65c1d9c6d4
2 changed files with 36 additions and 0 deletions
+12
View File
@@ -278,6 +278,12 @@ namespace Ragon.Core
var entityType = _serializer.ReadUShort();
var staticId = _serializer.ReadUShort();
var propertiesCount = _serializer.ReadUShort();
if (propertiesCount > 63)
{
_logger.Warn($"Allowed only 64 properties per entity. EntityType(Static) {entityType}");
return;
}
var entity = new Entity(peerId, entityType, staticId, RagonAuthority.ALL, RagonAuthority.OWNER_ONLY, propertiesCount);
for (var i = 0; i < propertiesCount; i++)
{
@@ -322,6 +328,12 @@ namespace Ragon.Core
var entityType = _serializer.ReadUShort();
var propertiesCount = _serializer.ReadUShort();
var entity = new Entity(peerId, entityType, 0, RagonAuthority.ALL, RagonAuthority.ALL, propertiesCount);
if (propertiesCount > 63)
{
_logger.Warn($"Allowed only 64 properties per entity. EntityType(Static) {entityType}");
return;
}
for (var i = 0; i < propertiesCount; i++)
{
var propertySize = _serializer.ReadUShort();