Add support for hierarchical objects ownership

This commit is contained in:
Wojciech Figat
2022-11-03 14:34:35 +01:00
parent 007a5cb5ca
commit e38ab163c4
2 changed files with 43 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ public:
/// </summary>
/// <param name="obj">The network object.</param>
/// <returns>The Client Id.</returns>
API_FUNCTION() static uint32 GetObjectClientId(ScriptingObject* obj);
API_FUNCTION() static uint32 GetObjectOwnerClientId(ScriptingObject* obj);
/// <summary>
/// Gets the role of the network object used locally (eg. to check if can simulate object).
@@ -145,7 +145,8 @@ public:
/// <param name="obj">The network object.</param>
/// <param name="ownerClientId">The new owner. Set to NetworkManager::LocalClientId for local client to be owner (server might reject it).</param>
/// <param name="localRole">The local role to assign for the object.</param>
API_FUNCTION() static void SetObjectOwnership(ScriptingObject* obj, uint32 ownerClientId, NetworkObjectRole localRole = NetworkObjectRole::Replicated);
/// <param name="hierarchical">True if apply the ownership to all child objects of this object (eg. all child actors and scripts attached to the networked actor).</param>
API_FUNCTION() static void SetObjectOwnership(ScriptingObject* obj, uint32 ownerClientId, NetworkObjectRole localRole = NetworkObjectRole::Replicated, bool hierarchical = false);
/// <summary>
/// Marks the object dirty to perform immediate replication to the other clients.