auto start: actually implement

This commit is contained in:
JohnCorby 2022-06-06 23:35:13 -07:00
parent 96c0161de2
commit a25d3d19c5
2 changed files with 19 additions and 2 deletions

View File

@ -70,6 +70,23 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
QSBCore.Helper.Storage.Save(QSBCore.Storage, "storage.json");
QSBCore.MenuApi.RegisterStartupPopup(UpdateChangelog);
}
if (QSBCore.DebugSettings.AutoStart)
{
// auto host/connect
Delay.RunWhen(PlayerData.IsLoaded, () =>
{
if (DebugLog.ProcessInstanceId == 0)
{
Host(false);
}
else
{
QSBCore.DefaultServerIP = "localhost";
Connect();
}
});
}
}
private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isUniverse)

View File

@ -6,14 +6,14 @@ namespace QSB.Utility;
public static class DebugLog
{
private static readonly int _processInstanceId = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)
public static readonly int ProcessInstanceId = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)
.IndexOf(x => x.Id == Process.GetCurrentProcess().Id);
public static void ToConsole(string message, MessageType type = MessageType.Message)
{
if (QSBCore.DebugSettings.InstanceIdInLogs)
{
message = $"[{_processInstanceId}] " + message;
message = $"[{ProcessInstanceId}] " + message;
}
QSBCore.Helper.Console.WriteLine(message, type, GetCallingType(new StackTrace()));