feat: added safe get entity by id

This commit is contained in:
2023-07-09 07:40:06 +03:00
parent 1406b17d62
commit 0479a21980
5 changed files with 72 additions and 46 deletions
+2 -2
View File
@@ -45,9 +45,9 @@ public sealed class RagonEntityCache
_playerCache = playerCache;
}
public RagonEntity FindById(ushort id)
public bool TryGetEntity(ushort id, out RagonEntity entity)
{
return _entityMap[id];
return _entityMap.TryGetValue(id, out entity);
}
public void Create(RagonEntity entity, IRagonPayload? spawnPayload)