This commit is contained in:
Mister_Nebula 2020-08-17 21:28:38 +01:00
parent 5bf088f609
commit 4e1eca8bff
7 changed files with 10 additions and 22 deletions

View File

@ -127,8 +127,7 @@ namespace QSB.Animation
{ {
var message = new AnimTriggerMessage var message = new AnimTriggerMessage
{ {
FromId = netId.Value, AboutId = PlayerRegistry.LocalPlayerId,
AboutId = netId.Value,
TriggerId = (short)trigger, TriggerId = (short)trigger,
Value = value Value = value
}; };

View File

@ -20,7 +20,7 @@ namespace QSB.Events
private void OnClientReceiveMessage(PlayerStateMessage message) private void OnClientReceiveMessage(PlayerStateMessage message)
{ {
if (message.FromId == PlayerRegistry.LocalPlayerId) if (PlayerRegistry.IsBelongingToLocalPlayer(message.AboutId))
{ {
return; return;
} }
@ -34,7 +34,6 @@ namespace QSB.Events
{ {
var message = new PlayerStateMessage var message = new PlayerStateMessage
{ {
FromId = PlayerRegistry.LocalPlayerId,
AboutId = player.NetId, AboutId = player.NetId,
PlayerName = player.Name, PlayerName = player.Name,
PlayerReady = player.IsReady, PlayerReady = player.IsReady,

View File

@ -12,7 +12,7 @@ namespace QSB
public GameObject Camera { get; set; } public GameObject Camera { get; set; }
public GameObject ProbeBody { get; set; } public GameObject ProbeBody { get; set; }
public QSBProbe Probe { get; set; } public QSBProbe Probe { get; set; }
public QSBFlashlight FlashLight => Camera.GetComponentInChildren<QSBFlashlight>(); public QSBFlashlight FlashLight => Camera?.GetComponentInChildren<QSBFlashlight>();
public QSBTool Signalscope => GetToolByType(ToolType.Signalscope); public QSBTool Signalscope => GetToolByType(ToolType.Signalscope);
public QSBTool Translator => GetToolByType(ToolType.Translator); public QSBTool Translator => GetToolByType(ToolType.Translator);
public QSBTool ProbeLauncher => GetToolByType(ToolType.ProbeLauncher); public QSBTool ProbeLauncher => GetToolByType(ToolType.ProbeLauncher);

View File

@ -3,7 +3,6 @@ using System.Linq;
using QSB.TransformSync; using QSB.TransformSync;
using QSB.Animation; using QSB.Animation;
using QSB.Messaging; using QSB.Messaging;
using QSB.Utility;
namespace QSB namespace QSB
{ {
@ -32,7 +31,6 @@ namespace QSB
public static void RemovePlayer(uint id) public static void RemovePlayer(uint id)
{ {
DebugLog.ToConsole($"Removing player {id}");
PlayerList.Remove(GetPlayer(id)); PlayerList.Remove(GetPlayer(id));
} }

View File

@ -42,7 +42,7 @@ namespace QSB.TransformSync
} }
var transformSync = PlayerRegistry.GetTransformSync(message.AboutId); var transformSync = PlayerRegistry.GetTransformSync(message.AboutId);
//DebugLog.ToConsole($"{transformSync.GetType().Name} of ID {message.SenderId} set to {sector.Name}"); //DebugLog.ToConsole($"{transformSync.GetType().Name} of ID {message.AboutId} set to {sector.Name}");
UnityHelper.Instance.RunWhen(() => transformSync.SyncedTransform != null, UnityHelper.Instance.RunWhen(() => transformSync.SyncedTransform != null,
() => transformSync.SetReferenceSector(sector)); () => transformSync.SetReferenceSector(sector));
} }

View File

@ -1,5 +1,4 @@
using QSB.Animation; using QSB.Animation;
using QSB.Utility;
using UnityEngine; using UnityEngine;
namespace QSB.TransformSync namespace QSB.TransformSync
@ -10,19 +9,11 @@ namespace QSB.TransformSync
static PlayerTransformSync() static PlayerTransformSync()
{ {
DebugLog.ToConsole("constructor of playertransformsync");
AnimControllerPatch.Init(); AnimControllerPatch.Init();
} }
public override void OnNetworkDestroy()
{
DebugLog.ToConsole("PlayerTransformSync on network destroy");
base.OnNetworkDestroy();
}
public override void OnStartLocalPlayer() public override void OnStartLocalPlayer()
{ {
DebugLog.ToConsole("onstartlocalplayer of playertransformsync, id of " + PlayerId);
LocalInstance = this; LocalInstance = this;
} }

View File

@ -22,7 +22,6 @@ namespace QSB.TransformSync
protected virtual void Awake() protected virtual void Awake()
{ {
DebugLog.ToConsole($"Adding {GetType().Name} of id {netId.Value} to transformsync list.");
PlayerRegistry.TransformSyncs.Add(this); PlayerRegistry.TransformSyncs.Add(this);
DontDestroyOnLoad(gameObject); DontDestroyOnLoad(gameObject);
QSBSceneManager.OnSceneLoaded += OnSceneLoaded; QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
@ -88,12 +87,14 @@ namespace QSB.TransformSync
// If this script is attached to any other body, eg the representations of other players // If this script is attached to any other body, eg the representations of other players
if (SyncedTransform.position == Vector3.zero) if (SyncedTransform.position == Vector3.zero)
{ {
// Fix bodies staying at 0,0,0 by chucking them into the sun DebugLog.ToConsole($"{GetType().Name} of id {PlayerId} is at 0,0,0!");
Hide(); Hide();
return;
} }
else
Show(); {
Show();
}
SyncedTransform.localPosition = Vector3.SmoothDamp(SyncedTransform.localPosition, transform.position, ref _positionSmoothVelocity, SmoothTime); SyncedTransform.localPosition = Vector3.SmoothDamp(SyncedTransform.localPosition, transform.position, ref _positionSmoothVelocity, SmoothTime);
SyncedTransform.localRotation = QuaternionHelper.SmoothDamp(SyncedTransform.localRotation, transform.rotation, ref _rotationSmoothVelocity, Time.deltaTime); SyncedTransform.localRotation = QuaternionHelper.SmoothDamp(SyncedTransform.localRotation, transform.rotation, ref _rotationSmoothVelocity, Time.deltaTime);
} }