remove PlayerState, add launch code event

This commit is contained in:
Mister_Nebula 2021-11-20 11:48:46 +00:00
parent c8cffc02b1
commit 8a27aefb44
30 changed files with 182 additions and 89 deletions

View File

@ -155,7 +155,7 @@ namespace QSB.Animation.Player
public void SetSuitState(bool state)
{
if (!Player.PlayerStates.IsReady)
if (!Player.IsReady)
{
return;
}

View File

@ -22,7 +22,7 @@ namespace QSB.Animation.Player.Events
public override void OnReceiveRemote(bool server, EnumMessage<AnimationType> message)
{
if (!QSBCore.WorldObjectsReady || !QSBPlayerManager.GetPlayer(message.AboutId).PlayerStates.IsReady)
if (!QSBCore.WorldObjectsReady || !QSBPlayerManager.GetPlayer(message.AboutId).IsReady)
{
return;
}

View File

@ -32,9 +32,9 @@ namespace QSB.Animation.Player.Events
public override void OnReceiveRemote(bool server, ToggleMessage message)
{
var player = QSBPlayerManager.GetPlayer(message.AboutId);
player.PlayerStates.SuitedUp = message.ToggleValue;
player.SuitedUp = message.ToggleValue;
if (!QSBCore.WorldObjectsReady || !player.PlayerStates.IsReady)
if (!QSBCore.WorldObjectsReady || !player.IsReady)
{
return;
}
@ -46,7 +46,7 @@ namespace QSB.Animation.Player.Events
public override void OnReceiveLocal(bool server, ToggleMessage message)
{
QSBPlayerManager.LocalPlayer.PlayerStates.SuitedUp = message.ToggleValue;
QSBPlayerManager.LocalPlayer.SuitedUp = message.ToggleValue;
var animator = QSBPlayerManager.LocalPlayer.AnimationSync;
var type = message.ToggleValue ? AnimationType.PlayerSuited : AnimationType.PlayerUnsuited;
animator.CurrentType = type;

View File

@ -24,6 +24,7 @@
public static string ExitFlightConsole = "ExitFlightConsole";
public static string EnterShip = "EnterShip";
public static string ExitShip = "ExitShip";
public static string LaunchCodes = "LearnLaunchCodes";
// Custom event names -- change if you want! These can be anything, as long as both
// sides of the GlobalMessenger (fireevent and addlistener) reference the same thing.

View File

@ -77,6 +77,7 @@ namespace QSB.Events
new DebugEvent(),
new SatelliteProjectorEvent(),
new SatelliteProjectorSnapshotEvent(),
new LaunchCodesEvent(),
// World Objects
new ElevatorEvent(),
new GeyserEvent(),

View File

@ -0,0 +1,39 @@
using QSB.Events;
using QSB.Messaging;
namespace QSB.Player.Events
{
internal class LaunchCodesEvent : QSBEvent<PlayerMessage>
{
public override EventType Type => EventType.PlayerInformation;
public override void SetupListener() => GlobalMessenger.AddListener(EventNames.LaunchCodes, Handler);
public override void CloseListener() => GlobalMessenger.RemoveListener(EventNames.LaunchCodes, Handler);
private void Handler() => SendEvent(CreateMessage());
private PlayerMessage CreateMessage() => new PlayerMessage
{
AboutId = LocalPlayerId
};
public override void OnReceiveRemote(bool isHost, PlayerMessage message)
{
var flag = false;
if (!PlayerData._currentGameSave.PersistentConditionExists("LAUNCH_CODES_GIVEN"))
{
flag = true;
}
else if (PlayerData._currentGameSave.GetPersistentCondition("LAUNCH_CODES_GIVEN"))
{
flag = true;
}
if (flag)
{
PlayerData._currentGameSave.SetPersistentCondition("LAUNCH_CODES_GIVEN", true);
}
}
}
}

View File

@ -17,7 +17,13 @@ namespace QSB.Player.Events
{
AboutId = player.PlayerId,
PlayerName = player.Name,
PlayerState = player.PlayerStates,
IsReady = player.IsReady,
FlashlightActive = player.FlashlightActive,
SuitedUp = player.SuitedUp,
ProbeLauncherEquipped = player.ProbeLauncherEquipped,
SignalscopeEquipped = player.SignalscopeEquipped,
TranslatorEquipped = player.TranslatorEquipped,
ProbeActive = player.ProbeActive,
ClientState = player.State
};

View File

@ -7,23 +7,26 @@ namespace QSB.Player.Events
public class PlayerInformationMessage : PlayerMessage
{
public string PlayerName { get; set; }
public PlayerState PlayerState { get; set; }
public bool IsReady { get; set; }
public bool FlashlightActive { get; set; }
public bool SuitedUp { get; set; }
public bool ProbeLauncherEquipped { get; set; }
public bool SignalscopeEquipped { get; set; }
public bool TranslatorEquipped { get; set; }
public bool ProbeActive { get; set; }
public ClientState ClientState { get; set; }
public override void Deserialize(QNetworkReader reader)
{
base.Deserialize(reader);
PlayerName = reader.ReadString();
PlayerState = new PlayerState
{
IsReady = reader.ReadBoolean(),
FlashlightActive = reader.ReadBoolean(),
SuitedUp = reader.ReadBoolean(),
ProbeLauncherEquipped = reader.ReadBoolean(),
SignalscopeEquipped = reader.ReadBoolean(),
TranslatorEquipped = reader.ReadBoolean(),
ProbeActive = reader.ReadBoolean()
};
IsReady = reader.ReadBoolean();
FlashlightActive = reader.ReadBoolean();
SuitedUp = reader.ReadBoolean();
ProbeLauncherEquipped = reader.ReadBoolean();
SignalscopeEquipped = reader.ReadBoolean();
TranslatorEquipped = reader.ReadBoolean();
ProbeActive = reader.ReadBoolean();
ClientState = (ClientState)reader.ReadInt32();
}
@ -31,13 +34,13 @@ namespace QSB.Player.Events
{
base.Serialize(writer);
writer.Write(PlayerName);
writer.Write(PlayerState.IsReady);
writer.Write(PlayerState.FlashlightActive);
writer.Write(PlayerState.SuitedUp);
writer.Write(PlayerState.ProbeLauncherEquipped);
writer.Write(PlayerState.SignalscopeEquipped);
writer.Write(PlayerState.TranslatorEquipped);
writer.Write(PlayerState.ProbeActive);
writer.Write(IsReady);
writer.Write(FlashlightActive);
writer.Write(SuitedUp);
writer.Write(ProbeLauncherEquipped);
writer.Write(SignalscopeEquipped);
writer.Write(TranslatorEquipped);
writer.Write(ProbeActive);
writer.Write((int)ClientState);
}
}

View File

@ -70,7 +70,7 @@ namespace QSB.Player.Events
if (QSBSceneManager.IsInUniverse)
{
QSBPlayerManager.LocalPlayer.PlayerStates.IsReady = true;
QSBPlayerManager.LocalPlayer.IsReady = true;
QSBEventManager.FireEvent(EventNames.QSBPlayerReady, true);
}
}

View File

@ -35,7 +35,7 @@ namespace QSB.Player.Events
private static void HandleServer(ToggleMessage message)
{
DebugLog.DebugWrite($"[SERVER] Get ready event from {message.FromId}", MessageType.Success);
QSBPlayerManager.GetPlayer(message.AboutId).PlayerStates.IsReady = message.ToggleValue;
QSBPlayerManager.GetPlayer(message.AboutId).IsReady = message.ToggleValue;
QSBEventManager.FireEvent(EventNames.QSBPlayerInformation);
}

View File

@ -21,6 +21,6 @@ namespace QSB.Player.Patches
[HarmonyPrefix]
[HarmonyPatch(typeof(PauseMenuManager), nameof(PauseMenuManager.OnExitToMainMenu))]
public static void PauseMenuManager_OnExitToMainMenu()
=> QSBPlayerManager.LocalPlayer.PlayerStates.IsReady = false;
=> QSBPlayerManager.LocalPlayer.IsReady = false;
}
}

View File

@ -34,7 +34,7 @@ namespace QSB.Player
Initialize();
}
if (!_isReady || !_player.PlayerStates.IsReady)
if (!_isReady || !_player.IsReady)
{
return;
}

