fix: ChangeOwner now adds/removes from owned hashset

We do this in spawn and destroy already.
This commit is contained in:
MrGadget1024 2023-01-16 07:30:39 -05:00
parent 3e7837cebd
commit a35c0dbd9a

View File

@ -1323,6 +1323,14 @@ internal static void ChangeOwner(NetworkIdentity identity, ChangeOwnerMessage me
// set ownership flag (aka authority) // set ownership flag (aka authority)
identity.isOwned = message.isOwner; identity.isOwned = message.isOwner;
// Add / Remove to client's connectionToServer.owned hashset.
if (identity.isOwned)
connection?.owned.Add(identity);
else
connection?.owned.Remove(identity);
// Call OnStartAuthority / OnStopAuthority
identity.NotifyAuthority(); identity.NotifyAuthority();
// set localPlayer flag // set localPlayer flag