Compare commits

..

6 Commits

15 changed files with 185 additions and 117 deletions

View File

@@ -14,6 +14,9 @@ namespace Torch.API.Managers
/// <summary> /// <summary>
/// Fired when plugins are loaded. /// Fired when plugins are loaded.
/// </summary> /// </summary>
/// <remarks>
/// Fired when plugins are loaded and immediately if subscribed after the plugins are loaded.
/// </remarks>
event Action<IReadOnlyCollection<ITorchPlugin>> PluginsLoaded; event Action<IReadOnlyCollection<ITorchPlugin>> PluginsLoaded;
/// <summary> /// <summary>

View File

@@ -18,11 +18,11 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="JorgeSerrano.Json.JsonSnakeCaseNamingPolicy" Version="0.9.0" /> <PackageReference Include="JorgeSerrano.Json.JsonSnakeCaseNamingPolicy" Version="0.9.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" /> <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageReference Include="NLog" Version="5.2.0" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="NuGet.Commands" Version="6.6.1" /> <PackageReference Include="NuGet.Commands" Version="6.6.1" />
<PackageReference Include="NuGet.DependencyResolver.Core" Version="6.6.1" /> <PackageReference Include="NuGet.DependencyResolver.Core" Version="6.6.1" />
<PackageReference Include="SemanticVersioning" Version="2.0.2" /> <PackageReference Include="SemanticVersioning" Version="2.0.2" />
<PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.202.120"> <PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.202.124">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile</IncludeAssets> <IncludeAssets>compile</IncludeAssets>
</PackageReference> </PackageReference>

View File

