Add RequiresMods tag to the mod Manifest

List required mods and their versions to enable mod dependencies on another mods.
Also used for identifying the engine version by `modchooser`'s version.
This commit is contained in:
Pavel Penev
2015-09-09 17:13:13 +03:00
parent ef1e217a2a
commit 9748b556dc
8 changed files with 59 additions and 5 deletions

View File

@@ -27,6 +27,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly Dictionary<string, Sprite> previews = new Dictionary<string, Sprite>();
readonly Dictionary<string, Sprite> logos = new Dictionary<string, Sprite>();
readonly Cache<ModMetadata, bool> modInstallStatus;
readonly Cache<string, bool> modPrerequisitesFulfilled;
readonly Widget modChooserPanel;
readonly ButtonWidget loadButton;
readonly SheetBuilder sheetBuilder;
@@ -38,6 +39,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
[ObjectCreator.UseCtor]
public ModBrowserLogic(Widget widget)
{
modInstallStatus = new Cache<ModMetadata, bool>(IsModInstalled);
modPrerequisitesFulfilled = new Cache<string, bool>(Game.IsModInstalled);
modChooserPanel = widget;
loadButton = modChooserPanel.Get<ButtonWidget>("LOAD_BUTTON");
loadButton.OnClick = () => LoadMod(selectedMod);
@@ -93,8 +97,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
catch (Exception) { }
}
modInstallStatus = new Cache<ModMetadata, bool>(IsModInstalled);
ModMetadata initialMod;
ModMetadata.AllMods.TryGetValue(Game.Settings.Game.PreviousMod, out initialMod);
SelectMod(initialMod != null && initialMod.Id != "modchooser" ? initialMod : ModMetadata.AllMods["ra"]);
@@ -157,6 +159,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
modOffset = selectedIndex - 4;
loadButton.Text = modInstallStatus[mod] ? "Load Mod" : "Install Assets";
loadButton.Text = modPrerequisitesFulfilled[mod.Id] ? loadButton.Text : "Prerequisites missing!";
}
void LoadMod(ModMetadata mod)