Merge pull request #9092 from penev92/bleed_rename
Some more renaming from "race" to "faction"
This commit is contained in:
@@ -33,8 +33,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("The list of unit target types we are allowed to duplicate.")]
|
||||
public readonly string[] ValidTargets = { "Ground", "Water" };
|
||||
|
||||
[Desc("Which races this crate action can occur for.")]
|
||||
public readonly string[] ValidRaces = { };
|
||||
[Desc("Which factions this crate action can occur for.")]
|
||||
public readonly string[] ValidFactions = { };
|
||||
|
||||
[Desc("Is the new duplicates given to a specific owner, regardless of whom collected it?")]
|
||||
public readonly string Owner = null;
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public bool CanGiveTo(Actor collector)
|
||||
{
|
||||
if (info.ValidRaces.Any() && !info.ValidRaces.Contains(collector.Owner.Faction.InternalName))
|
||||
if (info.ValidFactions.Any() && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName))
|
||||
return false;
|
||||
|
||||
var targetable = collector.Info.Traits.GetOrDefault<ITargetableInfo>();
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[ActorReference, FieldLoader.Require]
|
||||
public readonly string[] Units = { };
|
||||
|
||||
[Desc("Races that are allowed to trigger this action")]
|
||||
public readonly string[] ValidRaces = { };
|
||||
[Desc("Factions that are allowed to trigger this action.")]
|
||||
public readonly string[] ValidFactions = { };
|
||||
|
||||
[Desc("Override the owner of the newly spawned unit: e.g. Creeps or Neutral")]
|
||||
public readonly string Owner = null;
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public bool CanGiveTo(Actor collector)
|
||||
{
|
||||
if (info.ValidRaces.Any() && !info.ValidRaces.Contains(collector.Owner.Faction.InternalName))
|
||||
if (info.ValidFactions.Any() && !info.ValidFactions.Contains(collector.Owner.Faction.InternalName))
|
||||
return false;
|
||||
|
||||
foreach (string unit in info.Units)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
readonly string race;
|
||||
readonly string faction;
|
||||
readonly RenderSpritesInfo info;
|
||||
readonly List<AnimationWrapper> anims = new List<AnimationWrapper>();
|
||||
string cachedImage;
|
||||
@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public RenderSprites(ActorInitializer init, RenderSpritesInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||
faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||
}
|
||||
|
||||
public string GetImage(Actor self)
|
||||
@@ -153,7 +153,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (cachedImage != null)
|
||||
return cachedImage;
|
||||
|
||||
return cachedImage = info.GetImage(self.Info, self.World.Map.SequenceProvider, race);
|
||||
return cachedImage = info.GetImage(self.Info, self.World.Map.SequenceProvider, faction);
|
||||
}
|
||||
|
||||
public void UpdatePalette()
|
||||
|
||||
@@ -1768,6 +1768,20 @@ 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";
|
||||
|
||||
// Rename *CrateAction.ValidRaces
|
||||
if (depth == 2 && node.Key == "ValidRaces"
|
||||
&& (parentKey == "DuplicateUnitCrateAction" || parentKey == "GiveUnitCrateAction"))
|
||||
node.Key = "ValidFactions";
|
||||
}
|
||||
|
||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user