NetworkReplicator::ResolveForeignObject

This commit is contained in:
Wiktor Kocielski
2023-08-13 06:39:35 +03:00
parent 09be2375f6
commit 1413da189e
2 changed files with 14 additions and 0 deletions

View File

@@ -941,6 +941,13 @@ bool NetworkReplicator::HasObject(const ScriptingObject* obj)
return false; return false;
} }
ScriptingObject* NetworkReplicator::ResolveForeignObject(Guid objectId)
{
if (const auto& object = ResolveObject(objectId))
return object->Object.Get();
return nullptr;
}
uint32 NetworkReplicator::GetObjectOwnerClientId(const ScriptingObject* obj) uint32 NetworkReplicator::GetObjectOwnerClientId(const ScriptingObject* obj)
{ {
uint32 id = NetworkManager::ServerClientId; uint32 id = NetworkManager::ServerClientId;

View File

@@ -116,6 +116,13 @@ public:
/// <param name="obj">The network object.</param> /// <param name="obj">The network object.</param>
/// <returns>True if object exists in networking, otherwise false.</returns> /// <returns>True if object exists in networking, otherwise false.</returns>
API_FUNCTION() static bool HasObject(const ScriptingObject* obj); API_FUNCTION() static bool HasObject(const ScriptingObject* obj);
/// <summary>
/// Resolves foreign Guid into a local ScriptingObject
/// </summary>
/// <param name="objectId">The Guid of a foreign object.</param>
/// <returns>Object if managed to resolve, otherwise null.</returns>
API_FUNCTION() static ScriptingObject* ResolveForeignObject(Guid objectId);
/// <summary> /// <summary>
/// Gets the Client Id of the network object owner. /// Gets the Client Id of the network object owner.