Skip to content

Commit

Permalink
fix: replacing the player does not mean giving up authority (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpach committed Nov 29, 2019
1 parent 9acde20 commit a2c273e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
4 changes: 0 additions & 4 deletions Assets/Mirror/Runtime/ClientScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,6 @@ static void CheckForLocalPlayer(NetworkIdentity identity)
{
if (identity.pendingLocalPlayer)
{
if (readyConnection.identity != null && readyConnection.identity != identity)
{
readyConnection.identity.SetNotLocalPlayer();
}
// supposed to be local player, so make it the local player!

// Set isLocalPlayer to true on this NetworkIdentity and trigger OnStartLocalPlayer in all scripts on the same GO
Expand Down
12 changes: 0 additions & 12 deletions Assets/Mirror/Runtime/NetworkIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,6 @@ internal void SetClientOwner(NetworkConnection conn)
/// </summary>
public static void ResetNextNetworkId() => nextNetworkId = 1;

// used when the player object for a connection changes
internal void SetNotLocalPlayer()
{
if (NetworkServer.active && NetworkServer.localClientActive)
{
// dont change authority for objects on the host
return;
}
hasAuthority = false;
NotifyAuthority();
}

// this is used when a connection is destroyed, since the "observers" property is read-only
internal void RemoveObserverInternal(NetworkConnection conn)
{
Expand Down
7 changes: 0 additions & 7 deletions Assets/Mirror/Runtime/NetworkServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -890,13 +890,6 @@ internal static bool InternalReplacePlayerForConnection(NetworkConnection conn,
//NOTE: there can be an existing player
if (LogFilter.Debug) Debug.Log("NetworkServer ReplacePlayer");

// is there already an owner that is a different object??
if (conn.identity != null)
{
conn.identity.SetNotLocalPlayer();
conn.identity.connectionToClient = null;
}

conn.identity = identity;

// Set the connection on the NetworkIdentity on the server, NetworkIdentity.SetLocalPlayer is not called on the server (it is on clients)
Expand Down

0 comments on commit a2c273e

Please sign in to comment.