View File

@ -22,7 +22,6 @@ namespace QSB.Player
public uint PlayerId { get; }
public string Name { get; set; }
public PlayerHUDMarker HudMarker { get; set; }
public PlayerState PlayerStates { get; set; } = new PlayerState();
public PlayerTransformSync TransformSync { get; set; }
// Body Objects
@ -30,10 +29,11 @@ namespace QSB.Player
{
get
{
if (_camera == null && PlayerStates.IsReady)
if (_camera == null && IsReady)
{
DebugLog.ToConsole($"Warning - {PlayerId}.Camera is null!", MessageType.Warning);
}
return _camera;
}
set
@ -42,6 +42,7 @@ namespace QSB.Player
{
DebugLog.ToConsole($"Warning - Setting {PlayerId}.Camera to null.", MessageType.Warning);
}
_camera = value;
}
}
@ -52,7 +53,7 @@ namespace QSB.Player
{
get
{
if (_body == null && PlayerStates.IsReady)
if (_body == null && IsReady)
{
DebugLog.ToConsole($"Warning - {PlayerId}.Body is null!", MessageType.Warning);
}
@ -114,11 +115,18 @@ namespace QSB.Player
public JetpackAccelerationSync JetpackAcceleration { get; set; }
// Misc
public bool IsReady { get; set; }
public bool IsInMoon; // MOVE : move into PlayerStates?
public bool IsInShrine; // MOVE : move into PlayerStates?
public IQSBQuantumObject EntangledObject;
public bool IsDead { get; set; }
public ClientState State { get; set; }
public bool FlashlightActive { get; set; }
public bool SuitedUp { get; set; }
public bool ProbeLauncherEquipped { get; set; }
public bool SignalscopeEquipped { get; set; }
public bool TranslatorEquipped { get; set; }
public bool ProbeActive { get; set; }
// Local only
public PlayerProbeLauncher LocalProbeLauncher
@ -190,12 +198,12 @@ namespace QSB.Player
return;
}
FlashLight?.UpdateState(PlayerStates.FlashlightActive);
Translator?.ChangeEquipState(PlayerStates.TranslatorEquipped);
ProbeLauncher?.ChangeEquipState(PlayerStates.ProbeLauncherEquipped);
Signalscope?.ChangeEquipState(PlayerStates.SignalscopeEquipped);
FlashLight?.UpdateState(FlashlightActive);
Translator?.ChangeEquipState(TranslatorEquipped);
ProbeLauncher?.ChangeEquipState(ProbeLauncherEquipped);
Signalscope?.ChangeEquipState(SignalscopeEquipped);
QSBCore.UnityEvents.RunWhen(() => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId) != null,
() => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId).SetSuitState(PlayerStates.SuitedUp));
() => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId).SetSuitState(SuitedUp));
}
private QSBTool GetToolByType(ToolType type) => CameraBody?.GetComponentsInChildren<QSBTool>()

