Fix remote API, file copying, entity manager sorting
This commit is contained in:
@@ -62,16 +62,30 @@ quit";
|
||||
var basePath = new FileInfo(typeof(Program).Assembly.Location).Directory.ToString();
|
||||
var apiSource = Path.Combine(basePath, "DedicatedServer64", "steam_api64.dll");
|
||||
var apiTarget = Path.Combine(basePath, "steam_api64.dll");
|
||||
|
||||
if (!File.Exists(apiTarget) || File.GetLastWriteTime(apiTarget) < File.GetLastWriteTime(apiSource))
|
||||
|
||||
if (!File.Exists(apiTarget))
|
||||
{
|
||||
File.Copy(apiSource, apiTarget);
|
||||
}
|
||||
else if (File.GetLastWriteTime(apiTarget) < File.GetLastWriteTime(apiSource))
|
||||
{
|
||||
File.Delete(apiTarget);
|
||||
File.Copy(apiSource, apiTarget);
|
||||
}
|
||||
|
||||
var havokSource = Path.Combine(basePath, "DedicatedServer64", "Havok.dll");
|
||||
var havokTarget = Path.Combine(basePath, "Havok.dll");
|
||||
|
||||
if (!File.Exists(havokTarget) || File.GetLastWriteTime(havokTarget) < File.GetLastWriteTime(havokSource))
|
||||
|
||||
if (!File.Exists(havokTarget))
|
||||
{
|
||||
File.Copy(havokSource, havokTarget);
|
||||
}
|
||||
else if (File.GetLastWriteTime(havokTarget) < File.GetLastWriteTime(havokSource))
|
||||
{
|
||||
File.Delete(havokTarget);
|
||||
File.Copy(havokSource, havokTarget);
|
||||
|
||||
}
|
||||
|
||||
_config = InitConfig();
|
||||
if (!_config.Parse(args))
|
||||
return false;
|
||||
|
28
Torch.Server/Managers/RemoteAPIManager.cs
Normal file
28
Torch.Server/Managers/RemoteAPIManager.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using NLog;
|
||||
using Sandbox;
|
||||
using Torch.API;
|
||||
using Torch.Managers;
|
||||
using VRage.Dedicated.RemoteAPI;
|
||||
|
||||
namespace Torch.Server.Managers
|
||||
{
|
||||
public class RemoteAPIManager : Manager
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public RemoteAPIManager(ITorchBase torchInstance) : base(torchInstance)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Attach()
|
||||
{
|
||||
if (MySandboxGame.ConfigDedicated.RemoteApiEnabled && !string.IsNullOrEmpty(MySandboxGame.ConfigDedicated.RemoteSecurityKey))
|
||||
{
|
||||
var myRemoteServer = new MyRemoteServer(MySandboxGame.ConfigDedicated.RemoteApiPort, MySandboxGame.ConfigDedicated.RemoteSecurityKey);
|
||||
LogManager.GetCurrentClassLogger().Info($"Remote API started on port {myRemoteServer.Port}");
|
||||
}
|
||||
base.Attach();
|
||||
}
|
||||
}
|
||||
}
|
@@ -90,8 +90,9 @@
|
||||
<Reference Include="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
|
||||
<HintPath>..\GameBinaries\netstandard.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.4.12\lib\net45\NLog.dll</HintPath>
|
||||
@@ -251,6 +252,7 @@
|
||||
<Compile Include="Managers\InstanceManager.cs" />
|
||||
<Compile Include="Managers\MultiplayerManagerDedicatedEventShim.cs" />
|
||||
<Compile Include="Managers\MultiplayerManagerDedicatedPatchShim.cs" />
|
||||
<Compile Include="Managers\RemoteAPIManager.cs" />
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="Initializer.cs" />
|
||||
<Compile Include="Patches\PromotePatch.cs" />
|
||||
|
@@ -54,6 +54,7 @@ namespace Torch.Server
|
||||
DedicatedInstance = new InstanceManager(this);
|
||||
AddManager(DedicatedInstance);
|
||||
AddManager(new EntityControlManager(this));
|
||||
AddManager(new RemoteAPIManager(this));
|
||||
Config = config ?? new TorchConfig();
|
||||
|
||||
var sessionManager = Managers.GetManager<ITorchSessionManager>();
|
||||
@@ -127,13 +128,6 @@ namespace Torch.Server
|
||||
_hasRun = true;
|
||||
Log.Info("Starting server.");
|
||||
MySandboxGame.ConfigDedicated = DedicatedInstance.DedicatedConfig.Model;
|
||||
//Are you serious, Keen? This is going away until it stops hanging.
|
||||
//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}");
|
||||
//}
|
||||
Log.Warn("Remote API is disabled because it hangs the server start process. Blame Keen.");
|
||||
|
||||
_uptime = Stopwatch.StartNew();
|
||||
base.Start();
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<package id="Markdown.Xaml" version="1.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Win32.Registry" version="4.4.0" targetFramework="net461" />
|
||||
<package id="Mono.TextTransform" version="1.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
|
||||
<package id="NLog" version="4.4.12" targetFramework="net461" />
|
||||
<package id="protobuf-net" version="2.4.0" targetFramework="net461" />
|
||||
<package id="SteamKit2" version="2.1.0" targetFramework="net461" />
|
||||
|
Reference in New Issue
Block a user