Add independent console option. Various random fixes
This commit is contained in:
@@ -111,8 +111,15 @@ quit";
|
|||||||
init.ContinueWith(x => _server.Start());
|
init.ContinueWith(x => _server.Start());
|
||||||
|
|
||||||
Log.Info("Showing UI");
|
Log.Info("Showing UI");
|
||||||
Console.SetOut(TextWriter.Null);
|
|
||||||
NativeMethods.FreeConsole();
|
#if !DEBUG
|
||||||
|
if (!_config.IndependentConsole)
|
||||||
|
{
|
||||||
|
Console.SetOut(TextWriter.Null);
|
||||||
|
NativeMethods.FreeConsole();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
new TorchUI(_server).ShowDialog();
|
new TorchUI(_server).ShowDialog();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -72,10 +72,13 @@ namespace Torch.Server
|
|||||||
[Obsolete("Use vanilla reserved slot config")]
|
[Obsolete("Use vanilla reserved slot config")]
|
||||||
public HashSet<ulong> ReservedPlayers { get; set; } = new HashSet<ulong>();
|
public HashSet<ulong> ReservedPlayers { get; set; } = new HashSet<ulong>();
|
||||||
|
|
||||||
//Prevent reserved players being written to disk, but allow it to bre read
|
//Prevent reserved players being written to disk, but allow it to be read
|
||||||
//remove this when ReservedPlayers is removed
|
//remove this when ReservedPlayers is removed
|
||||||
private bool ShouldSerializeReservedPlayers() => false;
|
private bool ShouldSerializeReservedPlayers() => false;
|
||||||
|
|
||||||
|
[Arg("console", "Keeps a separate console window open after the main UI loads.")]
|
||||||
|
public bool IndependentConsole { get; set; } = false;
|
||||||
|
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
private string _path;
|
private string _path;
|
||||||
|
|
||||||
|
@@ -195,8 +195,7 @@ namespace Torch.Server
|
|||||||
public override void Init(object gameInstance)
|
public override void Init(object gameInstance)
|
||||||
{
|
{
|
||||||
base.Init(gameInstance);
|
base.Init(gameInstance);
|
||||||
var game = gameInstance as MySandboxGame;
|
if (gameInstance is MySandboxGame && MySession.Static != null)
|
||||||
if (game != null && MySession.Static != null)
|
|
||||||
State = ServerState.Running;
|
State = ServerState.Running;
|
||||||
else
|
else
|
||||||
State = ServerState.Stopped;
|
State = ServerState.Stopped;
|
||||||
|
@@ -273,8 +273,7 @@ namespace Torch
|
|||||||
MySessionLoader.LoadSingleplayerSession(sessionPath);
|
MySessionLoader.LoadSingleplayerSession(sessionPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ulong checkpointSize;
|
MyObjectBuilder_Checkpoint checkpoint = MyLocalCache.LoadCheckpoint(sessionPath, out ulong checkpointSize);
|
||||||
MyObjectBuilder_Checkpoint checkpoint = MyLocalCache.LoadCheckpoint(sessionPath, out checkpointSize);
|
|
||||||
if (MySession.IsCompatibleVersion(checkpoint))
|
if (MySession.IsCompatibleVersion(checkpoint))
|
||||||
{
|
{
|
||||||
if (MyWorkshop.DownloadWorldModsBlocking(checkpoint.Mods, null).Success)
|
if (MyWorkshop.DownloadWorldModsBlocking(checkpoint.Mods, null).Success)
|
||||||
|
Reference in New Issue
Block a user