This commit is contained in:
JohnCorby 2022-01-24 11:53:51 -08:00
parent ef18f207bf
commit 187c1cb789

View File

@ -31,8 +31,16 @@ namespace QSB.Utility
#region MIRROR
public static uint GetPlayerId(this NetworkConnection conn) =>
conn.identity.netId;
public static uint GetPlayerId(this NetworkConnection conn)
{
if (conn == null)
{
DebugLog.ToConsole("Warning - GetPlayerId with null NetworkConnection", MessageType.Warning);
return uint.MaxValue;
}
return conn.identity.netId;
}
public static void SpawnWithServerAuthority(this GameObject go) =>
NetworkServer.Spawn(go, NetworkServer.localConnection);