mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 09:39:56 +00:00
move WakeUpSync off remote players
This commit is contained in:
parent
2113925fbe
commit
a252463781
QSB
Binary file not shown.
@ -16,11 +16,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace QSB.TimeSync;
|
namespace QSB.TimeSync;
|
||||||
|
|
||||||
/// <summary>
|
public class WakeUpSync : MonoBehaviour, IAddComponentOnStart
|
||||||
/// BUG: this runs on remote players = BAD! can we move this off of network player?
|
|
||||||
/// </summary>
|
|
||||||
[UsedInUnityProject]
|
|
||||||
public class WakeUpSync : NetworkBehaviour
|
|
||||||
{
|
{
|
||||||
public static WakeUpSync LocalInstance { get; private set; }
|
public static WakeUpSync LocalInstance { get; private set; }
|
||||||
|
|
||||||
@ -41,8 +37,6 @@ public class WakeUpSync : NetworkBehaviour
|
|||||||
private int _serverLoopCount;
|
private int _serverLoopCount;
|
||||||
private bool _hasWokenUp;
|
private bool _hasWokenUp;
|
||||||
|
|
||||||
public override void OnStartLocalPlayer() => LocalInstance = this;
|
|
||||||
|
|
||||||
public void OnDisconnect()
|
public void OnDisconnect()
|
||||||
{
|
{
|
||||||
OWTime.SetTimeScale(1f);
|
OWTime.SetTimeScale(1f);
|
||||||
@ -60,10 +54,7 @@ public class WakeUpSync : NetworkBehaviour
|
|||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
if (!isLocalPlayer)
|
LocalInstance = this;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QSBSceneManager.IsInUniverse)
|
if (QSBSceneManager.IsInUniverse)
|
||||||
{
|
{
|
||||||
@ -120,7 +111,7 @@ public class WakeUpSync : NetworkBehaviour
|
|||||||
{
|
{
|
||||||
new RequestStateResyncMessage().Send();
|
new RequestStateResyncMessage().Send();
|
||||||
CurrentState = State.Loaded;
|
CurrentState = State.Loaded;
|
||||||
if (isServer)
|
if (QSBCore.IsHost)
|
||||||
{
|
{
|
||||||
SendServerTime();
|
SendServerTime();
|
||||||
}
|
}
|
||||||
@ -162,7 +153,7 @@ public class WakeUpSync : NetworkBehaviour
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerData.LoadLoopCount() != _serverLoopCount && !isServer)
|
if (PlayerData.LoadLoopCount() != _serverLoopCount && !QSBCore.IsHost)
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Warning - ServerLoopCount is not the same as local loop count! local:{PlayerData.LoadLoopCount()} server:{_serverLoopCount}");
|
DebugLog.ToConsole($"Warning - ServerLoopCount is not the same as local loop count! local:{PlayerData.LoadLoopCount()} server:{_serverLoopCount}");
|
||||||
return;
|
return;
|
||||||
@ -268,11 +259,11 @@ public class WakeUpSync : NetworkBehaviour
|
|||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (isServer)
|
if (QSBCore.IsHost)
|
||||||
{
|
{
|
||||||
UpdateServer();
|
UpdateServer();
|
||||||
}
|
}
|
||||||
else if (isLocalPlayer && !QSBCore.DebugSettings.AvoidTimeSync)
|
else if (!QSBCore.DebugSettings.AvoidTimeSync)
|
||||||
{
|
{
|
||||||
UpdateClient();
|
UpdateClient();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user