Rename RaceInit to FactionInit
This commit is contained in:
@@ -103,13 +103,13 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allows maps / transformations to specify the race variant of an actor.
|
// Allows maps / transformations to specify the faction variant of an actor.
|
||||||
public class RaceInit : IActorInit<string>
|
public class FactionInit : IActorInit<string>
|
||||||
{
|
{
|
||||||
[FieldFromYamlKey] public readonly string Race;
|
[FieldFromYamlKey] public readonly string Faction;
|
||||||
|
|
||||||
public RaceInit() { }
|
public FactionInit() { }
|
||||||
public RaceInit(string race) { Race = race; }
|
public FactionInit(string faction) { Faction = faction; }
|
||||||
public string Value(World world) { return Race; }
|
public string Value(World world) { return Faction; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
var self = init.Self;
|
var self = init.Self;
|
||||||
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Faction.InternalName;
|
var race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
|
||||||
|
|
||||||
quantizedFacings = Exts.Lazy(() =>
|
quantizedFacings = Exts.Lazy(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
init.Add(new SkipMakeAnimsInit());
|
init.Add(new SkipMakeAnimsInit());
|
||||||
|
|
||||||
if (Race != null)
|
if (Race != null)
|
||||||
init.Add(new RaceInit(Race));
|
init.Add(new FactionInit(Race));
|
||||||
|
|
||||||
var health = self.TraitOrDefault<Health>();
|
var health = self.TraitOrDefault<Health>();
|
||||||
if (health != null)
|
if (health != null)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
td.Add(new FacingInit(facing));
|
td.Add(new FacingInit(facing));
|
||||||
td.Add(new TurretFacingInit(facing));
|
td.Add(new TurretFacingInit(facing));
|
||||||
td.Add(new OwnerInit(owner.Name));
|
td.Add(new OwnerInit(owner.Name));
|
||||||
td.Add(new RaceInit(owner.Faction));
|
td.Add(new FactionInit(owner.Faction));
|
||||||
preview.SetPreview(actor, td);
|
preview.SetPreview(actor, td);
|
||||||
|
|
||||||
var ios = actor.Traits.GetOrDefault<IOccupySpaceInfo>();
|
var ios = actor.Traits.GetOrDefault<IOccupySpaceInfo>();
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
{
|
{
|
||||||
var td = new TypeDictionary()
|
var td = new TypeDictionary()
|
||||||
{
|
{
|
||||||
new RaceInit(race),
|
new FactionInit(race),
|
||||||
new OwnerInit(producer.Owner),
|
new OwnerInit(producer.Owner),
|
||||||
new HideBibPreviewInit()
|
new HideBibPreviewInit()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
new LocationInit(t),
|
new LocationInit(t),
|
||||||
new OwnerInit(order.Player),
|
new OwnerInit(order.Player),
|
||||||
new RaceInit(race)
|
new FactionInit(race)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (playSounds)
|
if (playSounds)
|
||||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
new LocationInit(order.TargetLocation),
|
new LocationInit(order.TargetLocation),
|
||||||
new OwnerInit(order.Player),
|
new OwnerInit(order.Player),
|
||||||
new RaceInit(race),
|
new FactionInit(race),
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var s in buildingInfo.BuildSounds)
|
foreach (var s in buildingInfo.BuildSounds)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
playerPower = playerActor.Trait<PowerManager>();
|
playerPower = playerActor.Trait<PowerManager>();
|
||||||
developerMode = playerActor.Trait<DeveloperMode>();
|
developerMode = playerActor.Trait<DeveloperMode>();
|
||||||
|
|
||||||
Race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Faction.InternalName;
|
Race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
|
||||||
Enabled = !info.Race.Any() || info.Race.Contains(Race);
|
Enabled = !info.Race.Any() || info.Race.Contains(Race);
|
||||||
|
|
||||||
CacheProduceables(playerActor);
|
CacheProduceables(playerActor);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (string.IsNullOrEmpty(prerequisite))
|
if (string.IsNullOrEmpty(prerequisite))
|
||||||
prerequisite = init.Self.Info.Name;
|
prerequisite = init.Self.Info.Name;
|
||||||
|
|
||||||
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Faction.InternalName;
|
var race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||||
|
|
||||||
Update(init.Self.Owner, race);
|
Update(init.Self.Owner, race);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
Info = info;
|
Info = info;
|
||||||
rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>());
|
rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>());
|
||||||
Race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Faction.InternalName;
|
Race = 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 raceVariant)
|
||||||
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (raceVariant != null)
|
if (raceVariant != null)
|
||||||
td.Add(new RaceInit(raceVariant));
|
td.Add(new FactionInit(raceVariant));
|
||||||
|
|
||||||
var newUnit = self.World.CreateActor(producee.Name, td);
|
var newUnit = self.World.CreateActor(producee.Name, td);
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init)
|
public IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init)
|
||||||
{
|
{
|
||||||
var sequenceProvider = init.World.Map.SequenceProvider;
|
var sequenceProvider = init.World.Map.SequenceProvider;
|
||||||
var race = init.Get<RaceInit, string>();
|
var race = init.Get<FactionInit, string>();
|
||||||
var ownerName = init.Get<OwnerInit>().PlayerName;
|
var ownerName = init.Get<OwnerInit>().PlayerName;
|
||||||
var image = GetImage(init.Actor, sequenceProvider, race);
|
var image = GetImage(init.Actor, sequenceProvider, race);
|
||||||
var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + ownerName);
|
var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + ownerName);
|
||||||
@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public RenderSprites(ActorInitializer init, RenderSpritesInfo info)
|
public RenderSprites(ActorInitializer init, RenderSpritesInfo info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Faction.InternalName;
|
race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetImage(Actor self)
|
public string GetImage(Actor self)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public virtual IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init)
|
public virtual IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init)
|
||||||
{
|
{
|
||||||
var body = init.Actor.Traits.Get<BodyOrientationInfo>();
|
var body = init.Actor.Traits.Get<BodyOrientationInfo>();
|
||||||
var race = init.Get<RaceInit, string>();
|
var race = init.Get<FactionInit, string>();
|
||||||
var ownerName = init.Get<OwnerInit>().PlayerName;
|
var ownerName = init.Get<OwnerInit>().PlayerName;
|
||||||
var sequenceProvider = init.World.Map.SequenceProvider;
|
var sequenceProvider = init.World.Map.SequenceProvider;
|
||||||
var image = Image ?? init.Actor.Name;
|
var image = Image ?? init.Actor.Name;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
self = init.Self;
|
self = init.Self;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
|
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
|
||||||
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Faction.InternalName;
|
race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string VoicePhraseForOrder(Actor self, Order order)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.Owner = owner;
|
this.Owner = owner;
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
|
|
||||||
if (!actor.InitDict.Contains<RaceInit>())
|
if (!actor.InitDict.Contains<FactionInit>())
|
||||||
actor.InitDict.Add(new RaceInit(owner.Faction));
|
actor.InitDict.Add(new FactionInit(owner.Faction));
|
||||||
|
|
||||||
if (!actor.InitDict.Contains<OwnerInit>())
|
if (!actor.InitDict.Contains<OwnerInit>())
|
||||||
actor.InitDict.Add(new OwnerInit(owner.Name));
|
actor.InitDict.Add(new OwnerInit(owner.Name));
|
||||||
@@ -118,8 +118,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
Func<object, bool> saveInit = init =>
|
Func<object, bool> saveInit = init =>
|
||||||
{
|
{
|
||||||
var race = init as RaceInit;
|
var factionInit = init as FactionInit;
|
||||||
if (race != null && race.Race == Owner.Faction)
|
if (factionInit != null && factionInit.Faction == Owner.Faction)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO: Other default values will need to be filtered
|
// TODO: Other default values will need to be filtered
|
||||||
|
|||||||
@@ -2172,6 +2172,12 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
ConvertFloatToIntPercentage(ref node.Value.Value);
|
ConvertFloatToIntPercentage(ref node.Value.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (engineVersion < 20150715)
|
||||||
|
{
|
||||||
|
if (node.Key == "Race")
|
||||||
|
node.Key = "Faction";
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActors(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActors(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var td = new TypeDictionary();
|
var td = new TypeDictionary();
|
||||||
td.Add(new HideBibPreviewInit());
|
td.Add(new HideBibPreviewInit());
|
||||||
td.Add(new OwnerInit(world.WorldActor.Owner));
|
td.Add(new OwnerInit(world.WorldActor.Owner));
|
||||||
td.Add(new RaceInit(world.WorldActor.Owner.PlayerReference.Faction));
|
td.Add(new FactionInit(world.WorldActor.Owner.PlayerReference.Faction));
|
||||||
|
|
||||||
if (preview != null)
|
if (preview != null)
|
||||||
preview.SetPreview(actor, td);
|
preview.SetPreview(actor, td);
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
td.Add(new TurretFacingInit(92));
|
td.Add(new TurretFacingInit(92));
|
||||||
td.Add(new HideBibPreviewInit());
|
td.Add(new HideBibPreviewInit());
|
||||||
td.Add(new OwnerInit(selectedOwner.Name));
|
td.Add(new OwnerInit(selectedOwner.Name));
|
||||||
td.Add(new RaceInit(selectedOwner.Faction));
|
td.Add(new FactionInit(selectedOwner.Faction));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (raceVariant != null)
|
if (raceVariant != null)
|
||||||
td.Add(new RaceInit(raceVariant));
|
td.Add(new FactionInit(raceVariant));
|
||||||
|
|
||||||
var newUnit = self.World.CreateActor(producee.Name, td);
|
var newUnit = self.World.CreateActor(producee.Name, td);
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
production = init.Self.Trait<Production>();
|
production = init.Self.Trait<Production>();
|
||||||
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Faction.InternalName;
|
race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnitProducedByOther(Actor self, Actor producer, Actor produced)
|
public void UnitProducedByOther(Actor self, Actor producer, Actor produced)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
|
|
||||||
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Faction.InternalName;
|
race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : init.Self.Owner.Faction.InternalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Killed(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
new LocationInit(self.Location),
|
new LocationInit(self.Location),
|
||||||
new CenterPositionInit(self.CenterPosition),
|
new CenterPositionInit(self.CenterPosition),
|
||||||
new OwnerInit(self.Owner),
|
new OwnerInit(self.Owner),
|
||||||
new RaceInit(race),
|
new FactionInit(race),
|
||||||
new SkipMakeAnimsInit()
|
new SkipMakeAnimsInit()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user