Add Id field to ProvidesTechPrerequisite.

This commit is contained in:
Paul Chote
2016-05-19 14:37:01 +01:00
parent 038a10b676
commit d27d265bdd
5 changed files with 29 additions and 1 deletions

View File

@@ -15,7 +15,14 @@ namespace OpenRA.Mods.Common.Traits
{
public class ProvidesTechPrerequisiteInfo : ITechTreePrerequisiteInfo
{
[Desc("Internal id for this tech level.")]
public readonly string Id;
[Translate]
[Desc("Name shown in the lobby options.")]
public readonly string Name;
[Desc("Prerequisites to grant when this tech level is active.")]
public readonly string[] Prerequisites = { };
public object Create(ActorInitializer init) { return new ProvidesTechPrerequisite(this, init); }
@@ -23,8 +30,9 @@ namespace OpenRA.Mods.Common.Traits
public class ProvidesTechPrerequisite : ITechTreePrerequisite
{
ProvidesTechPrerequisiteInfo info;
readonly ProvidesTechPrerequisiteInfo info;
bool enabled;
static readonly string[] NoPrerequisites = new string[0];
public string Name { get { return info.Name; } }

View File

@@ -804,6 +804,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
if (engineVersion < 20160604 && node.Key.StartsWith("ProvidesTechPrerequisite"))
{
var name = node.Value.Nodes.First(n => n.Key == "Name");
var id = name.Value.Value.ToLowerInvariant().Replace(" ", "");
node.Value.Nodes.Add(new MiniYamlNode("Id", id));
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}