Merge pull request #432 from theltp/fix/cross-play
totally fix for cross play
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
@@ -19,6 +19,7 @@ using Torch.Collections;
|
||||
using Torch.Managers;
|
||||
using Torch.Mod;
|
||||
using Torch.Server.ViewModels;
|
||||
using Torch.Utils;
|
||||
using VRage;
|
||||
using VRage.FileSystem;
|
||||
using VRage.Game;
|
||||
@@ -217,8 +218,11 @@ namespace Torch.Server.Managers
|
||||
|
||||
foreach (var mod in DedicatedConfig.Mods)
|
||||
{
|
||||
var savedMod = new MyObjectBuilder_Checkpoint.ModItem(mod.Name, mod.PublishedFileId, mod.FriendlyName);
|
||||
var savedMod = ModItemUtils.Create(mod.PublishedFileId);
|
||||
savedMod.IsDependency = mod.IsDependency;
|
||||
savedMod.Name = mod.Name;
|
||||
savedMod.FriendlyName = mod.FriendlyName;
|
||||
|
||||
world.WorldConfiguration.Mods.Add(savedMod);
|
||||
}
|
||||
Task.Run(() => DedicatedConfig.UpdateAllModInfosAsync());
|
||||
|
@@ -98,7 +98,7 @@ namespace Torch.Server.Views
|
||||
{
|
||||
if (TryExtractId(AddModIDTextBox.Text, out ulong id))
|
||||
{
|
||||
var mod = new ModItemInfo(new MyObjectBuilder_Checkpoint.ModItem(id, MyGameService.GetDefaultUGC().ServiceName));
|
||||
var mod = new ModItemInfo(ModItemUtils.Create(id));
|
||||
//mod.PublishedFileId = id;
|
||||
_instanceManager.DedicatedConfig.Mods.Add(mod);
|
||||
Task.Run(mod.UpdateModInfoAsync)
|
||||
|
@@ -1,9 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NLog;
|
||||
using Sandbox;
|
||||
using Sandbox.Engine.Networking;
|
||||
using Torch.API;
|
||||
using Torch.Managers.PatchManager;
|
||||
using Torch.Managers.PatchManager.MSIL;
|
||||
using Torch.Utils;
|
||||
@@ -12,7 +14,7 @@ using VRage.Game;
|
||||
namespace Torch.Patches
|
||||
{
|
||||
[PatchShim]
|
||||
internal class ModsDownloadingPatch
|
||||
internal static class ModsDownloadingPatch
|
||||
{
|
||||
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
||||
#pragma warning disable 649
|
||||
@@ -23,28 +25,15 @@ namespace Torch.Patches
|
||||
public static void Patch(PatchContext ctx)
|
||||
{
|
||||
_log.Info("Patching mods downloading");
|
||||
var pattern = ctx.GetPattern(_downloadWorldModsBlockingMethod);
|
||||
pattern.Suffixes
|
||||
|
||||
ctx.GetPattern(_downloadWorldModsBlockingMethod).Suffixes
|
||||
.Add(typeof(ModsDownloadingPatch).GetMethod(nameof(Postfix)));
|
||||
pattern.Prefixes.Add(typeof(ModsDownloadingPatch).GetMethod(nameof(Prefix)));
|
||||
}
|
||||
|
||||
public static void Prefix(ref List<MyObjectBuilder_Checkpoint.ModItem> mods)
|
||||
{
|
||||
var serviceName = MyGameService.GetDefaultUGC().ServiceName;
|
||||
mods = mods?.Select(b => {
|
||||
b.PublishedServiceName = serviceName;
|
||||
return b;
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public static void Postfix(MyWorkshop.ResultData __result)
|
||||
{
|
||||
if (!__result.Success)
|
||||
{
|
||||
_log.Warn("Missing Mods:");
|
||||
__result.MismatchMods.ForEach(b => _log.Info($"\t{b.Title} : {b.Id}"));
|
||||
}
|
||||
if (__result.Success) return;
|
||||
_log.Warn("Missing Mods:");
|
||||
__result.MismatchMods?.ForEach(b => _log.Info($"\t{b}"));
|
||||
}
|
||||
}
|
||||
}
|
@@ -183,7 +183,7 @@ namespace Torch
|
||||
"xyza7891A4WeGrpP85BTlBa3BSfUEABN", "ZdHZVevSVfIajebTnTmh5MVi3KPHflszD9hJB7mRkgg",
|
||||
"24b1cd652a18461fa9b3d533ac8d6b5b", "1958fe26c66d4151a327ec162e4d49c8",
|
||||
"07c169b3b641401496d352cad1c905d6", "https://retail.epicgames.com/", MyEOSService.CreatePlatform(),
|
||||
MySandboxGame.ConfigDedicated.VerboseNetworkLogging, null, null, null);
|
||||
MySandboxGame.ConfigDedicated.VerboseNetworkLogging, null, Enumerable.Empty<string>(), null);
|
||||
|
||||
var mockingInventory = new MyMockingInventory(service);
|
||||
MyServiceManager.Instance.AddService<IMyInventoryService>(mockingInventory);
|
||||
|
Reference in New Issue
Block a user