@@ -19,9 +19,9 @@
}, },
"NLog": { "NLog": {
"type": "Direct", "type": "Direct",
"requested": "[5.2.0, )", "requested": "[5.2.2, )",
"resolved": "5.2.0", "resolved": "5.2.2",
"contentHash": "uYBgseY0m/9lQUbZYGsQsTBFOWrfs3iaekzzYMH6vFmpoOAvV8/bp1XxG/suZkwB5h8nAiTJAp7VENWRDKtKPA==" "contentHash": "r6Q9740g29gTwmTWlsgdIFm0mhNsfNZmbvWKX/Fxmi8X89ZrpUowHM2T2X1lP7RVpND+ef+XnfKL5g6Q1iNGXA=="
}, },
"NuGet.Commands": { "NuGet.Commands": {
"type": "Direct", "type": "Direct",
@@ -54,9 +54,9 @@
}, },
"SpaceEngineersDedicated.ReferenceAssemblies": { "SpaceEngineersDedicated.ReferenceAssemblies": {
"type": "Direct", "type": "Direct",
"requested": "[1.202.120, )", "requested": "[1.202.124, )",
"resolved": "1.202.120", "resolved": "1.202.124",
"contentHash": "HTP48NOSZY3eQPX3GJN+gjxdW83SM7DX6NcKCFqNIIvjz/J+l8uimHAQp9dnLySb0wb1K1Z1xBPIXyxMQRREIw==", "contentHash": "xw8mbJI2WwZcfWvgMf6c6E3agcQ/IQVVdnKZljszQBKq0cjhJG06AoonM+MI74CrYMJxf+wnA+4bzCt4mxy/Qg==",
"dependencies": { "dependencies": {
"protobuf-net": "1.0.0" "protobuf-net": "1.0.0"
} }

View File

@@ -18,7 +18,7 @@
<!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> --> <!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> -->
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="NLog" Version="5.2.0" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit" Version="2.4.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -173,7 +173,7 @@ namespace Torch.Server
{ {
var steamCmdProc = new ProcessStartInfo(steamCmdExePath) var steamCmdProc = new ProcessStartInfo(steamCmdExePath)
{ {
Arguments = string.Format(TOOL_ARGS, configuration.GetValue("gamePath", "../"), depotId, "3111493184861426002"), Arguments = string.Format(TOOL_ARGS, configuration.GetValue("gamePath", "../"), depotId, "14195799952783859"),
WorkingDirectory = path, WorkingDirectory = path,
RedirectStandardOutput = true RedirectStandardOutput = true
}; };

View File

@@ -41,7 +41,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="7.0.0" />
<PackageReference Include="NLog" Version="5.2.0" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" /> <PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" />
<PackageReference Include="Steamworks.NET" Version="20.1.0"> <PackageReference Include="Steamworks.NET" Version="20.1.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
@@ -50,7 +50,7 @@
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Management" Version="7.0.2" /> <PackageReference Include="System.Management" Version="7.0.2" />
<PackageReference Include="nulastudio.NetCoreBeauty" Version="1.2.9.5" /> <PackageReference Include="nulastudio.NetCoreBeauty" Version="1.2.9.5" />
<PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.202.120"> <PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.202.124">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile</IncludeAssets> <IncludeAssets>compile</IncludeAssets>
</PackageReference> </PackageReference>

View File

@@ -58,7 +58,9 @@ namespace Torch.Server
AddManager(new EntityControlManager(this)); AddManager(new EntityControlManager(this));
AddManager(new RemoteAPIManager(this)); AddManager(new RemoteAPIManager(this));
var sessionManager = Managers.GetManager<ITorchSessionManager>();
sessionManager.AddFactory(_ => new MultiplayerManagerDedicated(this));
sessionManager.SessionStateChanged += OnSessionStateChanged;
// Needs to be done at some point after MyVRageWindows.Init // Needs to be done at some point after MyVRageWindows.Init
// where the debug listeners are registered // where the debug listeners are registered
@@ -119,7 +121,38 @@ namespace Torch.Server
/// <inheritdoc /> /// <inheritdoc />
public ServerState State { get; private set; } public ServerState State { get; private set; }
public event Action<ITorchServer> Initialized; private Action<ITorchServer> _initializedEvent;
public event Action<ITorchServer> Initialized
{
add
{
var action = _initializedEvent;
Action<ITorchServer> action2;
do
{
action2 = action;
var action3 = (Action<ITorchServer>)Delegate.Combine(action2, value);
action = Interlocked.CompareExchange(ref _initializedEvent, action3, action2);
}
while (action != action2);
if (GetManager<InstanceManager>().DedicatedConfig != null)
value(this); //if already initialized
}
remove
{
var action = _initializedEvent;
Action<ITorchServer> action2;
do
{
action2 = action;
var action3 = (Action<ITorchServer>)Delegate.Remove(action2, value);
action = Interlocked.CompareExchange(ref _initializedEvent, action3, action2);
}
while (action != action2);
}
}
public int OnlinePlayers { get; private set; } public int OnlinePlayers { get; private set; }
@@ -128,13 +161,9 @@ namespace Torch.Server
{ {
Log.Info("Initializing server"); Log.Info("Initializing server");
base.Init(); base.Init();
var sessionManager = Managers.GetManager<ITorchSessionManager>();
sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this));
sessionManager.SessionStateChanged += OnSessionStateChanged;
GetManager<InstanceManager>().LoadInstance(InstancePath); GetManager<InstanceManager>().LoadInstance(InstancePath);
CanRun = true; CanRun = true;
Initialized?.Invoke(this); _initializedEvent?.Invoke(this);
Log.Info($"Initialized server '{InstanceName}' at '{InstancePath}'"); Log.Info($"Initialized server '{InstanceName}' at '{InstancePath}'");
} }

View File

@@ -92,9 +92,9 @@
}, },
"NLog": { "NLog": {
"type": "Direct", "type": "Direct",
"requested": "[5.2.0, )", "requested": "[5.2.2, )",
"resolved": "5.2.0", "resolved": "5.2.2",
"contentHash": "uYBgseY0m/9lQUbZYGsQsTBFOWrfs3iaekzzYMH6vFmpoOAvV8/bp1XxG/suZkwB5h8nAiTJAp7VENWRDKtKPA==" "contentHash": "r6Q9740g29gTwmTWlsgdIFm0mhNsfNZmbvWKX/Fxmi8X89ZrpUowHM2T2X1lP7RVpND+ef+XnfKL5g6Q1iNGXA=="
}, },
"nulastudio.NetCoreBeauty": { "nulastudio.NetCoreBeauty": {
"type": "Direct", "type": "Direct",
@@ -113,9 +113,9 @@
}, },
"SpaceEngineersDedicated.ReferenceAssemblies": { "SpaceEngineersDedicated.ReferenceAssemblies": {
"type": "Direct", "type": "Direct",
"requested": "[1.202.120, )", "requested": "[1.202.124, )",
"resolved": "1.202.120", "resolved": "1.202.124",
"contentHash": "HTP48NOSZY3eQPX3GJN+gjxdW83SM7DX6NcKCFqNIIvjz/J+l8uimHAQp9dnLySb0wb1K1Z1xBPIXyxMQRREIw==", "contentHash": "xw8mbJI2WwZcfWvgMf6c6E3agcQ/IQVVdnKZljszQBKq0cjhJG06AoonM+MI74CrYMJxf+wnA+4bzCt4mxy/Qg==",
"dependencies": { "dependencies": {
"protobuf-net": "1.0.0" "protobuf-net": "1.0.0"
} }
@@ -153,10 +153,10 @@
}, },
"HarmonyX": { "HarmonyX": {
"type": "Transitive", "type": "Transitive",
"resolved": "2.10.2-prerelease.4", "resolved": "2.10.2-prerelease.6",
"contentHash": "M/44/DhSu1WR8gL62aLPGKqAJ0rrgkw38nT3DgEvLAvyIoQLJmL2Jsn4/d4CC0eDT1Vv82cB9Mxgg0sFD3/qrQ==", "contentHash": "CPCUR/t5AQ5DDs40bTJ5OwUVTCoZONaJGbWKKjAOwg7c7Ct4KEbfybH6T+KvRGVjf5eN1oyGY5BN7EfWxUh9Xg==",
"dependencies": { "dependencies": {
"MonoModReorg.RuntimeDetour": "23.3.22.1" "MonoMod.RuntimeDetour": "25.0.0"
} }
}, },
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": { "JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": {
@@ -313,50 +313,50 @@
"resolved": "0.11.4", "resolved": "0.11.4",
"contentHash": "IC1h5g0NeJGHIUgzM1P82ld57knhP0IcQfrYITDPXlNpMYGUrsG5TxuaWTjaeqDNQMBDNZkB8L0rBnwsY6JHuQ==" "contentHash": "IC1h5g0NeJGHIUgzM1P82ld57knhP0IcQfrYITDPXlNpMYGUrsG5TxuaWTjaeqDNQMBDNZkB8L0rBnwsY6JHuQ=="
}, },
"MonoModReorg.Backports": { "MonoMod.Backports": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "1.0.0",
"contentHash": "nLx18prtZbS0nVO8YHElP+TUj1kkDswRgQpa9agt3tyNWke9Kqk5lVkGu87Y3cCMhG+m5Ai0ZDH0+V5B6bXF+Q==", "contentHash": "J59I4CMe24aCmWboHCDzQIk37kXqHnJH6KQfDGstlznuDni7Lwdd/8CywmEwVXjVEgfs5yQzvOTW3Xg1NH7fDQ==",
"dependencies": { "dependencies": {
"MonoModReorg.ILHelpers": "23.3.22.1" "MonoMod.ILHelpers": "1.0.0"
} }
}, },
"MonoModReorg.Core": { "MonoMod.Core": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "1.0.0",
"contentHash": "Q3ZOgm6AOTL0icgcHsT/6mV5kYt6meqX3DEN1p/et5PxJsXUhVkiZfAptp8y/i+cO6HNgkcESpXEQ4jUWVwsDA==", "contentHash": "FlzAEa4ujbA1t3rbKxuW3DP36T0/L6k2IP1F4QXM1cOXMJLHm39Azjt98E/9LFRFBWYFdlMUmg+4THLv2xyisA==",
"dependencies": { "dependencies": {
"Mono.Cecil": "0.11.4", "Mono.Cecil": "0.11.4",
"MonoModReorg.Backports": "23.3.22.1", "MonoMod.Backports": "1.0.0",
"MonoModReorg.ILHelpers": "23.3.22.1", "MonoMod.ILHelpers": "1.0.0",
"MonoModReorg.Utils": "23.3.22.1" "MonoMod.Utils": "25.0.0"
} }
}, },
"MonoModReorg.ILHelpers": { "MonoMod.ILHelpers": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "1.0.0",
"contentHash": "dHE/3VZtnTUTkQ34j8Gu6CxKes1QDL8tBuF3QElxHHpPl/QabGCK938k47WWRcRBMoP7IAthkn+Bob4H97rBgw==" "contentHash": "dTjGA+dYl7W5yQ0oG/Wr57tsa+ueoFUrwPtz9MZF9iheun4n70u7lge52F8UJi9i0zMHRfS2mAY6+nPuRZHQyQ=="
}, },
"MonoModReorg.RuntimeDetour": { "MonoMod.RuntimeDetour": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "25.0.0",
"contentHash": "cUES3Hi7QJtBNe0qwVdjZOCDkZDaCpdqS6Au0RaCyQ1PDIR4av13E9qBNAEYew46sgPe0fOrU334md6DLDGHlQ==", "contentHash": "u+G34uSEjU0+fk4Iz3Mfws/+E4kW460i6fBz1b4L/yxSndfmdKkJ+pYbU9pwh7IUxgk0Ko0+Mx3fSUQPaNk8nA==",
"dependencies": { "dependencies": {
"Mono.Cecil": "0.11.4", "Mono.Cecil": "0.11.4",
"MonoModReorg.Backports": "23.3.22.1", "MonoMod.Backports": "1.0.0",
"MonoModReorg.Core": "23.3.22.1", "MonoMod.Core": "1.0.0",
"MonoModReorg.ILHelpers": "23.3.22.1", "MonoMod.ILHelpers": "1.0.0",
"MonoModReorg.Utils": "23.3.22.1" "MonoMod.Utils": "25.0.0"
} }
}, },
"MonoModReorg.Utils": { "MonoMod.Utils": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "25.0.0",
"contentHash": "q1cX0mbYxdw2WcE/qGBB84lVY/ffobEr46VQFuwGcWhtw6f1Ql1k4TZfs8gebpesSxHnca13grLeVHrUSpy1+g==", "contentHash": "E8m0pH3Kact+A2qH+lxMis90K8+ixInwprn0R1nuAMRHfotHUHeYmr304UEPeInSuY3+IlnC+OB8fqbQiTsWlQ==",
"dependencies": { "dependencies": {
"Mono.Cecil": "0.11.4", "Mono.Cecil": "0.11.4",
"MonoModReorg.Backports": "23.3.22.1", "MonoMod.Backports": "1.0.0",
"MonoModReorg.ILHelpers": "23.3.22.1" "MonoMod.ILHelpers": "1.0.0"
} }
}, },
"Newtonsoft.Json": { "Newtonsoft.Json": {
@@ -574,12 +574,12 @@
"type": "Project", "type": "Project",
"dependencies": { "dependencies": {
"ControlzEx": "[6.0.0, )", "ControlzEx": "[6.0.0, )",
"HarmonyX": "[2.10.2-prerelease.4, )", "HarmonyX": "[2.10.2-prerelease.6, )",
"MahApps.Metro": "[2.4.9, )", "MahApps.Metro": "[2.4.9, )",
"Microsoft.CodeAnalysis.CSharp": "[4.6.0, )", "Microsoft.CodeAnalysis.CSharp": "[4.6.0, )",
"Microsoft.CodeAnalysis.Common": "[4.6.0, )", "Microsoft.CodeAnalysis.Common": "[4.6.0, )",
"MonoModReorg.RuntimeDetour": "[23.3.22.1, )", "MonoMod.RuntimeDetour": "[25.0.0, )",
"NLog": "[5.2.0, )", "NLog": "[5.2.2, )",
"System.ComponentModel.Annotations": "[5.0.0, )", "System.ComponentModel.Annotations": "[5.0.0, )",
"Torch.API": "[1.0.0, )", "Torch.API": "[1.0.0, )",
"Torch.SixLabors.ImageSharp": "[1.0.0-beta6, )", "Torch.SixLabors.ImageSharp": "[1.0.0-beta6, )",
@@ -591,7 +591,7 @@
"dependencies": { "dependencies": {
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )", "JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )",
"Microsoft.Extensions.Configuration.Binder": "[7.0.4, )", "Microsoft.Extensions.Configuration.Binder": "[7.0.4, )",
"NLog": "[5.2.0, )", "NLog": "[5.2.2, )",
"NuGet.Commands": "[6.6.1, )", "NuGet.Commands": "[6.6.1, )",
"NuGet.DependencyResolver.Core": "[6.6.1, )", "NuGet.DependencyResolver.Core": "[6.6.1, )",
"SemanticVersioning": "[2.0.2, )", "SemanticVersioning": "[2.0.2, )",

View File

@@ -18,7 +18,7 @@
<!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> --> <!-- <Import Project="$(SolutionDir)\TransformOnBuild.targets" /> -->
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="NLog" Version="5.2.0" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit" Version="2.4.2" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -214,7 +214,8 @@ public class ScriptCompilationManager : Manager
return null; return null;
} }
private readonly CSharpCompilationOptions _compilationOptions = new(OutputKind.DynamicallyLinkedLibrary); private readonly CSharpCompilationOptions _compilationOptions = new(OutputKind.DynamicallyLinkedLibrary,
optimizationLevel: OptimizationLevel.Release, platform: Platform.X64);
private readonly CSharpParseOptions _parseOptions = new(LanguageVersion.CSharp11, DocumentationMode.None); private readonly CSharpParseOptions _parseOptions = new(LanguageVersion.CSharp11, DocumentationMode.None);
private CSharpCompilation CreateCompilation(string assemblyFileName, IEnumerable<Script> scripts) private CSharpCompilation CreateCompilation(string assemblyFileName, IEnumerable<Script> scripts)

View File

@@ -52,8 +52,40 @@ namespace Torch.Managers
/// <inheritdoc /> /// <inheritdoc />
public IReadOnlyDictionary<Guid, ITorchPlugin> Plugins => _plugins.AsReadOnlyObservable(); public IReadOnlyDictionary<Guid, ITorchPlugin> Plugins => _plugins.AsReadOnlyObservable();
public event Action<IReadOnlyCollection<ITorchPlugin>> PluginsLoaded; private Action<IReadOnlyCollection<ITorchPlugin>> _pluginsLoaded;
private bool _loaded;
public event Action<IReadOnlyCollection<ITorchPlugin>> PluginsLoaded
{
add
{
var action = _pluginsLoaded;
Action<IReadOnlyCollection<ITorchPlugin>> action2;
do
{
action2 = action;
var action3 = (Action<IReadOnlyCollection<ITorchPlugin>>)Delegate.Combine(action2, value);
action = Interlocked.CompareExchange(ref _pluginsLoaded, action3, action2);
}
while (action != action2);
if (_loaded)
value(_plugins.Values.AsReadOnly());
}
remove
{
var action = _pluginsLoaded;
Action<IReadOnlyCollection<ITorchPlugin>> action2;
do
{
action2 = action;
var action3 = (Action<IReadOnlyCollection<ITorchPlugin>>)Delegate.Remove(action2, value);
action = Interlocked.CompareExchange(ref _pluginsLoaded, action3, action2);
}
while (action != action2);
}
}
public PluginManager(ITorchBase torchInstance) : base(torchInstance) public PluginManager(ITorchBase torchInstance) : base(torchInstance)
{ {
if (!Directory.Exists(PluginDir)) if (!Directory.Exists(PluginDir))
@@ -145,7 +177,8 @@ namespace Torch.Managers
plugin.Init(Torch); plugin.Init(Torch);
} }
_log.Info($"Loaded {_plugins.Count} plugins."); _log.Info($"Loaded {_plugins.Count} plugins.");
PluginsLoaded?.Invoke(_plugins.Values.AsReadOnly()); _loaded = true;
_pluginsLoaded?.Invoke(_plugins.Values.AsReadOnly());
return; return;
} }
@@ -220,7 +253,8 @@ namespace Torch.Managers
plugin.Init(Torch); plugin.Init(Torch);
} }
_log.Info($"Loaded {_plugins.Count} plugins."); _log.Info($"Loaded {_plugins.Count} plugins.");
PluginsLoaded?.Invoke(_plugins.Values.AsReadOnly()); _loaded = true;
_pluginsLoaded?.Invoke(_plugins.Values.AsReadOnly());
} }
//debug flag is set when the user asks us to run with a specific plugin for plugin development debug //debug flag is set when the user asks us to run with a specific plugin for plugin development debug

