Merge pull request #8851 from penev92/bleed_rename
Some more renaming from "race" to "faction"
This commit is contained in:
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
readonly BuildingInfo buildingInfo;
|
||||
readonly PlaceBuildingInfo placeBuildingInfo;
|
||||
readonly BuildingInfluence buildingInfluence;
|
||||
readonly string race;
|
||||
readonly string faction;
|
||||
readonly Sprite buildOk;
|
||||
readonly Sprite buildBlocked;
|
||||
IActorPreview[] preview;
|
||||
@@ -50,7 +50,8 @@ namespace OpenRA.Mods.Common.Orders
|
||||
|
||||
var buildableInfo = info.Traits.Get<BuildableInfo>();
|
||||
var mostLikelyProducer = queue.MostLikelyProducer();
|
||||
race = buildableInfo.ForceRace ?? (mostLikelyProducer.Trait != null ? mostLikelyProducer.Trait.Race : producer.Owner.Faction.InternalName);
|
||||
faction = buildableInfo.ForceFaction
|
||||
?? (mostLikelyProducer.Trait != null ? mostLikelyProducer.Trait.Faction : producer.Owner.Faction.InternalName);
|
||||
|
||||
buildOk = map.SequenceProvider.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0);
|
||||
buildBlocked = map.SequenceProvider.GetSequence("overlay", "build-invalid").GetSprite(0);
|
||||
@@ -170,7 +171,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
{
|
||||
var td = new TypeDictionary()
|
||||
{
|
||||
new FactionInit(race),
|
||||
new FactionInit(faction),
|
||||
new OwnerInit(producer.Owner),
|
||||
new HideBibPreviewInit()
|
||||
};
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Disable production when there are more than this many of this actor on the battlefield. Set to 0 to disable.")]
|
||||
public readonly int BuildLimit = 0;
|
||||
|
||||
[Desc("Force a specific race variant, overriding the race of the producing actor.")]
|
||||
public readonly string ForceRace = null;
|
||||
[Desc("Force a specific faction variant, overriding the faction of the producing actor.")]
|
||||
public readonly string ForceFaction = null;
|
||||
|
||||
[Desc("Palette used for the production icon.")]
|
||||
public readonly string IconPalette = "chrome";
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var p in producers.Where(p => !p.Actor.IsDisabled()))
|
||||
{
|
||||
if (p.Trait.Produce(p.Actor, ai, p.Trait.Race))
|
||||
if (p.Trait.Produce(p.Actor, ai, p.Trait.Faction))
|
||||
{
|
||||
FinishProduction();
|
||||
return true;
|
||||
|
||||
@@ -62,12 +62,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
var producer = queue.MostLikelyProducer();
|
||||
var race = producer.Trait != null ? producer.Trait.Race : self.Owner.Faction.InternalName;
|
||||
var faction = producer.Trait != null ? producer.Trait.Faction : self.Owner.Faction.InternalName;
|
||||
var buildingInfo = unit.Traits.Get<BuildingInfo>();
|
||||
|
||||
var buildableInfo = unit.Traits.GetOrDefault<BuildableInfo>();
|
||||
if (buildableInfo != null && buildableInfo.ForceRace != null)
|
||||
race = buildableInfo.ForceRace;
|
||||
if (buildableInfo != null && buildableInfo.ForceFaction != null)
|
||||
faction = buildableInfo.ForceFaction;
|
||||
|
||||
if (os == "LineBuild")
|
||||
{
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
new LocationInit(t),
|
||||
new OwnerInit(order.Player),
|
||||
new FactionInit(race)
|
||||
new FactionInit(faction)
|
||||
});
|
||||
|
||||
if (playSounds)
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
new LocationInit(order.TargetLocation),
|
||||
new OwnerInit(order.Player),
|
||||
new FactionInit(race),
|
||||
new FactionInit(faction),
|
||||
});
|
||||
|
||||
foreach (var s in buildingInfo.BuildSounds)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string[] RequiresPrerequisites = { };
|
||||
|
||||
[Desc("Only grant this prerequisite for certain factions.")]
|
||||
public readonly string[] Race = { };
|
||||
public readonly string[] Factions = { };
|
||||
|
||||
[Desc("Should it recheck everything when it is captured?")]
|
||||
public readonly bool ResetOnOwnerChange = false;
|
||||
@@ -45,9 +45,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (string.IsNullOrEmpty(prerequisite))
|
||||
prerequisite = init.Self.Info.Name;
|
||||
|
||||
var race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||
var faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||
|
||||
Update(init.Self.Owner, race);
|
||||
Update(init.Self.Owner, faction);
|
||||
}
|
||||
|
||||
public IEnumerable<string> ProvidesPrerequisites
|
||||
@@ -67,12 +67,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Update(newOwner, newOwner.Faction.InternalName);
|
||||
}
|
||||
|
||||
void Update(Player owner, string race)
|
||||
void Update(Player owner, string faction)
|
||||
{
|
||||
enabled = true;
|
||||
|
||||
if (info.Race.Any())
|
||||
enabled = info.Race.Contains(race);
|
||||
if (info.Factions.Any())
|
||||
enabled = info.Factions.Contains(faction);
|
||||
|
||||
if (info.RequiresPrerequisites.Any() && enabled)
|
||||
enabled = owner.PlayerActor.Trait<TechTree>().HasPrerequisites(info.RequiresPrerequisites);
|
||||
|
||||
@@ -33,16 +33,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly Lazy<RallyPoint> rp;
|
||||
|
||||
public ProductionInfo Info;
|
||||
public string Race { get; private set; }
|
||||
public string Faction { get; private set; }
|
||||
|
||||
public Production(ActorInitializer init, ProductionInfo info)
|
||||
{
|
||||
Info = info;
|
||||
rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>());
|
||||
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 void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, string raceVariant)
|
||||
public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, string factionVariant)
|
||||
{
|
||||
var exit = self.Location + exitinfo.ExitCell;
|
||||
var spawn = self.CenterPosition + exitinfo.SpawnOffset;
|
||||
@@ -55,8 +55,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var target = Target.FromCell(self.World, exitLocation);
|
||||
|
||||
var bi = producee.Traits.GetOrDefault<BuildableInfo>();
|
||||
if (bi != null && bi.ForceRace != null)
|
||||
raceVariant = bi.ForceRace;
|
||||
if (bi != null && bi.ForceFaction != null)
|
||||
factionVariant = bi.ForceFaction;
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
@@ -68,8 +68,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
new FacingInit(initialFacing)
|
||||
};
|
||||
|
||||
if (raceVariant != null)
|
||||
td.Add(new FactionInit(raceVariant));
|
||||
if (factionVariant != null)
|
||||
td.Add(new FactionInit(factionVariant));
|
||||
|
||||
var newUnit = self.World.CreateActor(producee.Name, td);
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
public virtual bool Produce(Actor self, ActorInfo producee, string raceVariant)
|
||||
public virtual bool Produce(Actor self, ActorInfo producee, string factionVariant)
|
||||
{
|
||||
if (Reservable.IsReserved(self))
|
||||
return false;
|
||||
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (exit != null)
|
||||
{
|
||||
DoProduction(self, producee, exit, raceVariant);
|
||||
DoProduction(self, producee, exit, factionVariant);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1663,6 +1663,23 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
if (engineVersion < 20150731)
|
||||
{
|
||||
if (node.Key.StartsWith("ProvidesPrerequisite"))
|
||||
{
|
||||
var raceNode = node.Value.Nodes.FirstOrDefault(x => x.Key == "Race");
|
||||
if (raceNode != null)
|
||||
raceNode.Key = "Factions";
|
||||
}
|
||||
|
||||
if (node.Key.StartsWith("Buildable"))
|
||||
{
|
||||
var raceNode = node.Value.Nodes.FirstOrDefault(x => x.Key == "ForceRace");
|
||||
if (raceNode != null)
|
||||
raceNode.Key = "ForceFaction";
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
public readonly Player Player;
|
||||
public readonly string Label;
|
||||
public readonly Color Color;
|
||||
public readonly string Race;
|
||||
public readonly string Faction;
|
||||
public readonly Func<bool> IsSelected;
|
||||
public readonly Action OnClick;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Player = p;
|
||||
Label = p.PlayerName;
|
||||
Color = p.Color.RGB;
|
||||
Race = p.Faction.InternalName;
|
||||
Faction = p.Faction.InternalName;
|
||||
IsSelected = () => p.World.RenderPlayer == p;
|
||||
OnClick = () => { p.World.RenderPlayer = p; logic.selected = this; p.World.Selection.Clear(); };
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Player = p;
|
||||
Label = label;
|
||||
Color = Color.White;
|
||||
Race = null;
|
||||
Faction = null;
|
||||
IsSelected = () => w.RenderPlayer == p;
|
||||
OnClick = () => { w.RenderPlayer = p; logic.selected = this; };
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
Func<CameraOption, ScrollItemWidget, ScrollItemWidget> setupItem = (option, template) =>
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(template, option.IsSelected, option.OnClick);
|
||||
var showFlag = option.Race != null;
|
||||
var showFlag = option.Faction != null;
|
||||
|
||||
var label = item.Get<LabelWidget>("LABEL");
|
||||
label.IsVisible = () => showFlag;
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var flag = item.Get<ImageWidget>("FLAG");
|
||||
flag.IsVisible = () => showFlag;
|
||||
flag.GetImageCollection = () => "flags";
|
||||
flag.GetImageName = () => option.Race;
|
||||
flag.GetImageName = () => option.Faction;
|
||||
|
||||
var labelAlt = item.Get<LabelWidget>("NOFLAG_LABEL");
|
||||
labelAlt.IsVisible = () => !showFlag;
|
||||
@@ -109,17 +109,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
};
|
||||
|
||||
var shroudLabel = shroudSelector.Get<LabelWidget>("LABEL");
|
||||
shroudLabel.IsVisible = () => selected.Race != null;
|
||||
shroudLabel.IsVisible = () => selected.Faction != null;
|
||||
shroudLabel.GetText = () => selected.Label;
|
||||
shroudLabel.GetColor = () => selected.Color;
|
||||
|
||||
var shroudFlag = shroudSelector.Get<ImageWidget>("FLAG");
|
||||
shroudFlag.IsVisible = () => selected.Race != null;
|
||||
shroudFlag.IsVisible = () => selected.Faction != null;
|
||||
shroudFlag.GetImageCollection = () => "flags";
|
||||
shroudFlag.GetImageName = () => selected.Race;
|
||||
shroudFlag.GetImageName = () => selected.Faction;
|
||||
|
||||
var shroudLabelAlt = shroudSelector.Get<LabelWidget>("NOFLAG_LABEL");
|
||||
shroudLabelAlt.IsVisible = () => selected.Race == null;
|
||||
shroudLabelAlt.IsVisible = () => selected.Faction == null;
|
||||
shroudLabelAlt.GetText = () => selected.Label;
|
||||
shroudLabelAlt.GetColor = () => selected.Color;
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
var ks = Game.Settings.Keys;
|
||||
var rb = RenderBounds;
|
||||
var race = producer.Trait.Race;
|
||||
var faction = producer.Trait.Faction;
|
||||
|
||||
foreach (var item in AllBuildables.Skip(IconRowOffset * Columns).Take(MaxIconRowOffset * Columns))
|
||||
{
|
||||
@@ -310,7 +310,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
var rect = new Rectangle(rb.X + x * (IconSize.X + IconMargin.X), rb.Y + y * (IconSize.Y + IconMargin.Y), IconSize.X, IconSize.Y);
|
||||
|
||||
var rsi = item.Traits.Get<RenderSpritesInfo>();
|
||||
var icon = new Animation(World, rsi.GetImage(item, World.Map.SequenceProvider, race));
|
||||
var icon = new Animation(World, rsi.GetImage(item, World.Map.SequenceProvider, faction));
|
||||
icon.Play(item.Traits.Get<TooltipInfo>().Icon);
|
||||
|
||||
var bi = item.Traits.Get<BuildableInfo>();
|
||||
|
||||
Reference in New Issue
Block a user