diff --git a/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs b/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs index 50390461..297524da 100644 --- a/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs +++ b/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs @@ -70,7 +70,6 @@ namespace QSB.Anglerfish.TransformSync base.OnRenderObject(); if (!QSBCore.WorldObjectsReady - || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug || !IsReady || ReferenceTransform == null) diff --git a/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs b/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs index 6d291293..956373f3 100644 --- a/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs +++ b/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs @@ -85,7 +85,7 @@ namespace QSB.Animation.Player.Thrusters private void OnRenderObject() { - if (!QSBCore.WorldObjectsReady || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug) + if (!QSBCore.WorldObjectsReady || !QSBCore.ShowLinesInDebug) { return; } diff --git a/QSB/Menus/MenuManager.cs b/QSB/Menus/MenuManager.cs index c24595ce..7ac927ca 100644 --- a/QSB/Menus/MenuManager.cs +++ b/QSB/Menus/MenuManager.cs @@ -136,7 +136,7 @@ namespace QSB.Menus OnConnected(); - if (QSBCore.DebugMode) + if (QSBCore.SkipTitleScreen) { Application.runInBackground = true; var titleScreenManager = FindObjectOfType(); diff --git a/QSB/Player/TransformSync/PlayerTransformSync.cs b/QSB/Player/TransformSync/PlayerTransformSync.cs index 11c31d8d..174eb779 100644 --- a/QSB/Player/TransformSync/PlayerTransformSync.cs +++ b/QSB/Player/TransformSync/PlayerTransformSync.cs @@ -250,7 +250,6 @@ namespace QSB.Player.TransformSync base.OnRenderObject(); if (!QSBCore.WorldObjectsReady - || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug || !IsReady || ReferenceTransform == null) diff --git a/QSB/QSB.csproj b/QSB/QSB.csproj index 2ed810f4..d352d868 100644 --- a/QSB/QSB.csproj +++ b/QSB/QSB.csproj @@ -77,4 +77,9 @@ copy /y "$(OwmlDir)\OWML.Abstractions.dll" $(UnityAssetsDir) PreserveNewest + + + Always + + \ No newline at end of file diff --git a/QSB/QSBCore.cs b/QSB/QSBCore.cs index 63543f10..8817793e 100644 --- a/QSB/QSBCore.cs +++ b/QSB/QSBCore.cs @@ -60,8 +60,12 @@ namespace QSB public static IModUnityEvents UnityEvents => Helper.Events.Unity; public static string DefaultServerIP { get; private set; } public static int Port { get; private set; } - public static bool DebugMode { get; private set; } - public static bool ShowLinesInDebug { get; private set; } + public static bool DebugMode => DebugSettings.DebugMode; + public static bool ShowLinesInDebug => DebugMode && DebugSettings.DrawLines; + public static bool ShowQuantumVisibilityObjects => DebugMode && DebugSettings.ShowQuantumVisibilityObjects; + public static bool ShowQuantumDebugBoxes => DebugMode && DebugSettings.ShowQuantumDebugBoxes; + public static bool AvoidTimeSync => DebugMode && DebugSettings.AvoidTimeSync; + public static bool SkipTitleScreen => DebugMode && DebugSettings.SkipTitleScreen; public static AssetBundle NetworkAssetBundle { get; private set; } public static AssetBundle InstrumentAssetBundle { get; private set; } public static AssetBundle ConversationAssetBundle { get; private set; } @@ -76,6 +80,8 @@ namespace QSB : GamePlatform.Steam; public static IMenuAPI MenuApi { get; private set; } + private static DebugSettings DebugSettings { get; set; } = new DebugSettings(); + public void Awake() { var instance = TextTranslation.Get().m_table; @@ -95,6 +101,13 @@ namespace QSB ConversationAssetBundle = Helper.Assets.LoadBundle("AssetBundles/conversation"); DebugAssetBundle = Helper.Assets.LoadBundle("AssetBundles/debug"); + DebugSettings = ModHelper.Storage.Load("debugsettings.json"); + + if (DebugSettings == null) + { + DebugSettings = new DebugSettings(); + } + QSBPatchManager.Init(); gameObject.AddComponent(); @@ -167,9 +180,6 @@ namespace QSB { QSBNetworkManager.Instance.networkPort = Port; } - - DebugMode = config.GetSettingsValue("debugMode"); - ShowLinesInDebug = config.GetSettingsValue("showLinesInDebug"); } } } diff --git a/QSB/QuantumSync/Events/MultiStateChangeEvent.cs b/QSB/QuantumSync/Events/MultiStateChangeEvent.cs index c1fe429c..22ff119a 100644 --- a/QSB/QuantumSync/Events/MultiStateChangeEvent.cs +++ b/QSB/QuantumSync/Events/MultiStateChangeEvent.cs @@ -24,7 +24,7 @@ namespace QSB.QuantumSync.Events public override void OnReceiveLocal(bool server, MultiStateChangeMessage message) { - if (!QSBCore.DebugMode) + if (!QSBCore.ShowQuantumDebugBoxes) { return; } diff --git a/QSB/QuantumSync/QuantumManager.cs b/QSB/QuantumSync/QuantumManager.cs index 97aed940..7436452d 100644 --- a/QSB/QuantumSync/QuantumManager.cs +++ b/QSB/QuantumSync/QuantumManager.cs @@ -67,7 +67,7 @@ namespace QSB.QuantumSync public void OnRenderObject() { - if (!QSBCore.WorldObjectsReady || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug) + if (!QSBCore.WorldObjectsReady || !QSBCore.ShowLinesInDebug) { return; } diff --git a/QSB/QuantumSync/WorldObjects/QSBMultiStateQuantumObject.cs b/QSB/QuantumSync/WorldObjects/QSBMultiStateQuantumObject.cs index 0118386e..f565af2c 100644 --- a/QSB/QuantumSync/WorldObjects/QSBMultiStateQuantumObject.cs +++ b/QSB/QuantumSync/WorldObjects/QSBMultiStateQuantumObject.cs @@ -26,7 +26,7 @@ namespace QSB.QuantumSync.WorldObjects ObjectId = id; AttachedObject = attachedObject; - if (QSBCore.DebugMode) + if (QSBCore.ShowQuantumDebugBoxes) { DebugBoxText = DebugBoxManager.CreateBox(AttachedObject.transform, 0, $"Multistate\r\nid:{id}\r\nstate:{CurrentState}").GetComponent(); } @@ -53,7 +53,7 @@ namespace QSB.QuantumSync.WorldObjects QuantumStates[newStateIndex].SetVisible(true); AttachedObject._stateIndex = newStateIndex; - if (QSBCore.DebugMode) + if (QSBCore.ShowQuantumDebugBoxes) { DebugBoxText.text = $"Multistate\r\nid:{ObjectId}\r\nstate:{CurrentState}"; } diff --git a/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs b/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs index 374f0bae..e29b2835 100644 --- a/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs +++ b/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs @@ -64,7 +64,7 @@ namespace QSB.QuantumSync.WorldObjects shape.OnShapeDeactivated += (Shape s) => QSBCore.UnityEvents.FireOnNextUpdate(() => OnDisable(s)); - if (QSBCore.DebugMode) + if (QSBCore.ShowQuantumVisibilityObjects) { if (shape is BoxShape boxShape) { diff --git a/QSB/QuantumSync/WorldObjects/QSBSocketedQuantumObject.cs b/QSB/QuantumSync/WorldObjects/QSBSocketedQuantumObject.cs index fe381047..621881c9 100644 --- a/QSB/QuantumSync/WorldObjects/QSBSocketedQuantumObject.cs +++ b/QSB/QuantumSync/WorldObjects/QSBSocketedQuantumObject.cs @@ -18,7 +18,7 @@ namespace QSB.QuantumSync.WorldObjects ObjectId = id; AttachedObject = quantumObject; base.Init(quantumObject, id); - if (QSBCore.DebugMode) + if (QSBCore.ShowQuantumDebugBoxes) { DebugBoxText = DebugBoxManager.CreateBox(AttachedObject.transform, 0, $"Socketed\r\nid:{ObjectId}").GetComponent(); } diff --git a/QSB/RespawnSync/RespawnManager.cs b/QSB/RespawnSync/RespawnManager.cs index c6200a00..5ead6164 100644 --- a/QSB/RespawnSync/RespawnManager.cs +++ b/QSB/RespawnSync/RespawnManager.cs @@ -48,6 +48,11 @@ namespace QSB.RespawnSync private void Init(OWScene newScene, bool inUniverse) { + if (!QSBCore.IsInMultiplayer) + { + return; + } + QSBPlayerManager.ShowAllPlayers(); QSBPlayerManager.LocalPlayer.UpdateStatesFromObjects(); QSBPlayerManager.PlayerList.ForEach(x => x.IsDead = false); diff --git a/QSB/StatueSync/StatueManager.cs b/QSB/StatueSync/StatueManager.cs index b3b90d03..6ee6ebee 100644 --- a/QSB/StatueSync/StatueManager.cs +++ b/QSB/StatueSync/StatueManager.cs @@ -20,6 +20,11 @@ namespace QSB.StatueSync private void OnUniverseSceneLoaded(OWScene oldScene, OWScene newScene) { + if (!QSBCore.IsInMultiplayer) + { + return; + } + QSBPlayerManager.ShowAllPlayers(); QSBPlayerManager.LocalPlayer.UpdateStatesFromObjects(); } diff --git a/QSB/Syncs/SyncBase.cs b/QSB/Syncs/SyncBase.cs index 1a2dea9c..edb48a94 100644 --- a/QSB/Syncs/SyncBase.cs +++ b/QSB/Syncs/SyncBase.cs @@ -299,7 +299,6 @@ namespace QSB.Syncs protected virtual void OnRenderObject() { if (!QSBCore.WorldObjectsReady - || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug || !IsReady || ReferenceTransform == null) diff --git a/QSB/TimeSync/WakeUpSync.cs b/QSB/TimeSync/WakeUpSync.cs index 399af9ac..c3ff6069 100644 --- a/QSB/TimeSync/WakeUpSync.cs +++ b/QSB/TimeSync/WakeUpSync.cs @@ -121,7 +121,10 @@ namespace QSB.TimeSync } else { - WakeUpOrSleep(); + if (!QSBCore.SkipTitleScreen) + { + WakeUpOrSleep(); + } } } @@ -240,7 +243,7 @@ namespace QSB.TimeSync { UpdateServer(); } - else if (IsLocalPlayer) + else if (IsLocalPlayer && !QSBCore.AvoidTimeSync) { UpdateClient(); } diff --git a/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs b/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs index 2d4f31bf..e4d0b9f1 100644 --- a/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs +++ b/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs @@ -76,7 +76,7 @@ namespace QSB.Tools.TranslatorTool private void OnRenderObject() { - if (!QSBCore.WorldObjectsReady || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug) + if (!QSBCore.WorldObjectsReady || !QSBCore.ShowLinesInDebug) { return; } diff --git a/QSB/Utility/DebugSettings.cs b/QSB/Utility/DebugSettings.cs new file mode 100644 index 00000000..690b4051 --- /dev/null +++ b/QSB/Utility/DebugSettings.cs @@ -0,0 +1,25 @@ +using Newtonsoft.Json; + +namespace QSB.Utility +{ + public class DebugSettings + { + [JsonProperty("debugMode")] + public bool DebugMode { get; set; } = false; + + [JsonProperty("drawLines")] + public bool DrawLines { get; set; } = false; + + [JsonProperty("showQuantumVisibilityObjects")] + public bool ShowQuantumVisibilityObjects { get; set; } = false; + + [JsonProperty("showQuantumDebugBoxes")] + public bool ShowQuantumDebugBoxes { get; set; } = false; + + [JsonProperty("avoidTimeSync")] + public bool AvoidTimeSync { get; set; } = false; + + [JsonProperty("skipTitleScreen")] + public bool SkipTitleScreen { get; set; } = false; + } +} diff --git a/QSB/Utility/VariableSync/VariableReference.cs b/QSB/Utility/VariableSync/VariableReference.cs index 783d1e62..cf2f6006 100644 --- a/QSB/Utility/VariableSync/VariableReference.cs +++ b/QSB/Utility/VariableSync/VariableReference.cs @@ -1,4 +1,5 @@ using QSB.Player; +using QSB.Player.TransformSync; using System; namespace QSB.Utility.VariableSync @@ -18,7 +19,7 @@ namespace QSB.Utility.VariableSync } else { - if (QSBPlayerManager.LocalPlayer.IsReady) + if (PlayerTransformSync.LocalInstance != null && QSBPlayerManager.LocalPlayer.IsReady) { DebugLog.ToConsole($"Warning - Getter is null!", OWML.Common.MessageType.Warning); } @@ -34,7 +35,7 @@ namespace QSB.Utility.VariableSync } else { - if (QSBPlayerManager.LocalPlayer.IsReady) + if (PlayerTransformSync.LocalInstance != null && QSBPlayerManager.LocalPlayer.IsReady) { DebugLog.ToConsole($"Warning - Setter is null!", OWML.Common.MessageType.Warning); } diff --git a/QSB/debugsettings.json b/QSB/debugsettings.json new file mode 100644 index 00000000..2ec19b85 --- /dev/null +++ b/QSB/debugsettings.json @@ -0,0 +1,8 @@ +{ + "debugMode": true, + "drawLines": true, + "showQuantumVisibilityObjects": false, + "showQuantumDebugBoxes": false, + "avoidTimeSync": true, + "skipTitleScreen": true +} \ No newline at end of file diff --git a/QSB/default-config.json b/QSB/default-config.json index fedee1d0..c56d3d74 100644 --- a/QSB/default-config.json +++ b/QSB/default-config.json @@ -2,8 +2,6 @@ "enabled": true, "settings": { "defaultServerIP": "localhost", - "port": 7777, - "debugMode": true, - "showLinesInDebug": false + "port": 7777 } } \ No newline at end of file