Rename RenderSpritesInfo.RaceImages
This commit is contained in:
@@ -29,9 +29,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("The sequence name that defines the actor sprites. Defaults to the actor name.")]
|
||||
public readonly string Image = null;
|
||||
|
||||
[FieldLoader.LoadUsing("LoadRaceImages")]
|
||||
[Desc("A dictionary of race-specific image overrides.")]
|
||||
public readonly Dictionary<string, string> RaceImages = null;
|
||||
[FieldLoader.LoadUsing("LoadFactionImages")]
|
||||
[Desc("A dictionary of faction-specific image overrides.")]
|
||||
public readonly Dictionary<string, string> FactionImages = null;
|
||||
|
||||
[Desc("Custom palette name")]
|
||||
[PaletteReference] public readonly string Palette = null;
|
||||
@@ -42,11 +42,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Change the sprite image size.")]
|
||||
public readonly float Scale = 1f;
|
||||
|
||||
protected static object LoadRaceImages(MiniYaml y)
|
||||
protected static object LoadFactionImages(MiniYaml y)
|
||||
{
|
||||
MiniYaml images;
|
||||
|
||||
if (!y.ToDictionary().TryGetValue("RaceImages", out images))
|
||||
if (!y.ToDictionary().TryGetValue("FactionImages", out images))
|
||||
return null;
|
||||
|
||||
return images.Nodes.ToDictionary(kv => kv.Key, kv => kv.Value.Value);
|
||||
@@ -82,10 +82,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public string GetImage(ActorInfo actor, SequenceProvider sequenceProvider, string race)
|
||||
{
|
||||
if (RaceImages != null && !string.IsNullOrEmpty(race))
|
||||
if (FactionImages != null && !string.IsNullOrEmpty(race))
|
||||
{
|
||||
string raceImage = null;
|
||||
if (RaceImages.TryGetValue(race, out raceImage) && sequenceProvider.HasSequence(raceImage))
|
||||
if (FactionImages.TryGetValue(race, out raceImage) && sequenceProvider.HasSequence(raceImage))
|
||||
return raceImage;
|
||||
}
|
||||
|
||||
|
||||
@@ -1768,6 +1768,15 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
if (engineVersion < 20150816)
|
||||
{
|
||||
// Rename RenderSprites.RaceImages
|
||||
if (depth == 2 && node.Key == "RaceImages")
|
||||
node.Key = "FactionImages";
|
||||
if (depth == 2 && node.Key == "-RaceImages")
|
||||
node.Key = "-FactionImages";
|
||||
}
|
||||
|
||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user