View File

@@ -49,8 +49,6 @@ namespace Torch.Session
public TorchSessionManager(ITorchBase torchInstance) : base(torchInstance) public TorchSessionManager(ITorchBase torchInstance) : base(torchInstance)
{ {
_overrideMods = new Dictionary<ulong, MyObjectBuilder_Checkpoint.ModItem>(); _overrideMods = new Dictionary<ulong, MyObjectBuilder_Checkpoint.ModItem>();
if (Torch.Config.UgcServiceType == UGCServiceType.Steam)
_overrideMods.Add(ModCommunication.MOD_ID, ModItemUtils.Create(ModCommunication.MOD_ID));
} }
/// <inheritdoc/> /// <inheritdoc/>
@@ -74,7 +72,9 @@ namespace Torch.Session
{ {
if (_overrideMods.ContainsKey(modId)) if (_overrideMods.ContainsKey(modId))
return false; return false;
var item = ModItemUtils.Create(modId); #pragma warning disable CS0618
var item = ModItemUtils.Create(modId, TorchBase.Instance.Config.UgcServiceType.ToString());
#pragma warning restore CS0618
_overrideMods.Add(modId, item); _overrideMods.Add(modId, item);
OverrideModsChanged?.Invoke(new CollectionChangeEventArgs(CollectionChangeAction.Add, item)); OverrideModsChanged?.Invoke(new CollectionChangeEventArgs(CollectionChangeAction.Add, item));
@@ -193,6 +193,8 @@ namespace Torch.Session
MySession.AfterLoading += SessionLoaded; MySession.AfterLoading += SessionLoaded;
MySession.OnUnloading += SessionUnloading; MySession.OnUnloading += SessionUnloading;
MySession.OnUnloaded += SessionUnloaded; MySession.OnUnloaded += SessionUnloaded;
if (Torch.Config.UgcServiceType == UGCServiceType.Steam)
_overrideMods.Add(ModCommunication.MOD_ID, ModItemUtils.Create(ModCommunication.MOD_ID));
} }

