This commit is contained in:
Mister_Nebula 2020-08-10 12:02:01 +01:00
parent ae7d0a0396
commit 8fbafd7e4c
6 changed files with 8 additions and 8 deletions

View File

@ -27,6 +27,7 @@ namespace QSB.Events
public override void OnServerReceive(ToggleMessage message)
{
DebugLog.ToConsole($"Receieved ready message from {message.SenderId}");
PlayerRegistry.GetPlayer(message.SenderId).IsReady = message.ToggleValue;
PlayerState.LocalInstance.Send();
}

View File

@ -23,6 +23,7 @@ namespace QSB.Events
public void Request()
{
DebugLog.ToConsole("Requesting player states...", OWML.Common.MessageType.Info);
StartCoroutine(SendRequest());
}

View File

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using QSB.Tools;
using QSB.Utility;
using UnityEngine;

View File

@ -5,6 +5,7 @@ using QSB.TransformSync;
using QSB.Animation;
using QSB.Utility;
using QSB.Messaging;
using System;
namespace QSB
{
@ -19,6 +20,7 @@ namespace QSB
public static PlayerInfo CreatePlayer(uint id)
{
DebugLog.ToConsole($"Creating player with ID {id}", OWML.Common.MessageType.Info);
if (PlayerExists(id))
{
return null;
@ -49,7 +51,7 @@ namespace QSB
player.Name = message.PlayerName;
player.IsReady = message.PlayerReady;
player.State = message.PlayerState;
DebugLog.ToConsole($"Updating state for player {player.NetId} to {Convert.ToString((int)player.State, 2)}");
if (LocalPlayer.IsReady == true)
{
player.UpdateStateObjects();

View File

@ -37,6 +37,7 @@ namespace QSB
private void OnWakeUp()
{
WokenUp = true;
PlayerStatesRequest.Instance.Request();
}
private void OnLoopStart()

View File

@ -50,7 +50,6 @@ namespace QSB.TimeSync
}
GlobalMessenger.AddListener("RestartTimeLoop", OnLoopStart);
GlobalMessenger.AddListener("WakeUp", OnWakeUp);
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
@ -70,11 +69,6 @@ namespace QSB.TimeSync
_localLoopCount++;
}
private void OnWakeUp()
{
PlayerStatesRequest.Instance.Request();
}
private void Init()
{
PlayerStatesRequest.Instance.Request();