mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-18 13:23:05 +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)
|
||||
{
|
||||
DebugLog.DebugWrite($"Change ship auth to {id}");
|
||||
var fromPlayer = ShipManager.Instance.CurrentFlyer == uint.MaxValue
|
||||
var newAuthority = ShipManager.Instance.CurrentFlyer == uint.MaxValue
|
||||
? QNetworkServer.connections.First(x => x.GetPlayerId() == QSBPlayerManager.LocalPlayerId)
|
||||
: 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;
|
||||
}
|
||||
|
||||
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