mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 01:13:05 +00:00
remove SyncBase.PlayerId
This commit is contained in:
parent
2d6133002b
commit
b79cea5254
@ -50,8 +50,8 @@ namespace QSB.Player.TransformSync
|
||||
var player = new PlayerInfo(this);
|
||||
QSBPlayerManager.PlayerList.SafeAdd(player);
|
||||
base.Start();
|
||||
QSBPlayerManager.OnAddPlayer?.Invoke(PlayerId);
|
||||
DebugLog.DebugWrite($"Create Player : id<{PlayerId}>", MessageType.Info);
|
||||
QSBPlayerManager.OnAddPlayer?.Invoke(Player.PlayerId);
|
||||
DebugLog.DebugWrite($"Create Player : id<{Player.PlayerId}>", MessageType.Info);
|
||||
}
|
||||
|
||||
protected override void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isInUniverse)
|
||||
@ -87,11 +87,11 @@ namespace QSB.Player.TransformSync
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
// TODO : Maybe move this to a leave event...? Would ensure everything could finish up before removing the player
|
||||
QSBPlayerManager.OnRemovePlayer?.Invoke(PlayerId);
|
||||
QSBPlayerManager.OnRemovePlayer?.Invoke(Player.PlayerId);
|
||||
base.OnDestroy();
|
||||
Player.HudMarker?.Remove();
|
||||
QSBPlayerManager.PlayerList.Remove(Player);
|
||||
DebugLog.DebugWrite($"Remove Player : id<{PlayerId}>", MessageType.Info);
|
||||
DebugLog.DebugWrite($"Remove Player : id<{Player.PlayerId}>", MessageType.Info);
|
||||
}
|
||||
|
||||
protected override Transform InitLocalTransform()
|
||||
|
@ -127,12 +127,13 @@ namespace QSB.Syncs.Sectored
|
||||
{
|
||||
if (IsPlayerObject)
|
||||
{
|
||||
if (!QSBPlayerManager.PlayerExists(PlayerId))
|
||||
if (Player == null)
|
||||
{
|
||||
writer.Write(-1);
|
||||
return;
|
||||
}
|
||||
else if (!Player.IsReady)
|
||||
|
||||
if (!Player.IsReady)
|
||||
{
|
||||
writer.Write(-1);
|
||||
return;
|
||||
|
@ -16,8 +16,10 @@ namespace QSB.Syncs
|
||||
|
||||
public abstract class SyncBase<T> : QNetworkTransform where T : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// only valid for player objects
|
||||
/// </summary>
|
||||
public PlayerInfo Player { get; private set; }
|
||||
protected uint PlayerId => Player.PlayerId;
|
||||
|
||||
private bool _baseIsReady
|
||||
{
|
||||
@ -60,7 +62,7 @@ namespace QSB.Syncs
|
||||
public T AttachedObject { get; set; }
|
||||
public Transform ReferenceTransform { get; set; }
|
||||
|
||||
public string LogName => $"{PlayerId}.{NetId.Value}:{GetType().Name}";
|
||||
public string LogName => $"{(IsPlayerObject ? Player.PlayerId : "<NonPlayer>")}.{NetId.Value}:{GetType().Name}";
|
||||
protected virtual float DistanceLeeway { get; } = 5f;
|
||||
private float _previousDistance;
|
||||
protected const float SmoothTime = 0.1f;
|
||||
|
Loading…
Reference in New Issue
Block a user