View File

@@ -24,18 +24,18 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="ControlzEx" Version="6.0.0" /> <PackageReference Include="ControlzEx" Version="6.0.0" />
<PackageReference Include="HarmonyX" Version="2.10.2-prerelease.4" /> <PackageReference Include="HarmonyX" Version="2.10.2-prerelease.6" />
<PackageReference Include="InfoOf.Fody" Version="2.1.1" PrivateAssets="all" /> <PackageReference Include="InfoOf.Fody" Version="2.1.1" PrivateAssets="all" />
<PackageReference Include="MahApps.Metro" Version="2.4.9" /> <PackageReference Include="MahApps.Metro" Version="2.4.9" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.6.0" /> <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.6.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" />
<PackageReference Include="MonoModReorg.RuntimeDetour" Version="23.3.22.1" /> <PackageReference Include="MonoMod.RuntimeDetour" Version="25.0.0" />
<PackageReference Include="NLog" Version="5.2.0" /> <PackageReference Include="NLog" Version="5.2.2" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" /> <PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" />
<PackageReference Include="protobuf-net" Version="3.2.26" /> <PackageReference Include="protobuf-net" Version="3.2.26" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="Torch.SixLabors.ImageSharp" Version="1.0.0-beta6" /> <PackageReference Include="Torch.SixLabors.ImageSharp" Version="1.0.0-beta6" />
<PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.202.120"> <PackageReference Include="SpaceEngineersDedicated.ReferenceAssemblies" Version="1.202.124">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile</IncludeAssets> <IncludeAssets>compile</IncludeAssets>
</PackageReference> </PackageReference>

