mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-13 21:40:50 +00:00
Turn AttachedNetId and PlayerId into actual getters, with null checks and error logs
This commit is contained in:
parent
0e05c3ea3c
commit
66a0d80e8b
@ -16,8 +16,36 @@ namespace QSB.Syncs.TransformSync
|
|||||||
|
|
||||||
public abstract class BaseTransformSync : QNetworkTransform, ISync<Transform>
|
public abstract class BaseTransformSync : QNetworkTransform, ISync<Transform>
|
||||||
{
|
{
|
||||||
public uint AttachedNetId => NetIdentity?.NetId.Value ?? uint.MaxValue;
|
public uint AttachedNetId
|
||||||
public uint PlayerId => NetIdentity.RootIdentity?.NetId.Value ?? NetIdentity.NetId.Value;
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (NetIdentity == null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - Trying to get AttachedNetId with null NetIdentity! Type:{GetType().Name} GrandType:{GetType().GetType().Name}", MessageType.Error);
|
||||||
|
return uint.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NetIdentity.NetId.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint PlayerId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (NetIdentity == null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - Trying to get PlayerId with null NetIdentity! Type:{GetType().Name} GrandType:{GetType().GetType().Name}", MessageType.Error);
|
||||||
|
return uint.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NetIdentity.RootIdentity != null
|
||||||
|
? NetIdentity.RootIdentity.NetId.Value
|
||||||
|
: AttachedNetId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
|
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
|
||||||
|
|
||||||
public Transform ReferenceTransform { get; set; }
|
public Transform ReferenceTransform { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user