View File

@ -1,14 +0,0 @@
namespace QSB.Player
{
public class PlayerState
{
public bool IsReady { get; set; }
public bool FlashlightActive { get; set; }
public bool SuitedUp { get; set; }
public bool ProbeLauncherEquipped { get; set; }
public bool SignalscopeEquipped { get; set; }
public bool TranslatorEquipped { get; set; }
public bool ProbeActive { get; set; }
}
}

View File

@ -82,8 +82,14 @@ namespace QSB.Player
{
var player = GetPlayer(message.AboutId);
player.Name = message.PlayerName;
player.PlayerStates = message.PlayerState;
if (LocalPlayer.PlayerStates.IsReady)
player.IsReady = message.IsReady;
player.FlashlightActive = message.FlashlightActive;
player.SuitedUp = message.SuitedUp;
player.ProbeLauncherEquipped = message.ProbeLauncherEquipped;
player.SignalscopeEquipped = message.SignalscopeEquipped;
player.TranslatorEquipped = message.TranslatorEquipped;
player.ProbeActive = message.ProbeActive;
if (LocalPlayer.IsReady)
{
player.UpdateStateObjects();
}
@ -172,7 +178,7 @@ namespace QSB.Player
return null;
}
return playerList.Where(x => x.PlayerStates.IsReady).OrderBy(x => Vector3.Distance(x.Body.transform.position, worldPoint)).FirstOrDefault();
return playerList.Where(x => x.IsReady).OrderBy(x => Vector3.Distance(x.Body.transform.position, worldPoint)).FirstOrDefault();
}
public static IEnumerable<Tuple<PlayerInfo, IQSBOWItem>> GetPlayerCarryItems()

