fix for cross-play update
This commit is contained in:
@@ -185,6 +185,7 @@
|
||||
<Compile Include="Session\TorchSessionState.cs" />
|
||||
<Compile Include="TorchGameState.cs" />
|
||||
<Compile Include="Utils\ColorUtils.cs" />
|
||||
<Compile Include="Utils\ModItemUtils.cs" />
|
||||
<Compile Include="Utils\StringUtils.cs" />
|
||||
<Compile Include="WebAPI\JenkinsQuery.cs" />
|
||||
<Compile Include="WebAPI\PluginQuery.cs" />
|
||||
|
16
Torch.API/Utils/ModItemUtils.cs
Normal file
16
Torch.API/Utils/ModItemUtils.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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<ulong, MyObjectBuilder_Checkpoint.ModItem>();
|
||||
_overrideMods.Add(TorchModCore.MOD_ID, new MyObjectBuilder_Checkpoint.ModItem(TorchModCore.MOD_ID));
|
||||
_overrideMods.Add(TorchModCore.MOD_ID, ModItemUtils.Create(TorchModCore.MOD_ID));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -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));
|
||||
|
@@ -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<IMyUGCService>(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.");
|
||||
|
Reference in New Issue
Block a user