Add remote API support

This commit is contained in:
John Gross
2018-09-28 21:48:24 -07:00
parent ee3dd0b5bd
commit 831722dd84

View File

@@ -24,6 +24,7 @@ using Torch.Server.Managers;
using Torch.Utils; using Torch.Utils;
using VRage; using VRage;
using VRage.Dedicated; using VRage.Dedicated;
using VRage.Dedicated.RemoteAPI;
using VRage.GameServices; using VRage.GameServices;
using VRage.Steam; using VRage.Steam;
using Timer = System.Threading.Timer; using Timer = System.Threading.Timer;
@@ -122,6 +123,11 @@ namespace Torch.Server
_hasRun = true; _hasRun = true;
Log.Info("Starting server."); Log.Info("Starting server.");
MySandboxGame.ConfigDedicated = DedicatedInstance.DedicatedConfig.Model; MySandboxGame.ConfigDedicated = DedicatedInstance.DedicatedConfig.Model;
if (MySandboxGame.ConfigDedicated.RemoteApiEnabled && !string.IsNullOrEmpty(MySandboxGame.ConfigDedicated.RemoteSecurityKey))
{
var myRemoteServer = new MyRemoteServer(MySandboxGame.ConfigDedicated.RemoteApiPort, MySandboxGame.ConfigDedicated.RemoteSecurityKey);
Log.Info($"Remote API started on port {myRemoteServer.Port}");
}
_uptime = Stopwatch.StartNew(); _uptime = Stopwatch.StartNew();
base.Start(); base.Start();