View File

@ -60,12 +60,12 @@ namespace QSB.Player.TransformSync
if (isInUniverse)
{
Player.PlayerStates.IsReady = true;
Player.IsReady = true;
QSBEventManager.FireEvent(EventNames.QSBPlayerReady, true);
}
else
{
Player.PlayerStates.IsReady = false;
Player.IsReady = false;
QSBEventManager.FireEvent(EventNames.QSBPlayerReady, false);
}

View File

@ -88,6 +88,7 @@
<Compile Include="ConversationSync\ConversationManager.cs" />
<Compile Include="DeathSync\EndLoopReason.cs" />
<Compile Include="DeathSync\Events\EndLoopEvent.cs" />
<Compile Include="Player\Events\LaunchCodesEvent.cs" />
<Compile Include="RespawnSync\Events\PlayerRespawnEvent.cs" />
<Compile Include="DeathSync\Events\StartLoopEvent.cs" />
<Compile Include="DeathSync\Patches\MapPatches.cs" />
@ -147,7 +148,6 @@
<Compile Include="Player\Events\RequestStateResyncEvent.cs" />
<Compile Include="Player\GamePlatform.cs" />
<Compile Include="Player\Patches\PlayerPatches.cs" />
<Compile Include="Player\PlayerState.cs" />
<Compile Include="PoolSync\CustomNomaiRemoteCameraPlatform.cs" />
<Compile Include="PoolSync\CustomNomaiRemoteCameraStreaming.cs" />
<Compile Include="ItemSync\Events\DropItemEvent.cs" />

View File

@ -1,5 +1,6 @@
using QSB.ClientServerStateSync;
using QSB.Events;
using QSB.Utility;
using UnityEngine;
namespace QSB.StatueSync.Events
@ -27,6 +28,8 @@ namespace QSB.StatueSync.Events
public override void OnReceiveLocal(bool server, StartStatueMessage message)
{
DebugLog.DebugWrite($"OnReceiveLocal StartStatueEvent");
if (!QSBCore.IsHost)
{
return;
@ -36,6 +39,9 @@ namespace QSB.StatueSync.Events
}
public override void OnReceiveRemote(bool server, StartStatueMessage message)
=> StatueManager.Instance.BeginSequence(message.PlayerPosition, message.PlayerRotation, message.CameraDegrees);
{
DebugLog.DebugWrite($"OnReceiveRemote StartStatueEvent");
StatueManager.Instance.BeginSequence(message.PlayerPosition, message.PlayerRotation, message.CameraDegrees);
}
}
}

