mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 09:35:26 +00:00
change fromPlayer to newAuthority and networkIdentity to shipNetId
This commit is contained in:
parent
8ddc9dd7f2
commit
f9a00ef513
@ -77,23 +77,23 @@ namespace QSB.ShipSync.Events
|
|||||||
|
|
||||||
if (QSBCore.IsServer)
|
if (QSBCore.IsServer)
|
||||||
{
|
{
|
||||||
DebugLog.DebugWrite($"Change ship auth to {id}");
|
var newAuthority = ShipManager.Instance.CurrentFlyer == uint.MaxValue
|
||||||
var fromPlayer = ShipManager.Instance.CurrentFlyer == uint.MaxValue
|
|
||||||
? QNetworkServer.connections.First(x => x.GetPlayerId() == QSBPlayerManager.LocalPlayerId)
|
? QNetworkServer.connections.First(x => x.GetPlayerId() == QSBPlayerManager.LocalPlayerId)
|
||||||
: QNetworkServer.connections.First(x => x.GetPlayerId() == id);
|
: QNetworkServer.connections.First(x => x.GetPlayerId() == id);
|
||||||
var ship = ShipTransformSync.LocalInstance;
|
|
||||||
var networkIdentity = ship.NetIdentity;
|
|
||||||
|
|
||||||
if (networkIdentity.ClientAuthorityOwner == fromPlayer)
|
var ship = ShipTransformSync.LocalInstance;
|
||||||
|
var shipNetId = ship.NetIdentity;
|
||||||
|
|
||||||
|
if (shipNetId.ClientAuthorityOwner == newAuthority)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (networkIdentity.ClientAuthorityOwner != null && networkIdentity.ClientAuthorityOwner != fromPlayer)
|
if (shipNetId.ClientAuthorityOwner != null && shipNetId.ClientAuthorityOwner != newAuthority)
|
||||||
{
|
{
|
||||||
networkIdentity.RemoveClientAuthority(networkIdentity.ClientAuthorityOwner);
|
shipNetId.RemoveClientAuthority(shipNetId.ClientAuthorityOwner);
|
||||||
}
|
}
|
||||||
networkIdentity.AssignClientAuthority(fromPlayer);
|
shipNetId.AssignClientAuthority(newAuthority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user