mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-03 17:38:30 +00:00
auto start: actually implement
This commit is contained in:
parent
96c0161de2
commit
a25d3d19c5
@ -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)
|
||||
|
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user