Skip to content

fix: NetcodeIntegrationTest updates and fixes #3437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,12 @@ public void Handle(ref NetworkContext context)
// Stop the client-side approval timeout coroutine since we are approved.
networkManager.ConnectionManager.StopClientApprovalCoroutine();

networkManager.ConnectionManager.ConnectedClientIds.Clear();
foreach (var clientId in ConnectedClientIds)
{
if (!networkManager.ConnectionManager.ConnectedClientIds.Contains(clientId))
// DANGO-TODO: Revisit the entire connection sequence and determine why we would need to check both cases as we shouldn't have to =or= we could
// try removing this after the Rust server connection sequence stuff is resolved. (Might be only needed if scene management is disabled)
// If there is any disconnect between the connection sequence of Ids vs ConnectedClients, then add the client.
if (!networkManager.ConnectionManager.ConnectedClientIds.Contains(clientId) || !networkManager.ConnectionManager.ConnectedClients.ContainsKey(clientId))
{
networkManager.ConnectionManager.AddClient(clientId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2595,30 +2595,26 @@ private void HandleSessionOwnerEvent(uint sceneEventId, ulong clientId)
case SceneEventType.SynchronizeComplete:
{
// At this point the client is considered fully "connected"
if ((NetworkManager.DistributedAuthorityMode && NetworkManager.LocalClient.IsSessionOwner) || !NetworkManager.DistributedAuthorityMode)
// Make sure we have a NetworkClient for this synchronized client
if (!NetworkManager.ConnectedClients.ContainsKey(clientId))
{
// Notify the local server that a client has finished synchronizing
OnSceneEvent?.Invoke(new SceneEvent()
{
SceneEventType = sceneEventData.SceneEventType,
SceneName = string.Empty,
ClientId = clientId
});
if (NetworkManager.ConnectedClients.ContainsKey(clientId))
{
NetworkManager.ConnectedClients[clientId].IsConnected = true;
}
NetworkManager.ConnectionManager.AddClient(clientId);
}
else
// Mark this client as being connected
NetworkManager.ConnectedClients[clientId].IsConnected = true;

// Notify the local server that a client has finished synchronizing
OnSceneEvent?.Invoke(new SceneEvent()
{
// Notify the local server that a client has finished synchronizing
OnSceneEvent?.Invoke(new SceneEvent()
{
SceneEventType = sceneEventData.SceneEventType,
SceneName = string.Empty,
ClientId = clientId
});
SceneEventType = sceneEventData.SceneEventType,
SceneName = string.Empty,
ClientId = clientId
});

// For non-authority clients in a distributed authority session, we show hidden objects,
// we distribute NetworkObjects, and then we end the scene event.
if (NetworkManager.DistributedAuthorityMode && !NetworkManager.LocalClient.IsSessionOwner)
{
// Show any NetworkObjects that are:
// - Hidden from the session owner
// - Owned by this client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ internal NetworkObject GetNetworkObjectToSpawn(uint globalObjectIdHash, ulong ow
{
if (NetworkLog.CurrentLogLevel <= LogLevel.Error)
{
NetworkLog.LogError($"Failed to create object locally. [{nameof(globalObjectIdHash)}={globalObjectIdHash}]. {nameof(NetworkPrefab)} could not be found. Is the prefab registered with {nameof(NetworkManager)}?");
NetworkLog.LogError($"Failed to create object locally. [{nameof(globalObjectIdHash)}={globalObjectIdHash}]. {nameof(NetworkPrefab)} could not be found. Is the prefab registered with {NetworkManager.name}?");
}
}
else
Expand Down
Loading