View File

@ -1,4 +1,5 @@
using QSB.Player;
using QSB.Utility;
using System.Collections;
using UnityEngine;
@ -11,6 +12,7 @@ namespace QSB.StatueSync
private void Awake()
{
DebugLog.DebugWrite($"Awake");
Instance = this;
QSBSceneManager.OnUniverseSceneLoaded += (OWScene oldScene, OWScene newScene) => QSBPlayerManager.ShowAllPlayers();
}
@ -19,10 +21,14 @@ namespace QSB.StatueSync
=> QSBSceneManager.OnUniverseSceneLoaded -= (OWScene oldScene, OWScene newScene) => QSBPlayerManager.ShowAllPlayers();
public void BeginSequence(Vector3 position, Quaternion rotation, float cameraDegrees)
=> StartCoroutine(BeginRemoteUplinkSequence(position, rotation, cameraDegrees));
{
DebugLog.DebugWrite($"Begin Sequence");
StartCoroutine(BeginRemoteUplinkSequence(position, rotation, cameraDegrees));
}
private IEnumerator BeginRemoteUplinkSequence(Vector3 position, Quaternion rotation, float cameraDegrees)
{
DebugLog.DebugWrite($"Begin Remote Uplink Sequence");
HasStartedStatueLocally = true;
var cameraEffectController = Locator.GetPlayerCamera().GetComponent<PlayerCameraEffectController>();
cameraEffectController.CloseEyes(0.5f);

View File

@ -121,7 +121,7 @@ namespace QSB.Syncs.Sectored
{
writer.Write(-1);
}
else if (!Player.PlayerStates.IsReady)
else if (!Player.IsReady)
{
writer.Write(-1);
}

View File

@ -73,7 +73,7 @@ namespace QSB.Syncs
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
private bool _baseIsReady => QSBPlayerManager.PlayerExists(PlayerId)
&& Player != null
&& Player.PlayerStates.IsReady
&& Player.IsReady
&& NetId.Value != uint.MaxValue
&& NetId.Value != 0U
&& WorldObjectManager.AllReady;

View File

@ -1,5 +1,6 @@
using HarmonyLib;
using QSB.Patches;
using QSB.Utility;
namespace QSB.TimeSync.Patches
{
@ -11,8 +12,10 @@ namespace QSB.TimeSync.Patches
[HarmonyPrefix]
[HarmonyPatch(typeof(PlayerCameraEffectController), nameof(PlayerCameraEffectController.OnStartOfTimeLoop))]
public static bool PlayerCameraEffectController_OnStartOfTimeLoop()
=> false;
{
DebugLog.DebugWrite($"OnStartOfTimeLoop");
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(OWTime), nameof(OWTime.Pause))]
public static bool StopPausing()

View File

@ -32,11 +32,11 @@ namespace QSB.Tools.FlashlightTool.Events
public override void OnReceiveRemote(bool server, ToggleMessage message)
{
var player = QSBPlayerManager.GetPlayer(message.AboutId);
player.PlayerStates.FlashlightActive = message.ToggleValue;
player.FlashlightActive = message.ToggleValue;
player.FlashLight?.UpdateState(message.ToggleValue);
}
public override void OnReceiveLocal(bool server, ToggleMessage message) =>
QSBPlayerManager.LocalPlayer.PlayerStates.FlashlightActive = message.ToggleValue;
QSBPlayerManager.LocalPlayer.FlashlightActive = message.ToggleValue;
}
}

View File

@ -66,11 +66,11 @@ namespace QSB.Tools.ProbeLauncherTool.Events
public override void OnReceiveRemote(bool server, ToggleMessage message)
{
var player = QSBPlayerManager.GetPlayer(message.AboutId);
player.PlayerStates.ProbeLauncherEquipped = message.ToggleValue;
player.ProbeLauncherEquipped = message.ToggleValue;
player.ProbeLauncher?.ChangeEquipState(message.ToggleValue);
}
public override void OnReceiveLocal(bool server, ToggleMessage message) =>
QSBPlayerManager.LocalPlayer.PlayerStates.ProbeLauncherEquipped = message.ToggleValue;
QSBPlayerManager.LocalPlayer.ProbeLauncherEquipped = message.ToggleValue;
}
}

