Some internal "race" to "faction" renaming
This commit is contained in:
@@ -147,10 +147,10 @@ namespace OpenRA
|
|||||||
public bool IsHuman;
|
public bool IsHuman;
|
||||||
public bool IsBot;
|
public bool IsBot;
|
||||||
|
|
||||||
// The faction name (aka Country)
|
// The faction's display name.
|
||||||
public string FactionName;
|
public string FactionName;
|
||||||
|
|
||||||
// The faction id (aka Country, aka Race)
|
// The faction ID, a.k.a. the faction's internal name.
|
||||||
public string FactionId;
|
public string FactionId;
|
||||||
public HSLColor Color;
|
public HSLColor Color;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public MapPlayers(Ruleset rules, int playerCount)
|
public MapPlayers(Ruleset rules, int playerCount)
|
||||||
{
|
{
|
||||||
var firstRace = rules.Actors["world"].Traits
|
var firstFaction = rules.Actors["world"].Traits
|
||||||
.WithInterface<FactionInfo>().First(f => f.Selectable).InternalName;
|
.WithInterface<FactionInfo>().First(f => f.Selectable).InternalName;
|
||||||
|
|
||||||
Players = new Dictionary<string, PlayerReference>
|
Players = new Dictionary<string, PlayerReference>
|
||||||
@@ -37,7 +37,7 @@ namespace OpenRA
|
|||||||
"Neutral", new PlayerReference
|
"Neutral", new PlayerReference
|
||||||
{
|
{
|
||||||
Name = "Neutral",
|
Name = "Neutral",
|
||||||
Faction = firstRace,
|
Faction = firstFaction,
|
||||||
OwnsWorld = true,
|
OwnsWorld = true,
|
||||||
NonCombatant = true
|
NonCombatant = true
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ namespace OpenRA
|
|||||||
"Creeps", new PlayerReference
|
"Creeps", new PlayerReference
|
||||||
{
|
{
|
||||||
Name = "Creeps",
|
Name = "Creeps",
|
||||||
Faction = firstRace,
|
Faction = firstFaction,
|
||||||
NonCombatant = true,
|
NonCombatant = true,
|
||||||
Enemies = Exts.MakeArray(playerCount, i => "Multi{0}".F(i))
|
Enemies = Exts.MakeArray(playerCount, i => "Multi{0}".F(i))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
var self = init.Self;
|
var self = init.Self;
|
||||||
var race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
|
var faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
|
||||||
|
|
||||||
quantizedFacings = Exts.Lazy(() =>
|
quantizedFacings = Exts.Lazy(() =>
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ namespace OpenRA.Traits
|
|||||||
if (qboi == null)
|
if (qboi == null)
|
||||||
throw new InvalidOperationException("Actor type '" + self.Info.Name + "' does not define a quantized body orientation.");
|
throw new InvalidOperationException("Actor type '" + self.Info.Name + "' does not define a quantized body orientation.");
|
||||||
|
|
||||||
return qboi.QuantizedBodyFacings(self.Info, self.World.Map.SequenceProvider, race);
|
return qboi.QuantizedBodyFacings(self.Info, self.World.Map.SequenceProvider, faction);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ namespace OpenRA.Traits
|
|||||||
WRot QuantizeOrientation(WRot orientation, int facings);
|
WRot QuantizeOrientation(WRot orientation, int facings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IQuantizeBodyOrientationInfo { int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race); }
|
public interface IQuantizeBodyOrientationInfo { int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction); }
|
||||||
|
|
||||||
public interface ITargetableInfo
|
public interface ITargetableInfo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
public ProductionAirdrop(ActorInitializer init, ProductionAirdropInfo info)
|
public ProductionAirdrop(ActorInitializer init, ProductionAirdropInfo info)
|
||||||
: base(init, info) { }
|
: base(init, info) { }
|
||||||
|
|
||||||
public override bool Produce(Actor self, ActorInfo producee, string raceVariant)
|
public override bool Produce(Actor self, ActorInfo producee, string factionVariant)
|
||||||
{
|
{
|
||||||
var owner = self.Owner;
|
var owner = self.Owner;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
foreach (var cargo in self.TraitsImplementing<INotifyDelivery>())
|
foreach (var cargo in self.TraitsImplementing<INotifyDelivery>())
|
||||||
cargo.Delivered(self);
|
cargo.Delivered(self);
|
||||||
|
|
||||||
self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit, raceVariant));
|
self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit, factionVariant));
|
||||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName);
|
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new WithGunboatBody(init, this); }
|
public override object Create(ActorInitializer init) { return new WithGunboatBody(init, this); }
|
||||||
|
|
||||||
public override int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)
|
public override int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction)
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
|
|
||||||
var worldActor = map.Rules.Actors["world"];
|
var worldActor = map.Rules.Actors["world"];
|
||||||
|
|
||||||
var races = worldActor.Traits.WithInterface<FactionInfo>().Select(f => f.InternalName).ToHashSet();
|
var factions = worldActor.Traits.WithInterface<FactionInfo>().Select(f => f.InternalName).ToHashSet();
|
||||||
foreach (var player in players.Values)
|
foreach (var player in players.Values)
|
||||||
if (!string.IsNullOrWhiteSpace(player.Faction) && !races.Contains(player.Faction))
|
if (!string.IsNullOrWhiteSpace(player.Faction) && !factions.Contains(player.Faction))
|
||||||
emitError("Invalid race {0} chosen for player {1}.".F(player.Faction, player.Name));
|
emitError("Invalid faction {0} chosen for player {1}.".F(player.Faction, player.Name));
|
||||||
|
|
||||||
if (worldActor.Traits.Contains<MPStartLocationsInfo>())
|
if (worldActor.Traits.Contains<MPStartLocationsInfo>())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,21 +36,21 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
Game.ModData.Manifest.Sequences.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal));
|
Game.ModData.Manifest.Sequences.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal));
|
||||||
|
|
||||||
var rules = map == null ? Game.ModData.DefaultRules : map.Rules;
|
var rules = map == null ? Game.ModData.DefaultRules : map.Rules;
|
||||||
var races = rules.Actors["world"].Traits.WithInterface<FactionInfo>().Select(f => f.InternalName).ToArray();
|
var factions = rules.Actors["world"].Traits.WithInterface<FactionInfo>().Select(f => f.InternalName).ToArray();
|
||||||
var sequenceProviders = map == null ? rules.Sequences.Values : new[] { rules.Sequences[map.Tileset] };
|
var sequenceProviders = map == null ? rules.Sequences.Values : new[] { rules.Sequences[map.Tileset] };
|
||||||
|
|
||||||
foreach (var actorInfo in rules.Actors)
|
foreach (var actorInfo in rules.Actors)
|
||||||
{
|
{
|
||||||
foreach (var renderInfo in actorInfo.Value.Traits.WithInterface<RenderSpritesInfo>())
|
foreach (var renderInfo in actorInfo.Value.Traits.WithInterface<RenderSpritesInfo>())
|
||||||
{
|
{
|
||||||
foreach (var race in races)
|
foreach (var faction in factions)
|
||||||
{
|
{
|
||||||
foreach (var sequenceProvider in sequenceProviders)
|
foreach (var sequenceProvider in sequenceProviders)
|
||||||
{
|
{
|
||||||
var image = renderInfo.GetImage(actorInfo.Value, sequenceProvider, race);
|
var image = renderInfo.GetImage(actorInfo.Value, sequenceProvider, faction);
|
||||||
if (sequenceDefinitions.All(s => s.Key != image.ToLowerInvariant()) && !actorInfo.Value.Name.Contains("^"))
|
if (sequenceDefinitions.All(s => s.Key != image.ToLowerInvariant()) && !actorInfo.Value.Name.Contains("^"))
|
||||||
emitWarning("Sprite image {0} from actor {1} using race {2} has no sequence definition."
|
emitWarning("Sprite image {0} from actor {1} using faction {2} has no sequence definition."
|
||||||
.F(image, actorInfo.Value.Name, race));
|
.F(image, actorInfo.Value.Name, faction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
if (renderInfo == null)
|
if (renderInfo == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach (var race in races)
|
foreach (var faction in factions)
|
||||||
{
|
{
|
||||||
var sequenceReference = field.GetCustomAttributes<SequenceReferenceAttribute>(true).FirstOrDefault();
|
var sequenceReference = field.GetCustomAttributes<SequenceReferenceAttribute>(true).FirstOrDefault();
|
||||||
if (sequenceReference != null && !string.IsNullOrEmpty(sequenceReference.ImageReference))
|
if (sequenceReference != null && !string.IsNullOrEmpty(sequenceReference.ImageReference))
|
||||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
if (!string.IsNullOrEmpty(imageOverride) && sequenceDefinitions.All(s => s.Key != imageOverride.ToLowerInvariant()))
|
if (!string.IsNullOrEmpty(imageOverride) && sequenceDefinitions.All(s => s.Key != imageOverride.ToLowerInvariant()))
|
||||||
emitWarning("Custom sprite image {0} from actor {1} has no sequence definition.".F(imageOverride, actorInfo.Value.Name));
|
emitWarning("Custom sprite image {0} from actor {1} has no sequence definition.".F(imageOverride, actorInfo.Value.Name));
|
||||||
else
|
else
|
||||||
CheckDefintions(imageOverride, sequenceReference, actorInfo, sequence, race, field, traitInfo);
|
CheckDefintions(imageOverride, sequenceReference, actorInfo, sequence, faction, field, traitInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,8 +93,8 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
{
|
{
|
||||||
foreach (var sequenceProvider in sequenceProviders)
|
foreach (var sequenceProvider in sequenceProviders)
|
||||||
{
|
{
|
||||||
var image = renderInfo.GetImage(actorInfo.Value, sequenceProvider, race);
|
var image = renderInfo.GetImage(actorInfo.Value, sequenceProvider, faction);
|
||||||
CheckDefintions(image, sequenceReference, actorInfo, sequence, race, field, traitInfo);
|
CheckDefintions(image, sequenceReference, actorInfo, sequence, faction, field, traitInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckDefintions(string image, SequenceReferenceAttribute sequenceReference,
|
void CheckDefintions(string image, SequenceReferenceAttribute sequenceReference,
|
||||||
KeyValuePair<string, ActorInfo> actorInfo, string sequence, string race, FieldInfo field, ITraitInfo traitInfo)
|
KeyValuePair<string, ActorInfo> actorInfo, string sequence, string faction, FieldInfo field, ITraitInfo traitInfo)
|
||||||
{
|
{
|
||||||
var definitions = sequenceDefinitions.FirstOrDefault(n => n.Key == image.ToLowerInvariant());
|
var definitions = sequenceDefinitions.FirstOrDefault(n => n.Key == image.ToLowerInvariant());
|
||||||
if (definitions != null)
|
if (definitions != null)
|
||||||
@@ -157,12 +157,12 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
{
|
{
|
||||||
if (!definitions.Value.Nodes.Any(n => n.Key.StartsWith(sequence)))
|
if (!definitions.Value.Nodes.Any(n => n.Key.StartsWith(sequence)))
|
||||||
emitWarning("Sprite image {0} from actor {1} of faction {2} does not define sequence prefix {3} from field {4} of {5}"
|
emitWarning("Sprite image {0} from actor {1} of faction {2} does not define sequence prefix {3} from field {4} of {5}"
|
||||||
.F(image, actorInfo.Value.Name, race, sequence, field.Name, traitInfo));
|
.F(image, actorInfo.Value.Name, faction, sequence, field.Name, traitInfo));
|
||||||
}
|
}
|
||||||
else if (definitions.Value.Nodes.All(n => n.Key != sequence))
|
else if (definitions.Value.Nodes.All(n => n.Key != sequence))
|
||||||
{
|
{
|
||||||
emitWarning("Sprite image {0} from actor {1} of faction {2} does not define sequence {3} from field {4} of {5}"
|
emitWarning("Sprite image {0} from actor {1} of faction {2} does not define sequence {3} from field {4} of {5}"
|
||||||
.F(image, actorInfo.Value.Name, race, sequence, field.Name, traitInfo));
|
.F(image, actorInfo.Value.Name, faction, sequence, field.Name, traitInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
|
|
||||||
[ScriptActorPropertyActivity]
|
[ScriptActorPropertyActivity]
|
||||||
[Desc("Build a unit, ignoring the production queue. The activity will wait if the exit is blocked.")]
|
[Desc("Build a unit, ignoring the production queue. The activity will wait if the exit is blocked.")]
|
||||||
public void Produce(string actorType, string raceVariant = null)
|
public void Produce(string actorType, string factionVariant = null)
|
||||||
{
|
{
|
||||||
ActorInfo actorInfo;
|
ActorInfo actorInfo;
|
||||||
if (!Self.World.Map.Rules.Actors.TryGetValue(actorType, out actorInfo))
|
if (!Self.World.Map.Rules.Actors.TryGetValue(actorType, out actorInfo))
|
||||||
throw new LuaException("Unknown actor type '{0}'".F(actorType));
|
throw new LuaException("Unknown actor type '{0}'".F(actorType));
|
||||||
|
|
||||||
Self.QueueActivity(new WaitFor(() => p.Produce(Self, actorInfo, raceVariant)));
|
Self.QueueActivity(new WaitFor(() => p.Produce(Self, actorInfo, factionVariant)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -748,7 +748,7 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
if (targetClient.Index != client.Index && !client.IsAdmin)
|
if (targetClient.Index != client.Index && !client.IsAdmin)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Map has disabled race changes
|
// Map has disabled faction changes
|
||||||
if (server.LobbyInfo.Slots[targetClient.Slot].LockFaction)
|
if (server.LobbyInfo.Slots[targetClient.Slot].LockFaction)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (captor.World.LocalPlayer != captor.Owner)
|
if (captor.World.LocalPlayer != captor.Owner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var race = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName;
|
var faction = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName;
|
||||||
Sound.PlayNotification(self.World.Map.Rules, captor.World.LocalPlayer, "Speech", info.Notification, race);
|
Sound.PlayNotification(self.World.Map.Rules, captor.World.LocalPlayer, "Speech", info.Notification, faction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The free unit crate requires same race and the actor needs to be mobile.
|
// The free unit crate requires same faction and the actor needs to be mobile.
|
||||||
// We want neither of these properties for crate power proxies.
|
// We want neither of these properties for crate power proxies.
|
||||||
public override void Activate(Actor collector)
|
public override void Activate(Actor collector)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)
|
public virtual int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction)
|
||||||
{
|
{
|
||||||
return sequenceProvider.GetSequence(GetImage(ai, sequenceProvider, race), Sequence).Facings;
|
return sequenceProvider.GetSequence(GetImage(ai, sequenceProvider, faction), Sequence).Facings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ 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<FactionInit, string>();
|
var faction = 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, faction);
|
||||||
var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + ownerName);
|
var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + ownerName);
|
||||||
|
|
||||||
var facings = 0;
|
var facings = 0;
|
||||||
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (facings == -1)
|
if (facings == -1)
|
||||||
{
|
{
|
||||||
var qbo = init.Actor.Traits.GetOrDefault<IQuantizeBodyOrientationInfo>();
|
var qbo = init.Actor.Traits.GetOrDefault<IQuantizeBodyOrientationInfo>();
|
||||||
facings = qbo != null ? qbo.QuantizedBodyFacings(init.Actor, sequenceProvider, race) : 1;
|
facings = qbo != null ? qbo.QuantizedBodyFacings(init.Actor, sequenceProvider, faction) : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,13 +80,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
yield return preview;
|
yield return preview;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetImage(ActorInfo actor, SequenceProvider sequenceProvider, string race)
|
public string GetImage(ActorInfo actor, SequenceProvider sequenceProvider, string faction)
|
||||||
{
|
{
|
||||||
if (FactionImages != null && !string.IsNullOrEmpty(race))
|
if (FactionImages != null && !string.IsNullOrEmpty(faction))
|
||||||
{
|
{
|
||||||
string raceImage = null;
|
string factionImage = null;
|
||||||
if (FactionImages.TryGetValue(race, out raceImage) && sequenceProvider.HasSequence(raceImage))
|
if (FactionImages.TryGetValue(faction, out factionImage) && sequenceProvider.HasSequence(factionImage))
|
||||||
return raceImage;
|
return factionImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Image ?? actor.Name).ToLowerInvariant();
|
return (Image ?? actor.Name).ToLowerInvariant();
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ 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<FactionInit, string>();
|
var faction = 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;
|
||||||
var facings = body.QuantizedFacings == -1 ?
|
var facings = body.QuantizedFacings == -1 ?
|
||||||
init.Actor.Traits.Get<IQuantizeBodyOrientationInfo>().QuantizedBodyFacings(init.Actor, sequenceProvider, race) :
|
init.Actor.Traits.Get<IQuantizeBodyOrientationInfo>().QuantizedBodyFacings(init.Actor, sequenceProvider, faction) :
|
||||||
body.QuantizedFacings;
|
body.QuantizedFacings;
|
||||||
var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + ownerName);
|
var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + ownerName);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race) { return 1; }
|
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction) { return 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class WithCrateBody : INotifyParachuteLanded
|
class WithCrateBody : INotifyParachuteLanded
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)
|
public override int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction)
|
||||||
{
|
{
|
||||||
var rsi = ai.Traits.Get<RenderSpritesInfo>();
|
var rsi = ai.Traits.Get<RenderSpritesInfo>();
|
||||||
return sequenceProvider.GetSequence(rsi.GetImage(ai, sequenceProvider, race), Sequence).Facings;
|
return sequenceProvider.GetSequence(rsi.GetImage(ai, sequenceProvider, faction), Sequence).Facings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)
|
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction)
|
||||||
{
|
{
|
||||||
var rsi = ai.Traits.Get<RenderSpritesInfo>();
|
var rsi = ai.Traits.Get<RenderSpritesInfo>();
|
||||||
return sequenceProvider.GetSequence(rsi.GetImage(ai, sequenceProvider, race), StandSequences.First()).Facings;
|
return sequenceProvider.GetSequence(rsi.GetImage(ai, sequenceProvider, faction), StandSequences.First()).Facings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)
|
public virtual int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
() => false, () => 0);
|
() => false, () => 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race) { return 0; }
|
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction) { return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithVoxelBody : IAutoSelectionSize
|
public class WithVoxelBody : IAutoSelectionSize
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public MusicInfo[] AvailablePlaylist()
|
public MusicInfo[] AvailablePlaylist()
|
||||||
{
|
{
|
||||||
// TO-DO: add filter options for Race-specific music
|
// TODO: add filter options for faction-specific music
|
||||||
return playlist;
|
return playlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
.RandomOrDefault(w.SharedRandom);
|
.RandomOrDefault(w.SharedRandom);
|
||||||
|
|
||||||
if (unitGroup == null)
|
if (unitGroup == null)
|
||||||
throw new InvalidOperationException("No starting units defined for country {0} with class {1}".F(p.Faction.InternalName, spawnClass));
|
throw new InvalidOperationException("No starting units defined for faction {0} with class {1}".F(p.Faction.InternalName, spawnClass));
|
||||||
|
|
||||||
if (unitGroup.BaseActor != null)
|
if (unitGroup.BaseActor != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -450,48 +450,48 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
void LoadPlayer(IniFile file, string section, bool isRA)
|
void LoadPlayer(IniFile file, string section, bool isRA)
|
||||||
{
|
{
|
||||||
string c;
|
string c;
|
||||||
string race;
|
string faction;
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
case "Spain":
|
case "Spain":
|
||||||
c = "gold";
|
c = "gold";
|
||||||
race = "allies";
|
faction = "allies";
|
||||||
break;
|
break;
|
||||||
case "England":
|
case "England":
|
||||||
c = "green";
|
c = "green";
|
||||||
race = "allies";
|
faction = "allies";
|
||||||
break;
|
break;
|
||||||
case "Ukraine":
|
case "Ukraine":
|
||||||
c = "orange";
|
c = "orange";
|
||||||
race = "soviet";
|
faction = "soviet";
|
||||||
break;
|
break;
|
||||||
case "Germany":
|
case "Germany":
|
||||||
c = "black";
|
c = "black";
|
||||||
race = "allies";
|
faction = "allies";
|
||||||
break;
|
break;
|
||||||
case "France":
|
case "France":
|
||||||
c = "teal";
|
c = "teal";
|
||||||
race = "allies";
|
faction = "allies";
|
||||||
break;
|
break;
|
||||||
case "Turkey":
|
case "Turkey":
|
||||||
c = "salmon";
|
c = "salmon";
|
||||||
race = "allies";
|
faction = "allies";
|
||||||
break;
|
break;
|
||||||
case "Greece":
|
case "Greece":
|
||||||
case "GoodGuy":
|
case "GoodGuy":
|
||||||
c = isRA ? "blue" : "gold";
|
c = isRA ? "blue" : "gold";
|
||||||
race = isRA ? "allies" : "gdi";
|
faction = isRA ? "allies" : "gdi";
|
||||||
break;
|
break;
|
||||||
case "USSR":
|
case "USSR":
|
||||||
case "BadGuy":
|
case "BadGuy":
|
||||||
c = "red";
|
c = "red";
|
||||||
race = isRA ? "soviet" : "nod";
|
faction = isRA ? "soviet" : "nod";
|
||||||
break;
|
break;
|
||||||
case "Special":
|
case "Special":
|
||||||
case "Neutral":
|
case "Neutral":
|
||||||
default:
|
default:
|
||||||
c = "neutral";
|
c = "neutral";
|
||||||
race = isRA ? "allies" : "gdi";
|
faction = isRA ? "allies" : "gdi";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
Name = section,
|
Name = section,
|
||||||
OwnsWorld = section == "Neutral",
|
OwnsWorld = section == "Neutral",
|
||||||
NonCombatant = section == "Neutral",
|
NonCombatant = section == "Neutral",
|
||||||
Faction = race,
|
Faction = faction,
|
||||||
Color = namedColorMapping[c]
|
Color = namedColorMapping[c]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var cachedWidth = 0;
|
var cachedWidth = 0;
|
||||||
var labelText = "";
|
var labelText = "";
|
||||||
var showOwner = false;
|
var showOwner = false;
|
||||||
var flagRace = "";
|
var flagFaction = "";
|
||||||
var ownerName = "";
|
var ownerName = "";
|
||||||
var ownerColor = Color.White;
|
var ownerColor = Color.White;
|
||||||
var extraText = "";
|
var extraText = "";
|
||||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
if (showOwner)
|
if (showOwner)
|
||||||
{
|
{
|
||||||
flagRace = o.Faction.InternalName;
|
flagFaction = o.Faction.InternalName;
|
||||||
ownerName = o.PlayerName;
|
ownerName = o.PlayerName;
|
||||||
ownerColor = o.Color.RGB;
|
ownerColor = o.Color.RGB;
|
||||||
widget.Bounds.Height = doubleHeight;
|
widget.Bounds.Height = doubleHeight;
|
||||||
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
label.GetText = () => labelText;
|
label.GetText = () => labelText;
|
||||||
flag.IsVisible = () => showOwner;
|
flag.IsVisible = () => showOwner;
|
||||||
flag.GetImageCollection = () => "flags";
|
flag.GetImageCollection = () => "flags";
|
||||||
flag.GetImageName = () => flagRace;
|
flag.GetImageName = () => flagFaction;
|
||||||
owner.IsVisible = () => showOwner;
|
owner.IsVisible = () => showOwner;
|
||||||
owner.GetText = () => ownerName;
|
owner.GetText = () => ownerName;
|
||||||
owner.GetColor = () => ownerColor;
|
owner.GetColor = () => ownerColor;
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
if (current == null)
|
if (current == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var race = queue.Trait.Actor.Owner.Faction.InternalName;
|
var faction = queue.Trait.Actor.Owner.Faction.InternalName;
|
||||||
var actor = queue.Trait.AllItems().FirstOrDefault(a => a.Name == current.Item);
|
var actor = queue.Trait.AllItems().FirstOrDefault(a => a.Name == current.Item);
|
||||||
if (actor == null)
|
if (actor == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var rsi = actor.Traits.Get<RenderSpritesInfo>();
|
var rsi = actor.Traits.Get<RenderSpritesInfo>();
|
||||||
var icon = new Animation(world, rsi.GetImage(actor, world.Map.SequenceProvider, race));
|
var icon = new Animation(world, rsi.GetImage(actor, world.Map.SequenceProvider, faction));
|
||||||
icon.Play(actor.Traits.Get<TooltipInfo>().Icon);
|
icon.Play(actor.Traits.Get<TooltipInfo>().Icon);
|
||||||
var bi = actor.Traits.Get<BuildableInfo>();
|
var bi = actor.Traits.Get<BuildableInfo>();
|
||||||
var location = new float2(RenderBounds.Location) + new float2(queue.i * (IconWidth + IconSpacing), 0);
|
var location = new float2(RenderBounds.Location) + new float2(queue.i * (IconWidth + IconSpacing), 0);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
public ProductionFromMapEdge(ActorInitializer init, ProductionInfo info)
|
public ProductionFromMapEdge(ActorInitializer init, ProductionInfo info)
|
||||||
: base(init, info) { }
|
: base(init, info) { }
|
||||||
|
|
||||||
public override bool Produce(Actor self, ActorInfo producee, string raceVariant)
|
public override bool Produce(Actor self, ActorInfo producee, string factionVariant)
|
||||||
{
|
{
|
||||||
var location = self.World.Map.ChooseClosestEdgeCell(self.Location);
|
var location = self.World.Map.ChooseClosestEdgeCell(self.Location);
|
||||||
var pos = self.World.Map.CenterOfCell(location);
|
var pos = self.World.Map.CenterOfCell(location);
|
||||||
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
new FacingInit(initialFacing)
|
new FacingInit(initialFacing)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (raceVariant != null)
|
if (factionVariant != null)
|
||||||
td.Add(new FactionInit(raceVariant));
|
td.Add(new FactionInit(factionVariant));
|
||||||
|
|
||||||
var newUnit = self.World.CreateActor(producee.Name, td);
|
var newUnit = self.World.CreateActor(producee.Name, td);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
() => false, () => 0);
|
() => false, () => 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race) { return 0; }
|
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction) { return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithVoxelUnloadBody : IAutoSelectionSize
|
public class WithVoxelUnloadBody : IAutoSelectionSize
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
public readonly int TickRate = 5;
|
public readonly int TickRate = 5;
|
||||||
public object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
|
public object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
|
||||||
|
|
||||||
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race) { return 0; }
|
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction) { return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithVoxelWalkerBody : IAutoSelectionSize, ITick
|
public class WithVoxelWalkerBody : IAutoSelectionSize, ITick
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
() => false, () => 0);
|
() => false, () => 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race) { return 0; }
|
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction) { return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithVoxelWaterBody : IAutoSelectionSize
|
public class WithVoxelWaterBody : IAutoSelectionSize
|
||||||
|
|||||||
Reference in New Issue
Block a user