Clean Production.cs of "race"
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.ForceRace
|
||||
?? (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()
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
faction = buildableInfo.ForceRace;
|
||||
|
||||
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)
|
||||
|
||||
@@ -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;
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var bi = producee.Traits.GetOrDefault<BuildableInfo>();
|
||||
if (bi != null && bi.ForceRace != null)
|
||||
raceVariant = bi.ForceRace;
|
||||
factionVariant = bi.ForceRace;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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