View File

@ -25,7 +25,7 @@ namespace QSB.Tools.ProbeTool.Events
public override void OnReceiveRemote(bool server, EnumMessage<ProbeEvent> message)
{
var player = QSBPlayerManager.GetPlayer(message.AboutId);
if (!player.PlayerStates.IsReady || player.Probe == null)
if (!player.IsReady || player.Probe == null)
{
return;
}

View File

@ -25,7 +25,7 @@ namespace QSB.Tools.ProbeTool.Events
public override void OnReceiveRemote(bool server, FloatMessage message)
{
var player = QSBPlayerManager.GetPlayer(message.AboutId);
if (!player.PlayerStates.IsReady || player.Probe == null)
if (!player.IsReady || player.Probe == null)
{
return;
}

View File

@ -32,11 +32,11 @@ namespace QSB.Tools.SignalscopeTool.Events
public override void OnReceiveRemote(bool server, ToggleMessage message)
{
var player = QSBPlayerManager.GetPlayer(message.AboutId);
player.PlayerStates.SignalscopeEquipped = message.ToggleValue;
player.SignalscopeEquipped = message.ToggleValue;
player.Signalscope?.ChangeEquipState(message.ToggleValue);
}
public override void OnReceiveLocal(bool server, ToggleMessage message) =>
QSBPlayerManager.LocalPlayer.PlayerStates.SignalscopeEquipped = message.ToggleValue;
QSBPlayerManager.LocalPlayer.SignalscopeEquipped = message.ToggleValue;
}
}

View File

@ -32,11 +32,11 @@ namespace QSB.Tools.TranslatorTool.Events
public override void OnReceiveRemote(bool server, ToggleMessage message)
{
var player = QSBPlayerManager.GetPlayer(message.AboutId);
player.PlayerStates.TranslatorEquipped = message.ToggleValue;
player.TranslatorEquipped = message.ToggleValue;
player.Translator?.ChangeEquipState(message.ToggleValue);
}
public override void OnReceiveLocal(bool server, ToggleMessage message) =>
QSBPlayerManager.LocalPlayer.PlayerStates.TranslatorEquipped = message.ToggleValue;
QSBPlayerManager.LocalPlayer.TranslatorEquipped = message.ToggleValue;
}
}

View File

