Rework mod enumeration / caching.
- Replaced ModMetadata.AllMods with Game.Mods. - Store / reference mod Manifest instead of ModMetadata. - Removes engine dependency on ModContent class.
This commit is contained in:
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Author = "Westwood Studios",
|
||||
};
|
||||
|
||||
Map.RequiresMod = ModData.Manifest.Mod.Id;
|
||||
Map.RequiresMod = ModData.Manifest.Id;
|
||||
|
||||
SetBounds(Map, mapSection);
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
@@ -31,7 +30,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var filename = Path.GetFileName(args[1]);
|
||||
var path = Path.GetDirectoryName(args[1]);
|
||||
|
||||
var fs = new OpenRA.FileSystem.FileSystem();
|
||||
var fs = new FileSystem.FileSystem(utility.Mods);
|
||||
fs.Mount(path, "parent");
|
||||
var package = new InstallShieldPackage(fs, "parent|" + filename);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var filename = Path.GetFileName(args[1]);
|
||||
var path = Path.GetDirectoryName(args[1]);
|
||||
|
||||
var fs = new OpenRA.FileSystem.FileSystem();
|
||||
var fs = new FileSystem.FileSystem(utility.Mods);
|
||||
|
||||
// Needed to access the global mix database
|
||||
fs.LoadFromManifest(utility.ModData.Manifest);
|
||||
|
||||
@@ -39,14 +39,14 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
remap[i] = i;
|
||||
|
||||
var srcMod = args[1].Split(':')[0];
|
||||
var srcModData = new ModData(srcMod);
|
||||
var srcModData = new ModData(utility.Mods[srcMod], utility.Mods);
|
||||
Game.ModData = srcModData;
|
||||
|
||||
var srcPaletteInfo = srcModData.DefaultRules.Actors["player"].TraitInfo<PlayerColorPaletteInfo>();
|
||||
var srcRemapIndex = srcPaletteInfo.RemapIndex;
|
||||
|
||||
var destMod = args[2].Split(':')[0];
|
||||
var destModData = new ModData(destMod);
|
||||
var destModData = new ModData(utility.Mods[destMod], utility.Mods);
|
||||
Game.ModData = destModData;
|
||||
var destPaletteInfo = destModData.DefaultRules.Actors["player"].TraitInfo<PlayerColorPaletteInfo>();
|
||||
var destRemapIndex = destPaletteInfo.RemapIndex;
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
if (engineVersion < 20160730 && modData.Manifest.Mod.Id == "d2k" && depth == 2)
|
||||
if (engineVersion < 20160730 && modData.Manifest.Id == "d2k" && depth == 2)
|
||||
{
|
||||
if (node.Key == "Start")
|
||||
node.Value.Value = RemapD2k106Sequence(FieldLoader.GetValue<int>("", node.Value.Value)).ToString();
|
||||
@@ -416,7 +416,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
// Fix RA building footprints to not use _ when it's not necessary
|
||||
if (engineVersion < 20160619 && modData.Manifest.Mod.Id == "ra" && depth == 1)
|
||||
if (engineVersion < 20160619 && modData.Manifest.Id == "ra" && depth == 1)
|
||||
{
|
||||
var buildings = new List<string>() { "tsla", "gap", "agun", "apwr", "fapw" };
|
||||
if (buildings.Contains(parent.Value.Value) && node.Key == "Location")
|
||||
@@ -424,7 +424,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
|
||||
// Fix TD building footprints to not use _ when it's not necessary
|
||||
if (engineVersion < 20160619 && modData.Manifest.Mod.Id == "cnc" && depth == 1)
|
||||
if (engineVersion < 20160619 && modData.Manifest.Id == "cnc" && depth == 1)
|
||||
{
|
||||
var buildings = new List<string>() { "atwr", "obli", "tmpl", "weap", "hand" };
|
||||
if (buildings.Contains(parent.Value.Value) && node.Key == "Location")
|
||||
|
||||
Reference in New Issue
Block a user