diff --git a/Torch.API/Torch.API.csproj b/Torch.API/Torch.API.csproj index 3a7fa7a..8ebcaaa 100644 --- a/Torch.API/Torch.API.csproj +++ b/Torch.API/Torch.API.csproj @@ -185,6 +185,7 @@ + diff --git a/Torch.API/Utils/ModItemUtils.cs b/Torch.API/Utils/ModItemUtils.cs new file mode 100644 index 0000000..d868aa1 --- /dev/null +++ b/Torch.API/Utils/ModItemUtils.cs @@ -0,0 +1,16 @@ +using Sandbox.Engine.Networking; +using VRage.Game; + +namespace Torch.Utils +{ + public static class ModItemUtils + { + public static MyObjectBuilder_Checkpoint.ModItem Create(ulong modId) + { + var serviceName = "Steam"; + if (MyGameService.IsOnline) + serviceName = MyGameService.GetDefaultUGC().ServiceName; + return new MyObjectBuilder_Checkpoint.ModItem(modId, serviceName); + } + } +} \ No newline at end of file diff --git a/Torch.Server/Views/Converters/ListConverterWorkshopId.cs b/Torch.Server/Views/Converters/ListConverterWorkshopId.cs index f58afac..1771884 100644 --- a/Torch.Server/Views/Converters/ListConverterWorkshopId.cs +++ b/Torch.Server/Views/Converters/ListConverterWorkshopId.cs @@ -7,7 +7,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; +using Sandbox.Engine.Networking; using Torch.Server.ViewModels; +using Torch.Utils; using VRage.Game; namespace Torch.Server.Views.Converters @@ -67,7 +69,7 @@ namespace Torch.Server.Views.Converters if (mod != null) list.Add(mod); else - list.Add(new MyObjectBuilder_Checkpoint.ModItem(id)); + list.Add(ModItemUtils.Create(id)); } } diff --git a/Torch.Server/Views/ModListControl.xaml.cs b/Torch.Server/Views/ModListControl.xaml.cs index 028bead..31fddc5 100644 --- a/Torch.Server/Views/ModListControl.xaml.cs +++ b/Torch.Server/Views/ModListControl.xaml.cs @@ -20,11 +20,13 @@ using System.Runtime.CompilerServices; using System.Windows.Threading; using VRage.Game; using NLog; +using Sandbox.Engine.Networking; using Torch.Server.Managers; using Torch.API.Managers; using Torch.Server.ViewModels; using Torch.Server.Annotations; using Torch.Collections; +using Torch.Utils; using Torch.Views; namespace Torch.Server.Views @@ -96,7 +98,7 @@ namespace Torch.Server.Views { if (TryExtractId(AddModIDTextBox.Text, out ulong id)) { - var mod = new ModItemInfo(new MyObjectBuilder_Checkpoint.ModItem(id)); + var mod = new ModItemInfo(new MyObjectBuilder_Checkpoint.ModItem(id, MyGameService.GetDefaultUGC().ServiceName)); //mod.PublishedFileId = id; _instanceManager.DedicatedConfig.Mods.Add(mod); Task.Run(mod.UpdateModInfoAsync) @@ -262,7 +264,7 @@ namespace Torch.Server.Views { if (!modList.Any(m => m.PublishedFileId == id)) { - var mod = new ModItemInfo(new MyObjectBuilder_Checkpoint.ModItem(id)); + var mod = new ModItemInfo(ModItemUtils.Create(id)); tasks.Add(Task.Run(mod.UpdateModInfoAsync)); modList.Add(mod); } diff --git a/Torch/Session/TorchSessionManager.cs b/Torch/Session/TorchSessionManager.cs index d8fab39..de52707 100644 --- a/Torch/Session/TorchSessionManager.cs +++ b/Torch/Session/TorchSessionManager.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using NLog; +using Sandbox.Engine.Networking; using Sandbox.Game.World; using Torch.API; using Torch.API.Managers; @@ -12,6 +13,7 @@ using Torch.API.Session; using Torch.Managers; using Torch.Mod; using Torch.Session; +using Torch.Utils; using VRage.Game; namespace Torch.Session @@ -44,7 +46,7 @@ namespace Torch.Session public TorchSessionManager(ITorchBase torchInstance) : base(torchInstance) { _overrideMods = new Dictionary(); - _overrideMods.Add(TorchModCore.MOD_ID, new MyObjectBuilder_Checkpoint.ModItem(TorchModCore.MOD_ID)); + _overrideMods.Add(TorchModCore.MOD_ID, ModItemUtils.Create(TorchModCore.MOD_ID)); } /// @@ -68,7 +70,7 @@ namespace Torch.Session { if (_overrideMods.ContainsKey(modId)) return false; - var item = new MyObjectBuilder_Checkpoint.ModItem(modId); + var item = ModItemUtils.Create(modId); _overrideMods.Add(modId, item); OverrideModsChanged?.Invoke(new CollectionChangeEventArgs(CollectionChangeAction.Add, item)); diff --git a/Torch/VRageGame.cs b/Torch/VRageGame.cs index 0efcbcc..62bb5f5 100644 --- a/Torch/VRageGame.cs +++ b/Torch/VRageGame.cs @@ -145,8 +145,10 @@ namespace Torch MySessionComponentExtDebug.ForceDisable = true; MyPerGameSettings.SendLogToKeen = false; // SpaceEngineersGame.SetupAnalytics(); - - MyVRage.Platform.InitScripting(MyVRageScripting.Create()); + + //not implemented by keen.. removed in cross-play update + //MyVRage.Platform.InitScripting(MyVRageScripting.Create()); + MyFileSystem.ExePath = Path.GetDirectoryName(typeof(SpaceEngineersGame).Assembly.Location); _tweakGameSettings(); @@ -161,7 +163,7 @@ namespace Torch var serviceInstance = MySteamUgcService.Create(_appSteamId, service); MyServiceManager.Instance.AddService(serviceInstance); MyServiceManager.Instance.AddService(new MyNullMicrophone()); - MySteamGameService.InitNetworking(dedicated, service); + MySteamGameService.InitNetworking(dedicated, service, (MyServerDiscoveryAggregator) MyGameService.ServerDiscovery); if (!MyGameService.HasGameServer) { _log.Warn("Steam service is not running! Please reinstall dedicated server.");