Fix crashes and save issues
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Torch 1.1.205.478
|
# Torch 1.1.207.7
|
||||||
* Notes
|
* Notes
|
||||||
- This release makes significant changes to TorchConfig.xml. It has been renamed to Torch.cfg and has different options.
|
- This release makes significant changes to TorchConfig.xml. It has been renamed to Torch.cfg and has different options.
|
||||||
* Features
|
* Features
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.0.207.7")]
|
[assembly: AssemblyVersion("1.0.212.393")]
|
||||||
[assembly: AssemblyFileVersion("1.0.207.7")]
|
[assembly: AssemblyFileVersion("1.0.212.393")]
|
@@ -45,6 +45,8 @@ namespace Torch.Server.Managers
|
|||||||
MyFileSystem.Reset();
|
MyFileSystem.Reset();
|
||||||
MyFileSystem.ExePath = Path.Combine(Torch.GetManager<FilesystemManager>().TorchDirectory, "DedicatedServer64");
|
MyFileSystem.ExePath = Path.Combine(Torch.GetManager<FilesystemManager>().TorchDirectory, "DedicatedServer64");
|
||||||
MyFileSystem.Init("Content", path);
|
MyFileSystem.Init("Content", path);
|
||||||
|
//Initializes saves path. Why this isn't in Init() we may never know.
|
||||||
|
MyFileSystem.InitUserSpecific(null);
|
||||||
|
|
||||||
var configPath = Path.Combine(path, CONFIG_NAME);
|
var configPath = Path.Combine(path, CONFIG_NAME);
|
||||||
if (!File.Exists(configPath))
|
if (!File.Exists(configPath))
|
||||||
@@ -68,6 +70,8 @@ namespace Torch.Server.Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadWorldMods();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (string.IsNullOrEmpty(DedicatedConfig.LoadWorld))
|
if (string.IsNullOrEmpty(DedicatedConfig.LoadWorld))
|
||||||
{
|
{
|
||||||
@@ -85,7 +89,7 @@ namespace Torch.Server.Managers
|
|||||||
|
|
||||||
private void LoadWorldMods(bool modsOnly = true)
|
private void LoadWorldMods(bool modsOnly = true)
|
||||||
{
|
{
|
||||||
if (DedicatedConfig.LoadWorld == null)
|
if (string.IsNullOrEmpty(DedicatedConfig.LoadWorld))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var sandboxPath = Path.Combine(DedicatedConfig.LoadWorld, "Sandbox.sbc");
|
var sandboxPath = Path.Combine(DedicatedConfig.LoadWorld, "Sandbox.sbc");
|
||||||
|
@@ -84,10 +84,14 @@ namespace Torch.Server
|
|||||||
{
|
{
|
||||||
var pid = int.Parse(_config.WaitForPID);
|
var pid = int.Parse(_config.WaitForPID);
|
||||||
var waitProc = Process.GetProcessById(pid);
|
var waitProc = Process.GetProcessById(pid);
|
||||||
_log.Warn($"Waiting for process {pid} to exit.");
|
|
||||||
waitProc.WaitForExit();
|
|
||||||
_log.Info("Continuing in 5 seconds.");
|
_log.Info("Continuing in 5 seconds.");
|
||||||
Thread.Sleep(5000);
|
Thread.Sleep(5000);
|
||||||
|
if (!waitProc.HasExited)
|
||||||
|
{
|
||||||
|
_log.Warn($"Killing old process {pid}.");
|
||||||
|
waitProc.Kill();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.1.207.7")]
|
[assembly: AssemblyVersion("1.1.212.393")]
|
||||||
[assembly: AssemblyFileVersion("1.1.207.7")]
|
[assembly: AssemblyFileVersion("1.1.212.393")]
|
@@ -40,7 +40,7 @@ namespace Torch.Commands
|
|||||||
|
|
||||||
public bool IsCommand(string command)
|
public bool IsCommand(string command)
|
||||||
{
|
{
|
||||||
return command.Length > 1 && command[0] == Prefix;
|
return !string.IsNullOrEmpty(command) && command[0] == Prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterCommandModule(Type moduleType, ITorchPlugin plugin = null)
|
public void RegisterCommandModule(Type moduleType, ITorchPlugin plugin = null)
|
||||||
|
@@ -120,6 +120,9 @@ namespace Torch.Managers
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void SendMessage(string message, string author = "Server", long playerId = 0, string font = MyFontEnum.Red)
|
public void SendMessage(string message, string author = "Server", long playerId = 0, string font = MyFontEnum.Red)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(message))
|
||||||
|
return;
|
||||||
|
|
||||||
ChatHistory.Add(new ChatMessage(DateTime.Now, 0, author, message));
|
ChatHistory.Add(new ChatMessage(DateTime.Now, 0, author, message));
|
||||||
var commands = Torch.GetManager<CommandManager>();
|
var commands = Torch.GetManager<CommandManager>();
|
||||||
if (commands.IsCommand(message))
|
if (commands.IsCommand(message))
|
||||||
|
@@ -126,8 +126,7 @@ namespace Torch.Managers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_log.Fatal(ex);
|
_log.Error(ex);
|
||||||
_log.Fatal(ex, "~Error processing event!");
|
|
||||||
//crash after logging, bad things could happen if we continue on with bad data
|
//crash after logging, bad things could happen if we continue on with bad data
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@@ -200,8 +199,8 @@ namespace Torch.Managers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_log.Fatal(ex);
|
_log.Error(ex, "Error processing network event!");
|
||||||
_log.Fatal(ex, "Error when returning control to game server!");
|
_log.Error(ex);
|
||||||
//crash after logging, bad things could happen if we continue on with bad data
|
//crash after logging, bad things could happen if we continue on with bad data
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@@ -121,9 +121,10 @@ namespace Torch.Managers
|
|||||||
|
|
||||||
commands.RegisterPluginCommands(plugin);
|
commands.RegisterPluginCommands(plugin);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_log.Error($"Error loading plugin '{type.FullName}'");
|
_log.Error($"Error loading plugin '{type.FullName}'");
|
||||||
|
_log.Error(e);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user