mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-12-11 20:15:10 +01:00
move debug settings to config
This commit is contained in:
parent
eedb8d8fca
commit
72f298c2d8
@ -64,7 +64,7 @@ public class AnglerTransformSync : UnsectoredRigidbodySync, ILinkedNetworkBehavi
|
||||
|
||||
protected override void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DrawLines
|
||||
if (!QSBCore.DrawLines
|
||||
|| !IsValid
|
||||
|| !ReferenceTransform
|
||||
|| !AttachedTransform.gameObject.activeInHierarchy)
|
||||
|
||||
@ -105,7 +105,7 @@ public class RemoteThrusterFlameController : MonoBehaviour
|
||||
|
||||
private void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DrawLines || !QSBWorldSync.AllObjectsReady)
|
||||
if (!QSBCore.DrawLines || !QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class DeathPatches : QSBPatch
|
||||
}
|
||||
|
||||
var deadPlayersCount = QSBPlayerManager.PlayerList.Count(x => x.IsDead);
|
||||
if (deadPlayersCount == QSBPlayerManager.PlayerList.Count - 1 && !QSBCore.DebugSettings.DisableLoopDeath)
|
||||
if (deadPlayersCount == QSBPlayerManager.PlayerList.Count - 1)
|
||||
{
|
||||
new EndLoopMessage().Send();
|
||||
DebugLog.DebugWrite($"- All players are dead.");
|
||||
|
||||
@ -230,7 +230,7 @@ public class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
previousMessages.Push(message);
|
||||
|
||||
if (QSBCore.DebugSettings.DebugMode && CommandInterpreter.InterpretCommand(message))
|
||||
if (QSBCore.DebugMode && CommandInterpreter.InterpretCommand(message))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public class JellyfishTransformSync : UnsectoredRigidbodySync, ILinkedNetworkBeh
|
||||
|
||||
protected override void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DrawLines
|
||||
if (!QSBCore.DrawLines
|
||||
|| !IsValid
|
||||
|| !ReferenceTransform
|
||||
|| !AttachedTransform.gameObject.activeInHierarchy)
|
||||
|
||||
@ -71,7 +71,7 @@ public class MenuManager : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
QSBLocalization.LanguageChanged += OnLanguageChanged;
|
||||
|
||||
if (QSBCore.DebugSettings.AutoStart)
|
||||
if (QSBCore.AutoStart)
|
||||
{
|
||||
// auto host/connect
|
||||
Delay.RunWhen(PlayerData.IsLoaded, () =>
|
||||
|
||||
@ -49,7 +49,7 @@ public static class QSBMessageManager
|
||||
NetworkServer.RegisterHandler<Wrapper>((_, wrapper) => OnServerReceive(wrapper));
|
||||
NetworkClient.RegisterHandler<Wrapper>(wrapper => OnClientReceive(wrapper));
|
||||
|
||||
if (!QSBCore.DebugSettings.LogQSBMessages)
|
||||
if (!QSBCore.LogQSBMessages)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -169,7 +169,7 @@ public static class QSBMessageManager
|
||||
|
||||
public static void SaveRXTX(QSBMessage msg, bool transmit)
|
||||
{
|
||||
if (!QSBCore.DebugSettings.LogQSBMessages)
|
||||
if (!QSBCore.LogQSBMessages)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -62,13 +62,6 @@ public class PlayerJoinMessage : QSBMessage
|
||||
{
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
if (QSBCore.DebugSettings.KickEveryone)
|
||||
{
|
||||
DebugLog.ToConsole($"Kicking {PlayerName} because of DebugSettings.KickEveryone", MessageType.Error);
|
||||
new PlayerKickMessage(From, "This server has DebugSettings.KickEveryone enabled.").Send();
|
||||
return;
|
||||
}
|
||||
|
||||
if (QSBVersion != QSBCore.QSBVersion)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Client {PlayerName} connecting with wrong QSB version. (Client:{QSBVersion}, Server:{QSBCore.QSBVersion})", MessageType.Error);
|
||||
|
||||
@ -111,7 +111,7 @@ public class PlayerTransformSync : SectoredTransformSync
|
||||
|
||||
protected override void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DrawLines
|
||||
if (!QSBCore.DrawLines
|
||||
|| !IsValid
|
||||
|| !ReferenceTransform)
|
||||
{
|
||||
|
||||
@ -66,9 +66,6 @@
|
||||
</None>
|
||||
<None Remove="AssetBundles\AssetBundles" />
|
||||
<None Remove="AssetBundles\*.manifest" />
|
||||
<None Condition="Exists('debugsettings.json')" Include="debugsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="..\Lib\*.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@ -72,15 +72,45 @@ public class QSBCore : ModBehaviour
|
||||
public static bool TextChatInput { get; private set; }
|
||||
public static string SkinVariation { get; private set; } = "Default";
|
||||
public static string JetpackVariation { get; private set; } = "Orange";
|
||||
public static int Timeout { get; private set; }
|
||||
|
||||
public static bool DebugMode { get; private set; }
|
||||
|
||||
private static bool _instanceIdInLogs;
|
||||
public static bool InstanceIDInLogs => DebugMode && _instanceIdInLogs;
|
||||
|
||||
private static bool _hookDebugLogs;
|
||||
public static bool HookDebugLogs => DebugMode && _hookDebugLogs;
|
||||
|
||||
private static bool _avoidTimeSync;
|
||||
public static bool AvoidTimeSync => DebugMode && _avoidTimeSync;
|
||||
|
||||
private static bool _autoStart;
|
||||
public static bool AutoStart => DebugMode && _autoStart;
|
||||
|
||||
private static bool _drawGUI;
|
||||
public static bool DrawGUI => DebugMode && _drawGUI;
|
||||
|
||||
private static bool _drawLines;
|
||||
public static bool DrawLines => DebugMode && _drawLines;
|
||||
|
||||
private static bool _drawLabels;
|
||||
public static bool DrawLabels => DebugMode && _drawLabels;
|
||||
|
||||
private static bool _greySkybox;
|
||||
public static bool GreySkybox => DebugMode && _greySkybox;
|
||||
|
||||
private static float _latencySimulation;
|
||||
public static float LatencySimulation => DebugMode ? _latencySimulation : 0;
|
||||
|
||||
private static bool _logQSBMessages;
|
||||
public static bool LogQSBMessages => DebugMode && _logQSBMessages;
|
||||
|
||||
public static GameVendor GameVendor { get; private set; } = GameVendor.None;
|
||||
public static bool IsStandalone => GameVendor is GameVendor.Epic or GameVendor.Steam;
|
||||
public static IProfileManager ProfileManager => IsStandalone
|
||||
? QSBStandaloneProfileManager.SharedInstance
|
||||
: QSBMSStoreProfileManager.SharedInstance;
|
||||
public static DebugSettings DebugSettings { get; private set; } = new();
|
||||
|
||||
private static string randomSkinType;
|
||||
private static string randomJetpackType;
|
||||
|
||||
public static Assembly QSBNHAssembly = null;
|
||||
|
||||
@ -217,9 +247,7 @@ public class QSBCore : ModBehaviour
|
||||
|
||||
CheckNewHorizons();
|
||||
|
||||
DebugSettings = Helper.Storage.Load<DebugSettings>("debugsettings.json") ?? new DebugSettings();
|
||||
|
||||
if (DebugSettings.HookDebugLogs)
|
||||
if (HookDebugLogs)
|
||||
{
|
||||
Application.logMessageReceived += (condition, stackTrace, logType) =>
|
||||
DebugLog.ToConsole(
|
||||
@ -237,10 +265,9 @@ public class QSBCore : ModBehaviour
|
||||
);
|
||||
}
|
||||
|
||||
if (DebugSettings.AutoStart)
|
||||
if (AutoStart)
|
||||
{
|
||||
UseKcpTransport = true;
|
||||
DebugSettings.DebugMode = true;
|
||||
}
|
||||
|
||||
RegisterAddons();
|
||||
@ -273,19 +300,6 @@ public class QSBCore : ModBehaviour
|
||||
QSBWorldSync.Managers = components.OfType<WorldObjectManager>().ToArray();
|
||||
QSBPatchManager.OnPatchType += OnPatchType;
|
||||
QSBPatchManager.OnUnpatchType += OnUnpatchType;
|
||||
|
||||
if (DebugSettings.RandomizeSkins)
|
||||
{
|
||||
var skinSetting = (JObject)ModHelper.Config.Settings["skinType"];
|
||||
var skinOptions = skinSetting["options"].ToObject<string[]>();
|
||||
randomSkinType = skinOptions[UnityEngine.Random.Range(0, skinOptions.Length - 1)];
|
||||
|
||||
var jetpackSetting = (JObject)ModHelper.Config.Settings["jetpackType"];
|
||||
var jetpackOptions = jetpackSetting["options"].ToObject<string[]>();
|
||||
randomJetpackType = jetpackOptions[UnityEngine.Random.Range(0, jetpackOptions.Length - 1)];
|
||||
|
||||
Configure(ModHelper.Config);
|
||||
}
|
||||
}
|
||||
|
||||
private AssetBundle LoadBundle(string bundleName)
|
||||
@ -402,7 +416,29 @@ public class QSBCore : ModBehaviour
|
||||
|
||||
public override void Configure(IModConfig config)
|
||||
{
|
||||
UseKcpTransport = config.GetSettingsValue<bool>("useKcpTransport") || DebugSettings.AutoStart;
|
||||
DebugMode = config.GetSettingsValue<bool>("debugMode");
|
||||
|
||||
if (GetComponent<DebugActions>() != null)
|
||||
{
|
||||
GetComponent<DebugActions>().enabled = DebugMode;
|
||||
GetComponent<DebugGUI>().enabled = DebugMode;
|
||||
}
|
||||
|
||||
_instanceIdInLogs = config.GetSettingsValue<bool>("instanceIdInLogs");
|
||||
_hookDebugLogs = config.GetSettingsValue<bool>("hookDebugLogs");
|
||||
_avoidTimeSync = config.GetSettingsValue<bool>("avoidTimeSync");
|
||||
_autoStart = config.GetSettingsValue<bool>("autoStart");
|
||||
_drawGUI = config.GetSettingsValue<bool>("drawGui");
|
||||
_drawLines = config.GetSettingsValue<bool>("drawLines");
|
||||
_drawLabels = config.GetSettingsValue<bool>("drawLabels");
|
||||
_greySkybox = config.GetSettingsValue<bool>("greySkybox");
|
||||
_latencySimulation = config.GetSettingsValue<int>("latencySimulation");
|
||||
_logQSBMessages = config.GetSettingsValue<bool>("logQSBMessages");
|
||||
|
||||
DebugCameraSettings.UpdateFromDebugSetting();
|
||||
|
||||
Timeout = config.GetSettingsValue<int>("timeout");
|
||||
UseKcpTransport = config.GetSettingsValue<bool>("useKcpTransport") || AutoStart;
|
||||
var foundValue = config.GetSettingsValue<int>("kcpPort");
|
||||
KcpPort = (ushort)Mathf.Clamp(foundValue, ushort.MinValue, ushort.MaxValue);
|
||||
QSBNetworkManager.UpdateTransport();
|
||||
@ -414,16 +450,8 @@ public class QSBCore : ModBehaviour
|
||||
TextChatInput = config.GetSettingsValue<bool>("textChatInput");
|
||||
AlwaysShowPlanetIcons = config.GetSettingsValue<bool>("alwaysShowPlanetIcons");
|
||||
|
||||
if (DebugSettings.RandomizeSkins)
|
||||
{
|
||||
SkinVariation = randomSkinType;
|
||||
JetpackVariation = randomJetpackType;
|
||||
}
|
||||
else
|
||||
{
|
||||
SkinVariation = config.GetSettingsValue<string>("skinType");
|
||||
JetpackVariation = config.GetSettingsValue<string>("jetpackType");
|
||||
}
|
||||
|
||||
if (IsHost)
|
||||
{
|
||||
@ -442,13 +470,13 @@ public class QSBCore : ModBehaviour
|
||||
{
|
||||
if (Keyboard.current[Key.Q].isPressed && Keyboard.current[Key.NumpadEnter].wasPressedThisFrame)
|
||||
{
|
||||
DebugSettings.DebugMode = !DebugSettings.DebugMode;
|
||||
DebugMode = !DebugMode;
|
||||
|
||||
GetComponent<DebugActions>().enabled = DebugSettings.DebugMode;
|
||||
GetComponent<DebugGUI>().enabled = DebugSettings.DebugMode;
|
||||
GetComponent<DebugActions>().enabled = DebugMode;
|
||||
GetComponent<DebugGUI>().enabled = DebugMode;
|
||||
DebugCameraSettings.UpdateFromDebugSetting();
|
||||
|
||||
DebugLog.ToConsole($"DEBUG MODE = {DebugSettings.DebugMode}");
|
||||
DebugLog.ToConsole($"DEBUG MODE = {DebugMode}");
|
||||
}
|
||||
|
||||
if (_steamworksInitialized)
|
||||
|
||||
@ -79,23 +79,23 @@ public class QSBNetworkManager : NetworkManager, IAddComponentOnStart
|
||||
{
|
||||
_kcpTransport = gameObject.AddComponent<kcp2k.KcpTransport>();
|
||||
// KCP uses milliseconds
|
||||
_kcpTransport.Timeout = QSBCore.DebugSettings.Timeout * 1000;
|
||||
_kcpTransport.Timeout = QSBCore.Timeout * 1000;
|
||||
_kcpTransport.Port = QSBCore.KcpPort;
|
||||
}
|
||||
|
||||
{
|
||||
_steamTransport = gameObject.AddComponent<FizzySteamworks>();
|
||||
// Steam uses seconds
|
||||
_steamTransport.Timeout = QSBCore.DebugSettings.Timeout;
|
||||
_steamTransport.Timeout = QSBCore.Timeout;
|
||||
}
|
||||
|
||||
{
|
||||
_latencyTransport = gameObject.AddComponent<LatencySimulation>();
|
||||
_latencyTransport.reliableLatency = _latencyTransport.unreliableLatency = QSBCore.DebugSettings.LatencySimulation;
|
||||
_latencyTransport.reliableLatency = _latencyTransport.unreliableLatency = QSBCore.LatencySimulation;
|
||||
_latencyTransport.wrap = QSBCore.UseKcpTransport ? _kcpTransport : _steamTransport;
|
||||
}
|
||||
|
||||
transport = QSBCore.DebugSettings.LatencySimulation > 0
|
||||
transport = QSBCore.LatencySimulation > 0
|
||||
? _latencyTransport
|
||||
: QSBCore.UseKcpTransport ? _kcpTransport : _steamTransport;
|
||||
|
||||
@ -176,7 +176,7 @@ public class QSBNetworkManager : NetworkManager, IAddComponentOnStart
|
||||
|
||||
if (singleton != null)
|
||||
{
|
||||
if (QSBCore.DebugSettings.LatencySimulation > 0)
|
||||
if (QSBCore.LatencySimulation > 0)
|
||||
{
|
||||
_latencyTransport.wrap = QSBCore.UseKcpTransport ? _kcpTransport : _steamTransport;
|
||||
singleton.transport = Transport.active = _latencyTransport;
|
||||
|
||||
@ -56,7 +56,7 @@ public class QuantumManager : WorldObjectManager
|
||||
|
||||
public void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DrawLines)
|
||||
if (!QSBCore.DrawLines)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ public class RespawnManager : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
var deadPlayersCount = QSBPlayerManager.PlayerList.Count(x => x.IsDead);
|
||||
|
||||
if (deadPlayersCount == QSBPlayerManager.PlayerList.Count && !QSBCore.DebugSettings.DisableLoopDeath)
|
||||
if (deadPlayersCount == QSBPlayerManager.PlayerList.Count)
|
||||
{
|
||||
new EndLoopMessage().Send();
|
||||
return;
|
||||
|
||||
@ -309,7 +309,7 @@ public abstract class SyncBase : QSBNetworkTransform
|
||||
|
||||
protected virtual void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DrawLines
|
||||
if (!QSBCore.DrawLines
|
||||
|| !IsValid
|
||||
|| !ReferenceTransform)
|
||||
{
|
||||
@ -334,7 +334,7 @@ public abstract class SyncBase : QSBNetworkTransform
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DrawLabels
|
||||
if (!QSBCore.DrawLabels
|
||||
|| Event.current.type != EventType.Repaint
|
||||
|| !IsValid
|
||||
|| !ReferenceTransform)
|
||||
|
||||
@ -124,7 +124,7 @@ public class WakeUpSync : MonoBehaviour, IAddComponentOnStart
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!QSBCore.DebugSettings.AvoidTimeSync)
|
||||
if (!QSBCore.AvoidTimeSync)
|
||||
{
|
||||
WakeUpOrSleep();
|
||||
}
|
||||
@ -275,7 +275,7 @@ public class WakeUpSync : MonoBehaviour, IAddComponentOnStart
|
||||
{
|
||||
UpdateServer();
|
||||
}
|
||||
else if (NetworkClient.active && QSBSceneManager.IsInUniverse && !QSBCore.DebugSettings.AvoidTimeSync)
|
||||
else if (NetworkClient.active && QSBSceneManager.IsInUniverse && !QSBCore.AvoidTimeSync)
|
||||
{
|
||||
UpdateClient();
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ public class QSBTranslatorScanBeam : MonoBehaviour
|
||||
|
||||
private void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DrawLines || !QSBWorldSync.AllObjectsReady)
|
||||
if (!QSBCore.DrawLines || !QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public class CommandInterpreter : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
public static void ShipCommand(string[] arguments)
|
||||
{
|
||||
if (!QSBCore.DebugSettings.DebugMode)
|
||||
if (!QSBCore.DebugMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class DebugActions : MonoBehaviour, IAddComponentOnStart
|
||||
private static void DamageShipElectricalSystem() =>
|
||||
ShipManager.Instance.ShipElectricalComponent.SetDamaged(true);
|
||||
|
||||
private void Awake() => enabled = QSBCore.DebugSettings.DebugMode;
|
||||
private void Awake() => enabled = QSBCore.DebugMode;
|
||||
|
||||
private int _otherPlayerToTeleportTo;
|
||||
private int _backTimer;
|
||||
|
||||
@ -5,22 +5,22 @@ namespace QSB.Utility;
|
||||
public class DebugCameraSettings : MonoBehaviour, IAddComponentOnStart
|
||||
{
|
||||
public static void UpdateFromDebugSetting()
|
||||
{
|
||||
if (QSBCore.DebugSettings.GreySkybox)
|
||||
{
|
||||
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
||||
if (Camera.main)
|
||||
{
|
||||
Camera.main.backgroundColor = Color.gray;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QSBSceneManager.OnSceneLoaded -= OnSceneLoaded;
|
||||
if (Camera.main)
|
||||
{
|
||||
Camera.main.backgroundColor = _origColor;
|
||||
}
|
||||
|
||||
if (!QSBCore.GreySkybox)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
||||
if (Camera.main)
|
||||
{
|
||||
Camera.main.backgroundColor = Color.gray;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ public class DebugGUI : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
enabled = QSBCore.DebugSettings.DebugMode;
|
||||
enabled = QSBCore.DebugMode;
|
||||
|
||||
guiGUIStyle.fontSize = 9;
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class DebugGUI : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
WriteLine(1, $"FPS : {Mathf.Round(1f / Time.smoothDeltaTime)}");
|
||||
WriteLine(1, $"Ping : {Math.Round(NetworkTime.rtt * 1000.0)} ms");
|
||||
if (!QSBCore.DebugSettings.DrawGui)
|
||||
if (!QSBCore.DrawGUI)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -408,7 +408,7 @@ public class DebugGUI : MonoBehaviour, IAddComponentOnStart
|
||||
|
||||
private static void DrawWorldObjectLabels()
|
||||
{
|
||||
if (QSBCore.DebugSettings.DrawLabels)
|
||||
if (QSBCore.DrawLabels)
|
||||
{
|
||||
var list = DebugActions.WorldObjectSelection == null
|
||||
? QSBWorldSync.GetWorldObjects()
|
||||
@ -422,23 +422,13 @@ public class DebugGUI : MonoBehaviour, IAddComponentOnStart
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (QSBCore.DebugSettings.DrawGhostAI)
|
||||
{
|
||||
foreach (var obj in QSBWorldSync.GetWorldObjects<IGhostObject>())
|
||||
{
|
||||
if (obj.ShouldDisplayDebug())
|
||||
{
|
||||
DrawLabel(obj.AttachedObject.transform, obj.ReturnLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnRenderObject() => DrawWorldObjectLines();
|
||||
|
||||
private static void DrawWorldObjectLines()
|
||||
{
|
||||
if (QSBCore.DebugSettings.DrawLines)
|
||||
if (QSBCore.DrawLines)
|
||||
{
|
||||
var list = DebugActions.WorldObjectSelection == null
|
||||
? QSBWorldSync.GetWorldObjects()
|
||||
@ -452,16 +442,6 @@ public class DebugGUI : MonoBehaviour, IAddComponentOnStart
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (QSBCore.DebugSettings.DrawGhostAI)
|
||||
{
|
||||
foreach (var obj in QSBWorldSync.GetWorldObjects<IGhostObject>())
|
||||
{
|
||||
if (obj.ShouldDisplayDebug())
|
||||
{
|
||||
obj.DisplayLines();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawLabel(Transform obj, string label)
|
||||
|
||||
@ -16,7 +16,7 @@ public static class DebugLog
|
||||
|
||||
public static void ToConsole(string message, MessageType type = MessageType.Message)
|
||||
{
|
||||
if (QSBCore.DebugSettings.InstanceIdInLogs)
|
||||
if (QSBCore.InstanceIDInLogs)
|
||||
{
|
||||
message = $"[{ProcessInstanceId}] " + message;
|
||||
}
|
||||
@ -44,7 +44,7 @@ public static class DebugLog
|
||||
|
||||
public static void DebugWrite(string message, MessageType type = MessageType.Message)
|
||||
{
|
||||
if (QSBCore.Helper == null || QSBCore.DebugSettings.DebugMode)
|
||||
if (QSBCore.Helper == null || QSBCore.DebugMode)
|
||||
{
|
||||
ToConsole(message, type);
|
||||
}
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace QSB.Utility;
|
||||
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class DebugSettings
|
||||
{
|
||||
[JsonProperty("logQSBMessages")]
|
||||
public bool LogQSBMessages;
|
||||
|
||||
[JsonProperty("instanceIdInLogs")]
|
||||
public bool InstanceIdInLogs;
|
||||
|
||||
[JsonProperty("hookDebugLogs")]
|
||||
public bool HookDebugLogs;
|
||||
|
||||
[JsonProperty("avoidTimeSync")]
|
||||
public bool AvoidTimeSync;
|
||||
|
||||
[JsonProperty("autoStart")]
|
||||
public bool AutoStart;
|
||||
|
||||
[JsonProperty("kickEveryone")]
|
||||
public bool KickEveryone;
|
||||
|
||||
[JsonProperty("disableLoopDeath")]
|
||||
public bool DisableLoopDeath;
|
||||
|
||||
[JsonProperty("latencySimulation")]
|
||||
public int LatencySimulation;
|
||||
|
||||
[JsonProperty("randomizeSkins")]
|
||||
public bool RandomizeSkins;
|
||||
|
||||
/// <summary>
|
||||
/// Timeout in seconds
|
||||
/// </summary>
|
||||
[JsonProperty("timeout")]
|
||||
public int Timeout = 40;
|
||||
|
||||
[JsonProperty("debugMode")]
|
||||
public bool DebugMode;
|
||||
|
||||
[JsonProperty("drawGui")]
|
||||
private bool _drawGui;
|
||||
public bool DrawGui => DebugMode && _drawGui;
|
||||
|
||||
[JsonProperty("drawLines")]
|
||||
private bool _drawLines;
|
||||
public bool DrawLines => DebugMode && _drawLines;
|
||||
|
||||
[JsonProperty("drawLabels")]
|
||||
private bool _drawLabels;
|
||||
public bool DrawLabels => DebugMode && _drawLabels;
|
||||
|
||||
[JsonProperty("drawGhostAI")]
|
||||
private bool _drawGhostAI;
|
||||
public bool DrawGhostAI => DebugMode && _drawGhostAI;
|
||||
|
||||
[JsonProperty("greySkybox")]
|
||||
private bool _greySkybox;
|
||||
public bool GreySkybox => DebugMode && _greySkybox;
|
||||
}
|
||||
@ -34,6 +34,12 @@
|
||||
"value": "localhost",
|
||||
"tooltip": "Used if you leave the connect prompt blank."
|
||||
},
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"type": "number",
|
||||
"value": 40,
|
||||
"tooltip": "How many seconds it takes for a connection to time out."
|
||||
},
|
||||
"showPlayerNames": {
|
||||
"title": "Show Player Names",
|
||||
"type": "toggle",
|
||||
@ -63,6 +69,72 @@
|
||||
"type": "toggle",
|
||||
"value": true,
|
||||
"tooltip": "Disable this if using NomaiVR, or any other mod with conflicting inputs."
|
||||
},
|
||||
"debugMode": {
|
||||
"title": "[DEBUG] Debug Mode",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] Enables debug mode. If this is disabled, none of the following settings do anything."
|
||||
},
|
||||
"instanceIdInLogs": {
|
||||
"title": "[DEBUG] Instance ID in Logs",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] Appends the game instance id to every log message sent. Only takes effect after a game restart."
|
||||
},
|
||||
"hookDebugLogs": {
|
||||
"title": "[DEBUG] Hook Debug Logs",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] Prints every Unity warning + error to the logs. Only takes effect after a game restart."
|
||||
},
|
||||
"avoidTimeSync": {
|
||||
"title": "[DEBUG] Disable Time Sync",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] If enabled, you will no longer fast forward / pause to match the server time. THIS CAN BREAK A LOT OF STUFF!"
|
||||
},
|
||||
"autoStart": {
|
||||
"title": "[DEBUG] Auto Start",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] Automatically host and connect depending on the game instance id for faster testing."
|
||||
},
|
||||
"drawGui": {
|
||||
"title": "[DEBUG] Draw GUI",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] Draws a lot of helpful text at the top of the screen."
|
||||
},
|
||||
"drawLines": {
|
||||
"title": "[DEBUG] Draw Lines",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] Draws a lot of helpful lines between stuff. LAGGY!"
|
||||
},
|
||||
"drawLabels": {
|
||||
"title": "[DEBUG] Draw Labels",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] Draws a lot of helpful labels on stuff. LAGGY!"
|
||||
},
|
||||
"greySkybox": {
|
||||
"title": "[DEBUG] Grey Skybox",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] Makes the skybox grey."
|
||||
},
|
||||
"latencySimulation": {
|
||||
"title": "[DEBUG] Latency Simulation",
|
||||
"type": "number",
|
||||
"value": 0,
|
||||
"tooltip": "[DEBUG] How many seconds of latency to simulate."
|
||||
},
|
||||
"logQSBMessages": {
|
||||
"title": "[DEBUG] Log QSB Messages",
|
||||
"type": "toggle",
|
||||
"value": false,
|
||||
"tooltip": "[DEBUG] If enabled, QSB creates log files of every network message received and transmitted."
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user