View File

@@ -116,9 +116,17 @@ namespace Torch
Plugins = new PluginManager(this); Plugins = new PluginManager(this);
#pragma warning restore CS0618 #pragma warning restore CS0618
var sessionManager = new TorchSessionManager(this);
sessionManager.AddFactory(_ => Sync.IsServer ? new ChatManagerServer(this) : new ChatManagerClient(this));
sessionManager.AddFactory(_ => Sync.IsServer ? new CommandManager(this) : null);
sessionManager.AddFactory(_ => new EntityManager(this));
Managers.AddManager(sessionManager);
Managers.AddManager(new PatchManager(this)); Managers.AddManager(new PatchManager(this));
Managers.AddManager(new FilesystemManager(this)); Managers.AddManager(new FilesystemManager(this));
Managers.AddManager(new UpdateManager(this)); #if !DEBUG
Managers.AddManager(new UpdateManager(this));
#endif
Managers.AddManager(new EventManager(this)); Managers.AddManager(new EventManager(this));
#pragma warning disable CS0618 #pragma warning disable CS0618
Managers.AddManager(Plugins); Managers.AddManager(Plugins);
@@ -283,15 +291,6 @@ namespace Torch
Game = new VRageGame(this, TweakGameSettings, SteamAppName, SteamAppId, InstancePath, RunArgs); Game = new VRageGame(this, TweakGameSettings, SteamAppName, SteamAppId, InstancePath, RunArgs);
if (!Game.WaitFor(VRageGame.GameState.Stopped)) if (!Game.WaitFor(VRageGame.GameState.Stopped))
Log.Warn("Failed to wait for game to be initialized"); Log.Warn("Failed to wait for game to be initialized");
var sessionManager = new TorchSessionManager(this);
sessionManager.AddFactory((x) => Sync.IsServer ? new ChatManagerServer(this) : new ChatManagerClient(this));
sessionManager.AddFactory((x) => Sync.IsServer ? new CommandManager(this) : null);
sessionManager.AddFactory((x) => new EntityManager(this));
Managers.AddManager(sessionManager);
Managers.Attach(); Managers.Attach();
_init = true; _init = true;