@ -3,6 +3,9 @@ using QSB.ClientServerStateSync;
using QSB.OrbSync.TransformSync;
using QSB.Player;
using QSB.QuantumSync;
using QSB.ShipSync;
using QSB.ShipSync.TransformSync;
using QSB.ShipSync.WorldObjects;
using QSB.Syncs;
using QSB.TimeSync;
using QSB.WorldSync;
@ -96,8 +99,11 @@ namespace QSB.Utility
{
WriteLine(1, $"Reason : NULL");
}
WriteLine(1, $"Time Difference : {WakeUpSync.LocalInstance.GetTimeDifference()}");
WriteLine(1, $"Timescale : {OWTime.GetTimeScale()}");
WriteLine(1, $"Time Remaining : {Mathf.Floor(TimeLoop.GetSecondsRemaining() / 60f)}:{Mathf.Round(TimeLoop.GetSecondsRemaining() % 60f * 100f / 100f)}");
WriteLine(1, $"Loop Count : {TimeLoop.GetLoopCount()}");
}
#endregion
@ -110,35 +116,56 @@ namespace QSB.Utility
WriteLine(2, $"State : {player.State}");
WriteLine(2, $"Dead : {player.IsDead}");
WriteLine(2, $"Visible : {player.Visible}");
WriteLine(2, $"Ready : {player.IsReady}");
if (player.PlayerStates.IsReady && QSBCore.WorldObjectsReady)
if (player.IsReady && QSBCore.WorldObjectsReady)
{
var networkTransform = player.TransformSync;
var referenceSector = networkTransform.ReferenceSector;
var referenceTransform = networkTransform.ReferenceTransform;
var parent = networkTransform.AttachedObject?.transform.parent;
var intermediary = networkTransform.GetValue<IntermediaryTransform>("_intermediaryTransform");
var interTransform = intermediary.GetReferenceTransform();
WriteLine(2, $" - L.Pos : {networkTransform.transform.localPosition}");
WriteLine(2, $" - Ref. Sector : {(referenceSector == null ? "NULL" : referenceSector.Name)}");
WriteLine(2, $" - Ref. Transform : {(referenceTransform == null ? "NULL" : referenceTransform.name)}");
WriteLine(2, $" - Inter. Ref. Transform : {(interTransform == null ? "NULL" : interTransform.name)}");
WriteLine(2, $" - Parent : {(parent == null ? "NULL" : parent.name)}");
/*
var probeSync = SyncBase.GetPlayers<PlayerProbeSync>(player);
if (probeSync != default)
{
var probeSector = probeSync.ReferenceSector;
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Probe Sector : {(probeSector == null ? "NULL" : probeSector.Name)}", guiStyle);
offset2 += _debugLineSpacing;
}
*/
}
}
#endregion
#region Column3 - Ship data
WriteLine(3, $"Current Flyer : {ShipManager.Instance.CurrentFlyer}");
if (ShipTransformSync.LocalInstance != null)
{
var instance = ShipTransformSync.LocalInstance;
if (QSBCore.IsHost)
{
WriteLine(3, $"Current Owner : {instance.NetIdentity.ClientAuthorityOwner.GetPlayerId()}");
}
var sector = instance.ReferenceSector;
WriteLine(3, $"Ref. Sector : {(sector != null ? sector.Name : "NULL")}");
var transform = instance.ReferenceTransform;
WriteLine(3, $"Ref. Transform : {(transform != null ? transform.name : "NULL")}");
}
else
{
WriteLine(3, $"ShipTransformSync.LocalInstance is null.");
}
WriteLine(3, $"QSBShipComponent");
foreach (var component in QSBWorldSync.GetWorldObjects<QSBShipComponent>())
{
WriteLine(3, $"- {component.AttachedObject.name} RepairFraction:{component.AttachedObject._repairFraction}");
}
WriteLine(3, $"QSBShipHull");
foreach (var hull in QSBWorldSync.GetWorldObjects<QSBShipHull>())
{
WriteLine(3, $"- {hull.AttachedObject.name}, Integrity:{hull.AttachedObject.integrity}");
}
#endregion
#region Column4 - Quantum Object Possesion
foreach (var player in QSBPlayerManager.PlayerList)
{
WriteLine(4, $"- {player.PlayerId}.{player.Name}");
@ -151,6 +178,7 @@ namespace QSB.Utility
WriteLine(4, $"{qsbObj.Name} ({qsbObj.ObjectId})");
}
}
#endregion
}
}
}

View File

@ -44,13 +44,13 @@ namespace QSB.WorldSync
return;
}
if (QSBPlayerManager.LocalPlayer.PlayerStates.IsReady)
if (QSBPlayerManager.LocalPlayer.IsReady)
{
DoRebuild(scene);
return;
}
QSBCore.UnityEvents.RunWhen(() => QSBPlayerManager.LocalPlayer.PlayerStates.IsReady, () => DoRebuild(scene));
QSBCore.UnityEvents.RunWhen(() => QSBPlayerManager.LocalPlayer.IsReady, () => DoRebuild(scene));
}
private static void DoRebuild(OWScene scene)