View File

@@ -14,11 +14,11 @@
}, },
"HarmonyX": { "HarmonyX": {
"type": "Direct", "type": "Direct",
"requested": "[2.10.2-prerelease.4, )", "requested": "[2.10.2-prerelease.6, )",
"resolved": "2.10.2-prerelease.4", "resolved": "2.10.2-prerelease.6",
"contentHash": "M/44/DhSu1WR8gL62aLPGKqAJ0rrgkw38nT3DgEvLAvyIoQLJmL2Jsn4/d4CC0eDT1Vv82cB9Mxgg0sFD3/qrQ==", "contentHash": "CPCUR/t5AQ5DDs40bTJ5OwUVTCoZONaJGbWKKjAOwg7c7Ct4KEbfybH6T+KvRGVjf5eN1oyGY5BN7EfWxUh9Xg==",
"dependencies": { "dependencies": {
"MonoModReorg.RuntimeDetour": "23.3.22.1" "MonoMod.RuntimeDetour": "25.0.0"
} }
}, },
"InfoOf.Fody": { "InfoOf.Fody": {
@@ -61,24 +61,24 @@
"Microsoft.CodeAnalysis.Common": "[4.6.0]" "Microsoft.CodeAnalysis.Common": "[4.6.0]"
} }
}, },
"MonoModReorg.RuntimeDetour": { "MonoMod.RuntimeDetour": {
"type": "Direct", "type": "Direct",
"requested": "[23.3.22.1, )", "requested": "[25.0.0, )",
"resolved": "23.3.22.1", "resolved": "25.0.0",
"contentHash": "cUES3Hi7QJtBNe0qwVdjZOCDkZDaCpdqS6Au0RaCyQ1PDIR4av13E9qBNAEYew46sgPe0fOrU334md6DLDGHlQ==", "contentHash": "u+G34uSEjU0+fk4Iz3Mfws/+E4kW460i6fBz1b4L/yxSndfmdKkJ+pYbU9pwh7IUxgk0Ko0+Mx3fSUQPaNk8nA==",
"dependencies": { "dependencies": {
"Mono.Cecil": "0.11.4", "Mono.Cecil": "0.11.4",
"MonoModReorg.Backports": "23.3.22.1", "MonoMod.Backports": "1.0.0",
"MonoModReorg.Core": "23.3.22.1", "MonoMod.Core": "1.0.0",
"MonoModReorg.ILHelpers": "23.3.22.1", "MonoMod.ILHelpers": "1.0.0",
"MonoModReorg.Utils": "23.3.22.1" "MonoMod.Utils": "25.0.0"
} }
}, },
"NLog": { "NLog": {
"type": "Direct", "type": "Direct",
"requested": "[5.2.0, )", "requested": "[5.2.2, )",
"resolved": "5.2.0", "resolved": "5.2.2",
"contentHash": "uYBgseY0m/9lQUbZYGsQsTBFOWrfs3iaekzzYMH6vFmpoOAvV8/bp1XxG/suZkwB5h8nAiTJAp7VENWRDKtKPA==" "contentHash": "r6Q9740g29gTwmTWlsgdIFm0mhNsfNZmbvWKX/Fxmi8X89ZrpUowHM2T2X1lP7RVpND+ef+XnfKL5g6Q1iNGXA=="
}, },
"PropertyChanged.Fody": { "PropertyChanged.Fody": {
"type": "Direct", "type": "Direct",
@@ -100,9 +100,9 @@
}, },
"SpaceEngineersDedicated.ReferenceAssemblies": { "SpaceEngineersDedicated.ReferenceAssemblies": {
"type": "Direct", "type": "Direct",
"requested": "[1.202.120, )", "requested": "[1.202.124, )",
"resolved": "1.202.120", "resolved": "1.202.124",
"contentHash": "HTP48NOSZY3eQPX3GJN+gjxdW83SM7DX6NcKCFqNIIvjz/J+l8uimHAQp9dnLySb0wb1K1Z1xBPIXyxMQRREIw==", "contentHash": "xw8mbJI2WwZcfWvgMf6c6E3agcQ/IQVVdnKZljszQBKq0cjhJG06AoonM+MI74CrYMJxf+wnA+4bzCt4mxy/Qg==",
"dependencies": { "dependencies": {
"protobuf-net": "1.0.0" "protobuf-net": "1.0.0"
} }
@@ -187,38 +187,38 @@
"resolved": "0.11.4", "resolved": "0.11.4",
"contentHash": "IC1h5g0NeJGHIUgzM1P82ld57knhP0IcQfrYITDPXlNpMYGUrsG5TxuaWTjaeqDNQMBDNZkB8L0rBnwsY6JHuQ==" "contentHash": "IC1h5g0NeJGHIUgzM1P82ld57knhP0IcQfrYITDPXlNpMYGUrsG5TxuaWTjaeqDNQMBDNZkB8L0rBnwsY6JHuQ=="
}, },
"MonoModReorg.Backports": { "MonoMod.Backports": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "1.0.0",
"contentHash": "nLx18prtZbS0nVO8YHElP+TUj1kkDswRgQpa9agt3tyNWke9Kqk5lVkGu87Y3cCMhG+m5Ai0ZDH0+V5B6bXF+Q==", "contentHash": "J59I4CMe24aCmWboHCDzQIk37kXqHnJH6KQfDGstlznuDni7Lwdd/8CywmEwVXjVEgfs5yQzvOTW3Xg1NH7fDQ==",
"dependencies": { "dependencies": {
"MonoModReorg.ILHelpers": "23.3.22.1" "MonoMod.ILHelpers": "1.0.0"
} }
}, },
"MonoModReorg.Core": { "MonoMod.Core": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "1.0.0",
"contentHash": "Q3ZOgm6AOTL0icgcHsT/6mV5kYt6meqX3DEN1p/et5PxJsXUhVkiZfAptp8y/i+cO6HNgkcESpXEQ4jUWVwsDA==", "contentHash": "FlzAEa4ujbA1t3rbKxuW3DP36T0/L6k2IP1F4QXM1cOXMJLHm39Azjt98E/9LFRFBWYFdlMUmg+4THLv2xyisA==",
"dependencies": { "dependencies": {
"Mono.Cecil": "0.11.4", "Mono.Cecil": "0.11.4",
"MonoModReorg.Backports": "23.3.22.1", "MonoMod.Backports": "1.0.0",
"MonoModReorg.ILHelpers": "23.3.22.1", "MonoMod.ILHelpers": "1.0.0",
"MonoModReorg.Utils": "23.3.22.1" "MonoMod.Utils": "25.0.0"
} }
}, },
"MonoModReorg.ILHelpers": { "MonoMod.ILHelpers": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "1.0.0",
"contentHash": "dHE/3VZtnTUTkQ34j8Gu6CxKes1QDL8tBuF3QElxHHpPl/QabGCK938k47WWRcRBMoP7IAthkn+Bob4H97rBgw==" "contentHash": "dTjGA+dYl7W5yQ0oG/Wr57tsa+ueoFUrwPtz9MZF9iheun4n70u7lge52F8UJi9i0zMHRfS2mAY6+nPuRZHQyQ=="
}, },
"MonoModReorg.Utils": { "MonoMod.Utils": {
"type": "Transitive", "type": "Transitive",
"resolved": "23.3.22.1", "resolved": "25.0.0",
"contentHash": "q1cX0mbYxdw2WcE/qGBB84lVY/ffobEr46VQFuwGcWhtw6f1Ql1k4TZfs8gebpesSxHnca13grLeVHrUSpy1+g==", "contentHash": "E8m0pH3Kact+A2qH+lxMis90K8+ixInwprn0R1nuAMRHfotHUHeYmr304UEPeInSuY3+IlnC+OB8fqbQiTsWlQ==",
"dependencies": { "dependencies": {
"Mono.Cecil": "0.11.4", "Mono.Cecil": "0.11.4",
"MonoModReorg.Backports": "23.3.22.1", "MonoMod.Backports": "1.0.0",
"MonoModReorg.ILHelpers": "23.3.22.1" "MonoMod.ILHelpers": "1.0.0"
} }
}, },
"Newtonsoft.Json": { "Newtonsoft.Json": {
@@ -408,7 +408,7 @@
"dependencies": { "dependencies": {
"JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )", "JorgeSerrano.Json.JsonSnakeCaseNamingPolicy": "[0.9.0, )",
"Microsoft.Extensions.Configuration.Binder": "[7.0.4, )", "Microsoft.Extensions.Configuration.Binder": "[7.0.4, )",
"NLog": "[5.2.0, )", "NLog": "[5.2.2, )",
"NuGet.Commands": "[6.6.1, )", "NuGet.Commands": "[6.6.1, )",
"NuGet.DependencyResolver.Core": "[6.6.1, )", "NuGet.DependencyResolver.Core": "[6.6.1, )",
"SemanticVersioning": "[2.0.2, )", "SemanticVersioning": "[2.0.2, )",