From 9acf121eb1a61a5176e3370ef3e8b8be104f24a9 Mon Sep 17 00:00:00 2001 From: atlimit8 Date: Sat, 19 Sep 2015 13:22:00 -0500 Subject: [PATCH] Replace ActorInfo.Traits.WithInterface with ActorInfo.TraitInfos() --- OpenRA.Game/Graphics/Minimap.cs | 2 +- OpenRA.Game/Map/MapPlayers.cs | 4 ++-- OpenRA.Game/Player.cs | 6 +++--- OpenRA.Game/Settings.cs | 2 +- OpenRA.Game/Traits/TraitsInterfaces.cs | 6 +++--- OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs | 2 +- OpenRA.Mods.Common/AI/BaseBuilder.cs | 8 ++++---- OpenRA.Mods.Common/AI/HackyAI.cs | 4 ++-- OpenRA.Mods.Common/Activities/Air/HeliReturn.cs | 2 +- OpenRA.Mods.Common/Lint/CheckActorReferences.cs | 2 +- OpenRA.Mods.Common/Lint/CheckDeathTypes.cs | 4 ++-- OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs | 2 +- OpenRA.Mods.Common/Lint/CheckPlayers.cs | 2 +- OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs | 2 +- OpenRA.Mods.Common/Lint/CheckSequences.cs | 6 +++--- OpenRA.Mods.Common/Lint/CheckUpgrades.cs | 6 +++--- OpenRA.Mods.Common/Lint/CheckVoiceReferences.cs | 4 ++-- OpenRA.Mods.Common/Lint/LintBuildablePrerequisites.cs | 7 +++---- .../Orders/PlaceBuildingOrderGenerator.cs | 4 ++-- OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs | 2 +- .../ServerTraits/LobbySettingsNotification.cs | 2 +- OpenRA.Mods.Common/Traits/Air/Helicopter.cs | 2 +- OpenRA.Mods.Common/Traits/C4Demolition.cs | 2 +- OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs | 2 +- OpenRA.Mods.Common/Traits/Production.cs | 2 +- OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/RenderSprites.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithBarrel.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs | 2 +- OpenRA.Mods.Common/Traits/Render/WithTurret.cs | 2 +- .../Traits/Render/WithTurretedSpriteBody.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs | 4 ++-- OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs | 2 +- OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs | 2 +- OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs | 2 +- OpenRA.Mods.Common/TraitsInterfaces.cs | 2 +- OpenRA.Mods.Common/Widgets/ActorPreviewWidget.cs | 2 +- .../Widgets/Logic/Editor/LayerSelectorLogic.cs | 2 +- .../Widgets/Logic/Ingame/ObserverStatsLogic.cs | 2 +- .../Widgets/Logic/Ingame/ProductionTooltipLogic.cs | 2 +- OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs | 10 +++++----- OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs | 2 +- OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs | 2 +- OpenRA.Mods.RA/Traits/Disguise.cs | 2 +- OpenRA.Mods.RA/Traits/Infiltration/Infiltrates.cs | 2 +- OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs | 2 +- OpenRA.Mods.RA/Traits/Render/RenderShroudCircle.cs | 2 +- 48 files changed, 76 insertions(+), 77 deletions(-) diff --git a/OpenRA.Game/Graphics/Minimap.cs b/OpenRA.Game/Graphics/Minimap.cs index 54a49749c0..90b8069f60 100644 --- a/OpenRA.Game/Graphics/Minimap.cs +++ b/OpenRA.Game/Graphics/Minimap.cs @@ -90,7 +90,7 @@ namespace OpenRA.Graphics var width = b.Width; var height = b.Height + heightOffset; - var resources = resourceRules.Actors["world"].Traits.WithInterface() + var resources = resourceRules.Actors["world"].TraitInfos() .ToDictionary(r => r.ResourceType, r => r.TerrainType); var bitmapData = terrain.LockBits(terrain.Bounds(), diff --git a/OpenRA.Game/Map/MapPlayers.cs b/OpenRA.Game/Map/MapPlayers.cs index 97a2741f11..5022cf102d 100644 --- a/OpenRA.Game/Map/MapPlayers.cs +++ b/OpenRA.Game/Map/MapPlayers.cs @@ -28,8 +28,8 @@ namespace OpenRA public MapPlayers(Ruleset rules, int playerCount) { - var firstFaction = rules.Actors["world"].Traits - .WithInterface().First(f => f.Selectable).InternalName; + var firstFaction = rules.Actors["world"].TraitInfos() + .First(f => f.Selectable).InternalName; Players = new Dictionary { diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index e0c35589e8..bb09eac700 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -53,8 +53,8 @@ namespace OpenRA static FactionInfo ChooseFaction(World world, string name, bool requireSelectable = true) { - var selectableFactions = world.Map.Rules.Actors["world"].Traits - .WithInterface().Where(f => !requireSelectable || f.Selectable) + var selectableFactions = world.Map.Rules.Actors["world"].TraitInfos() + .Where(f => !requireSelectable || f.Selectable) .ToList(); var selected = selectableFactions.FirstOrDefault(f => f.InternalName == name) @@ -75,7 +75,7 @@ namespace OpenRA static FactionInfo ChooseDisplayFaction(World world, string factionName) { - var factions = world.Map.Rules.Actors["world"].Traits.WithInterface().ToArray(); + var factions = world.Map.Rules.Actors["world"].TraitInfos().ToArray(); return factions.FirstOrDefault(f => f.InternalName == factionName) ?? factions.First(); } diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index 4c86efe5ca..535afb6780 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -394,7 +394,7 @@ namespace OpenRA public static string SanitizedPlayerName(string dirty) { var forbiddenNames = new string[] { "Open", "Closed" }; - var botNames = OpenRA.Game.ModData.DefaultRules.Actors["player"].Traits.WithInterface().Select(t => t.Name); + var botNames = OpenRA.Game.ModData.DefaultRules.Actors["player"].TraitInfos().Select(t => t.Name); var clean = SanitizedName(dirty); diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 7e27d05a83..5e0ffbdeb5 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -128,7 +128,7 @@ namespace OpenRA.Traits bool HasVoice(Actor self, string voice); } - public interface IDemolishableInfo { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); } + public interface IDemolishableInfo : ITraitInfo { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); } public interface IDemolishable { void Demolish(Actor self, Actor saboteur); @@ -172,7 +172,7 @@ namespace OpenRA.Traits IEnumerable> RadarSignatureCells(Actor self); } - public interface IDefaultVisibilityInfo { } + public interface IDefaultVisibilityInfo : ITraitInfo { } public interface IDefaultVisibility { bool IsVisible(Actor self, Player byPlayer); } public interface IVisibilityModifier { bool IsVisible(Actor self, Player byPlayer); } public interface IFogVisibilityModifier { bool HasFogVisibility(Player byPlayer); } @@ -286,7 +286,7 @@ namespace OpenRA.Traits public interface IWorldLoaded { void WorldLoaded(World w, WorldRenderer wr); } public interface ICreatePlayers { void CreatePlayers(World w); } - public interface IBotInfo { string Name { get; } } + public interface IBotInfo : ITraitInfo { string Name { get; } } public interface IBot { void Activate(Player p); diff --git a/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs index 870ca423a4..617640c0bf 100644 --- a/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs +++ b/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Cnc.Traits var endPos = new CPos(owner.World.Map.Bounds.Left - 5, self.Location.Y); // Assume a single exit point for simplicity - var exit = self.Info.Traits.WithInterface().First(); + var exit = self.Info.TraitInfos().First(); foreach (var tower in self.TraitsImplementing()) tower.IncomingDelivery(self); diff --git a/OpenRA.Mods.Common/AI/BaseBuilder.cs b/OpenRA.Mods.Common/AI/BaseBuilder.cs index 5f57064ff2..0dcffe45ea 100644 --- a/OpenRA.Mods.Common/AI/BaseBuilder.cs +++ b/OpenRA.Mods.Common/AI/BaseBuilder.cs @@ -209,7 +209,7 @@ namespace OpenRA.Mods.Common.AI bool HasSufficientPowerForActor(ActorInfo actorInfo) { - return (actorInfo.Traits.WithInterface().Where(i => i.UpgradeMinEnabledLevel < 1) + return (actorInfo.TraitInfos().Where(i => i.UpgradeMinEnabledLevel < 1) .Sum(p => p.Amount) + playerPower.ExcessPower) >= ai.Info.MinimumExcessPower; } @@ -219,12 +219,12 @@ namespace OpenRA.Mods.Common.AI // This gets used quite a bit, so let's cache it here var power = GetProducibleBuilding("Power", buildableThings, - a => a.Traits.WithInterface().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(p => p.Amount)); + a => a.TraitInfos().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(p => p.Amount)); // First priority is to get out of a low power situation if (playerPower.ExcessPower < ai.Info.MinimumExcessPower) { - if (power != null && power.Traits.WithInterface().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(p => p.Amount) > 0) + if (power != null && power.TraitInfos().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(p => p.Amount) > 0) { HackyAI.BotDebug("AI: {0} decided to build {1}: Priority override (low power)", queue.Actor.Owner, power.Name); return power; @@ -331,7 +331,7 @@ namespace OpenRA.Mods.Common.AI if (playerPower.ExcessPower < ai.Info.MinimumExcessPower || !HasSufficientPowerForActor(actor)) { // Try building a power plant instead - if (power != null && power.Traits.WithInterface().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(pi => pi.Amount) > 0) + if (power != null && power.TraitInfos().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(pi => pi.Amount) > 0) { if (playerPower.PowerOutageRemainingTicks > 0) HackyAI.BotDebug("{0} decided to build {1}: Priority override (is low power)", queue.Actor.Owner, power.Name); diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs index 35c9720e2f..993a04d60a 100644 --- a/OpenRA.Mods.Common/AI/HackyAI.cs +++ b/OpenRA.Mods.Common/AI/HackyAI.cs @@ -272,7 +272,7 @@ namespace OpenRA.Mods.Common.AI minAttackForceDelayTicks = Random.Next(0, Info.MinimumAttackForceDelay); resourceTypeIndices = new BitArray(World.TileSet.TerrainInfo.Length); // Big enough - foreach (var t in Map.Rules.Actors["world"].Traits.WithInterface()) + foreach (var t in Map.Rules.Actors["world"].TraitInfos()) resourceTypeIndices.Set(World.TileSet.GetTerrainIndex(t.TerrainType), true); } @@ -437,7 +437,7 @@ namespace OpenRA.Mods.Common.AI if (aircraftInfo == null) return true; - var ammoPoolsInfo = actorInfo.Traits.WithInterface(); + var ammoPoolsInfo = actorInfo.TraitInfos(); if (ammoPoolsInfo.Any(x => !x.SelfReloads)) { diff --git a/OpenRA.Mods.Common/Activities/Air/HeliReturn.cs b/OpenRA.Mods.Common/Activities/Air/HeliReturn.cs index 27cb96e534..42cc0da1aa 100644 --- a/OpenRA.Mods.Common/Activities/Air/HeliReturn.cs +++ b/OpenRA.Mods.Common/Activities/Air/HeliReturn.cs @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Activities heli.Reservation = res.Reserve(dest, self, heli); } - var exit = dest.Info.Traits.WithInterface().FirstOrDefault(); + var exit = dest.Info.TraitInfos().FirstOrDefault(); var offset = (exit != null) ? exit.SpawnOffset : WVec.Zero; return Util.SequenceActivities( diff --git a/OpenRA.Mods.Common/Lint/CheckActorReferences.cs b/OpenRA.Mods.Common/Lint/CheckActorReferences.cs index 49eeea08dc..f71d58ee48 100644 --- a/OpenRA.Mods.Common/Lint/CheckActorReferences.cs +++ b/OpenRA.Mods.Common/Lint/CheckActorReferences.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Lint this.emitError = emitError; foreach (var actorInfo in rules.Actors) - foreach (var traitInfo in actorInfo.Value.Traits.WithInterface()) + foreach (var traitInfo in actorInfo.Value.TraitInfos()) CheckTrait(actorInfo.Value, traitInfo, rules); } diff --git a/OpenRA.Mods.Common/Lint/CheckDeathTypes.cs b/OpenRA.Mods.Common/Lint/CheckDeathTypes.cs index c4144487f6..dc2cb70b22 100644 --- a/OpenRA.Mods.Common/Lint/CheckDeathTypes.cs +++ b/OpenRA.Mods.Common/Lint/CheckDeathTypes.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Lint { foreach (var actorInfo in rules.Actors) { - var animations = actorInfo.Value.Traits.WithInterface().ToList(); + var animations = actorInfo.Value.TraitInfos().ToList(); if (!animations.Any()) continue; @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Lint if (!deathTypes.Any()) continue; - var targetable = actorInfo.Value.Traits.WithInterface().SelectMany(x => x.GetTargetTypes()).ToList(); + var targetable = actorInfo.Value.TraitInfos().SelectMany(x => x.GetTargetTypes()).ToList(); if (!targetable.Any()) continue; diff --git a/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs b/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs index 4323c6df24..5299551817 100644 --- a/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs +++ b/OpenRA.Mods.Common/Lint/CheckDefaultVisibility.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Lint if (actorInfo.Key.StartsWith("^")) continue; - var count = actorInfo.Value.Traits.WithInterface().Count(); + var count = actorInfo.Value.TraitInfos().Count(); if (count == 0) emitError("Actor type `{0}` does not define a default visibility type!".F(actorInfo.Key)); diff --git a/OpenRA.Mods.Common/Lint/CheckPlayers.cs b/OpenRA.Mods.Common/Lint/CheckPlayers.cs index 9d52c86d79..fa151cd05b 100644 --- a/OpenRA.Mods.Common/Lint/CheckPlayers.cs +++ b/OpenRA.Mods.Common/Lint/CheckPlayers.cs @@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Lint var worldActor = map.Rules.Actors["world"]; - var factions = worldActor.Traits.WithInterface().Select(f => f.InternalName).ToHashSet(); + var factions = worldActor.TraitInfos().Select(f => f.InternalName).ToHashSet(); foreach (var player in players.Values) if (!string.IsNullOrWhiteSpace(player.Faction) && !factions.Contains(player.Faction)) emitError("Invalid faction {0} chosen for player {1}.".F(player.Faction, player.Name)); diff --git a/OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs b/OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs index 39115677d2..241f96a9c3 100644 --- a/OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs +++ b/OpenRA.Mods.Common/Lint/CheckRevealFootprint.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Lint continue; var ios = actorInfo.Value.TraitInfoOrDefault(); - foreach (var rsi in actorInfo.Value.Traits.WithInterface()) + foreach (var rsi in actorInfo.Value.TraitInfos()) { if (rsi.Type == VisibilityType.CenterPosition) continue; diff --git a/OpenRA.Mods.Common/Lint/CheckSequences.cs b/OpenRA.Mods.Common/Lint/CheckSequences.cs index 1941d8fd2b..8688f9bb15 100644 --- a/OpenRA.Mods.Common/Lint/CheckSequences.cs +++ b/OpenRA.Mods.Common/Lint/CheckSequences.cs @@ -36,12 +36,12 @@ namespace OpenRA.Mods.Common.Lint Game.ModData.Manifest.Sequences.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal)); var rules = map == null ? Game.ModData.DefaultRules : map.Rules; - var factions = rules.Actors["world"].Traits.WithInterface().Select(f => f.InternalName).ToArray(); + var factions = rules.Actors["world"].TraitInfos().Select(f => f.InternalName).ToArray(); var sequenceProviders = map == null ? rules.Sequences.Values : new[] { rules.Sequences[map.Tileset] }; foreach (var actorInfo in rules.Actors) { - foreach (var renderInfo in actorInfo.Value.Traits.WithInterface()) + foreach (var renderInfo in actorInfo.Value.TraitInfos()) { foreach (var faction in factions) { @@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Lint if (string.IsNullOrEmpty(sequence)) continue; - var renderInfo = actorInfo.Value.Traits.WithInterface().FirstOrDefault(); + var renderInfo = actorInfo.Value.TraitInfos().FirstOrDefault(); if (renderInfo == null) continue; diff --git a/OpenRA.Mods.Common/Lint/CheckUpgrades.cs b/OpenRA.Mods.Common/Lint/CheckUpgrades.cs index eb88b1d1fb..77ba996fd7 100644 --- a/OpenRA.Mods.Common/Lint/CheckUpgrades.cs +++ b/OpenRA.Mods.Common/Lint/CheckUpgrades.cs @@ -111,14 +111,14 @@ namespace OpenRA.Mods.Common.Lint } // TODO: HACK because GainsExperience grants upgrades differently to most other sources. - var gainsExperience = rules.Actors.SelectMany(x => x.Value.Traits.WithInterface() + var gainsExperience = rules.Actors.SelectMany(x => x.Value.TraitInfos() .SelectMany(y => y.Upgrades.SelectMany(z => z.Value))); foreach (var upgrade in gainsExperience) yield return upgrade; // TODO: HACK because Pluggable grants upgrades differently to most other sources. - var pluggable = rules.Actors.SelectMany(x => x.Value.Traits.WithInterface() + var pluggable = rules.Actors.SelectMany(x => x.Value.TraitInfos() .SelectMany(y => y.Upgrades.SelectMany(z => z.Value))); foreach (var upgrade in pluggable) @@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Lint // TODO: HACK because GainsExperience and GainsStatUpgrades do not play by the rules... // We assume everything GainsExperience grants is used by GainsStatUpgrade - var gainsExperience = rules.Actors.SelectMany(x => x.Value.Traits.WithInterface() + var gainsExperience = rules.Actors.SelectMany(x => x.Value.TraitInfos() .SelectMany(y => y.Upgrades.SelectMany(z => z.Value))); foreach (var upgrade in gainsExperience) diff --git a/OpenRA.Mods.Common/Lint/CheckVoiceReferences.cs b/OpenRA.Mods.Common/Lint/CheckVoiceReferences.cs index 4dc86ce289..04181f95d2 100644 --- a/OpenRA.Mods.Common/Lint/CheckVoiceReferences.cs +++ b/OpenRA.Mods.Common/Lint/CheckVoiceReferences.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Lint { foreach (var actorInfo in rules.Actors) { - foreach (var traitInfo in actorInfo.Value.Traits.WithInterface()) + foreach (var traitInfo in actorInfo.Value.TraitInfos()) { var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute()); foreach (var field in fields) @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Lint { var soundInfo = rules.Voices[voiceSet.ToLowerInvariant()]; - foreach (var traitInfo in actorInfo.Traits.WithInterface()) + foreach (var traitInfo in actorInfo.TraitInfos()) { var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute()); foreach (var field in fields) diff --git a/OpenRA.Mods.Common/Lint/LintBuildablePrerequisites.cs b/OpenRA.Mods.Common/Lint/LintBuildablePrerequisites.cs index e655e5dade..2b4f17036c 100644 --- a/OpenRA.Mods.Common/Lint/LintBuildablePrerequisites.cs +++ b/OpenRA.Mods.Common/Lint/LintBuildablePrerequisites.cs @@ -20,13 +20,12 @@ namespace OpenRA.Mods.Common.Lint public void Run(Action emitError, Action emitWarning, Ruleset rules) { // ProvidesPrerequisite allows arbitrary prereq definitions - var customPrereqs = rules.Actors.SelectMany(a => a.Value.Traits - .WithInterface().Select(p => p.Prerequisite ?? a.Value.Name)); + var customPrereqs = rules.Actors.SelectMany(a => a.Value.TraitInfos() + .Select(p => p.Prerequisite ?? a.Value.Name)); // ProvidesTechPrerequisite allows arbitrary prereq definitions // (but only one group at a time during gameplay) - var techPrereqs = rules.Actors.SelectMany(a => a.Value.Traits - .WithInterface()) + var techPrereqs = rules.Actors.SelectMany(a => a.Value.TraitInfos()) .SelectMany(p => p.Prerequisites); var providedPrereqs = customPrereqs.Concat(techPrereqs); diff --git a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs index b6ab928991..d238c31991 100644 --- a/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs @@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Orders var rules = world.Map.Rules; var actorInfo = rules.Actors[building]; - foreach (var dec in actorInfo.Traits.WithInterface()) + foreach (var dec in actorInfo.TraitInfos()) foreach (var r in dec.Render(wr, world, actorInfo, world.Map.CenterOfCell(xy))) yield return r; @@ -177,7 +177,7 @@ namespace OpenRA.Mods.Common.Orders }; var init = new ActorPreviewInitializer(rules.Actors[building], wr, td); - preview = rules.Actors[building].Traits.WithInterface() + preview = rules.Actors[building].TraitInfos() .SelectMany(rpi => rpi.RenderPreview(init)) .ToArray(); diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index 186a497b72..72161d3bf2 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -620,7 +620,7 @@ namespace OpenRA.Mods.Common.Server return true; } - var startUnitsInfo = server.Map.Rules.Actors["world"].Traits.WithInterface(); + var startUnitsInfo = server.Map.Rules.Actors["world"].TraitInfos(); var selectedClass = startUnitsInfo.Where(u => u.Class == s).Select(u => u.ClassName).FirstOrDefault(); var className = selectedClass != null ? selectedClass : s; diff --git a/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs b/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs index c9fc5f1ed2..e7072971f2 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbySettingsNotification.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Server if (server.LobbyInfo.GlobalSettings.StartingUnitsClass != defaults.StartingUnitsClass) { - var startUnitsInfo = server.Map.Rules.Actors["world"].Traits.WithInterface(); + var startUnitsInfo = server.Map.Rules.Actors["world"].TraitInfos(); var selectedClass = startUnitsInfo.Where(u => u.Class == server.LobbyInfo.GlobalSettings.StartingUnitsClass).Select(u => u.ClassName).FirstOrDefault(); var className = selectedClass != null ? selectedClass : server.LobbyInfo.GlobalSettings.StartingUnitsClass; server.SendOrderTo(conn, "Message", "Starting Units: {0}".F(className)); diff --git a/OpenRA.Mods.Common/Traits/Air/Helicopter.cs b/OpenRA.Mods.Common/Traits/Air/Helicopter.cs index 7e973337ac..5402445ade 100644 --- a/OpenRA.Mods.Common/Traits/Air/Helicopter.cs +++ b/OpenRA.Mods.Common/Traits/Air/Helicopter.cs @@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits if (res != null) Reservation = res.Reserve(order.TargetActor, self, this); - var exit = order.TargetActor.Info.Traits.WithInterface().FirstOrDefault(); + var exit = order.TargetActor.Info.TraitInfos().FirstOrDefault(); var offset = (exit != null) ? exit.SpawnOffset : WVec.Zero; self.SetTargetLine(Target.FromActor(order.TargetActor), Color.Green); diff --git a/OpenRA.Mods.Common/Traits/C4Demolition.cs b/OpenRA.Mods.Common/Traits/C4Demolition.cs index 32bbf157b8..031a59c454 100644 --- a/OpenRA.Mods.Common/Traits/C4Demolition.cs +++ b/OpenRA.Mods.Common/Traits/C4Demolition.cs @@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Traits public override bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor) { - return target.Info.Traits.WithInterface().Any(i => i.IsValidTarget(target.Info, self)); + return target.Info.TraitInfos().Any(i => i.IsValidTarget(target.Info, self)); } } } diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index dd531f8f61..1e0446f419 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Allows the player to execute build orders.", " Attach this to the player actor.")] - public class PlaceBuildingInfo : ITraitInfo, IPlaceBuildingDecoration + public class PlaceBuildingInfo : ITraitInfo, IPlaceBuildingDecorationInfo { [Desc("Palette to use for rendering the placement sprite.")] [PaletteReference] public readonly string Palette = "terrain"; diff --git a/OpenRA.Mods.Common/Traits/Production.cs b/OpenRA.Mods.Common/Traits/Production.cs index ae43f493ec..fe645740d0 100644 --- a/OpenRA.Mods.Common/Traits/Production.cs +++ b/OpenRA.Mods.Common/Traits/Production.cs @@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits return false; // Pick a spawn/exit point pair - var exit = self.Info.Traits.WithInterface().Shuffle(self.World.SharedRandom) + var exit = self.Info.TraitInfos().Shuffle(self.World.SharedRandom) .FirstOrDefault(e => CanUseExit(self, producee, e)); if (exit != null || !occupiesSpace) diff --git a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs index 6b8c5fcdfe..5df4978fbe 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Draw a circle indicating my weapon's range.")] - class RenderRangeCircleInfo : ITraitInfo, IPlaceBuildingDecoration, Requires + class RenderRangeCircleInfo : ITraitInfo, IPlaceBuildingDecorationInfo, Requires { public readonly string RangeCircleType = null; @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits public IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition) { - var armaments = ai.Traits.WithInterface() + var armaments = ai.TraitInfos() .Where(a => a.UpgradeMinEnabledLevel == 0); var range = FallbackRange; diff --git a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs index be6c683d39..c69ac9f876 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderSprites.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public interface IRenderActorPreviewSpritesInfo + public interface IRenderActorPreviewSpritesInfo : ITraitInfo { IEnumerable RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p); } @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits } } - foreach (var spi in init.Actor.Traits.WithInterface()) + foreach (var spi in init.Actor.TraitInfos()) foreach (var preview in spi.RenderPreviewSprites(init, this, image, facings, palette)) yield return preview; } diff --git a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs index b34d3a1c70..c37640100f 100644 --- a/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs +++ b/OpenRA.Mods.Common/Traits/Render/RenderVoxels.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public interface IRenderActorPreviewVoxelsInfo + public interface IRenderActorPreviewVoxelsInfo : ITraitInfo { IEnumerable RenderPreviewVoxels( ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p); @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits var ifacing = init.Actor.TraitInfoOrDefault(); var facing = ifacing != null ? init.Contains() ? init.Get() : ifacing.GetInitialFacing() : 0; var orientation = WRot.FromFacing(facing); - var components = init.Actor.Traits.WithInterface() + var components = init.Actor.TraitInfos() .SelectMany(rvpi => rvpi.RenderPreviewVoxels(init, this, image, orientation, facings, palette)) .ToArray(); diff --git a/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs b/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs index b81684e30d..b5461f15e7 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs @@ -37,9 +37,9 @@ namespace OpenRA.Mods.Common.Traits yield break; var body = init.Actor.TraitInfo(); - var armament = init.Actor.Traits.WithInterface() + var armament = init.Actor.TraitInfos() .First(a => a.Name == Armament); - var t = init.Actor.Traits.WithInterface() + var t = init.Actor.TraitInfos() .First(tt => tt.Turret == armament.Turret); var anim = new Animation(init.World, image, () => t.InitialFacing); diff --git a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs index 2bc7283a06..ae97ab9ce2 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Renders an arbitrary circle when selected or placing a structure")] - class WithRangeCircleInfo : ITraitInfo, IPlaceBuildingDecoration + class WithRangeCircleInfo : ITraitInfo, IPlaceBuildingDecorationInfo { [Desc("Type of range circle. used to decide which circles to draw on other structures during building placement.")] public readonly string Type = null; diff --git a/OpenRA.Mods.Common/Traits/Render/WithTurret.cs b/OpenRA.Mods.Common/Traits/Render/WithTurret.cs index a198e33f6f..1794ecc472 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTurret.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTurret.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits yield break; var body = init.Actor.TraitInfo(); - var t = init.Actor.Traits.WithInterface() + var t = init.Actor.TraitInfos() .First(tt => tt.Turret == Turret); var ifacing = init.Actor.TraitInfoOrDefault(); diff --git a/OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs index 03c0c1c8e5..7b971c3493 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTurretedSpriteBody.cs @@ -24,8 +24,8 @@ namespace OpenRA.Mods.Common.Traits public override IEnumerable RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) { - var t = init.Actor.Traits.WithInterface().FirstOrDefault(); - var wsb = init.Actor.Traits.WithInterface().FirstOrDefault(); + var t = init.Actor.TraitInfos().FirstOrDefault(); + var wsb = init.Actor.TraitInfos().FirstOrDefault(); // Show the correct turret facing var anim = new Animation(init.World, image, () => t.InitialFacing); diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs index a9994d0d11..0424309237 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs @@ -35,9 +35,9 @@ namespace OpenRA.Mods.Common.Traits yield break; var body = init.Actor.TraitInfo(); - var armament = init.Actor.Traits.WithInterface() + var armament = init.Actor.TraitInfos() .First(a => a.Name == Armament); - var t = init.Actor.Traits.WithInterface() + var t = init.Actor.TraitInfos() .First(tt => tt.Turret == armament.Turret); var voxel = VoxelProvider.GetVoxel(image, Sequence); diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs index 83e6e39ab8..123d9abd79 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelTurret.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits yield break; var body = init.Actor.TraitInfo(); - var t = init.Actor.Traits.WithInterface() + var t = init.Actor.TraitInfos() .First(tt => tt.Turret == Turret); var voxel = VoxelProvider.GetVoxel(image, Sequence); diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs index ba5f760954..1a616a8159 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs @@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Traits void GeneratePreviews() { var init = new ActorPreviewInitializer(Info, worldRenderer, actor.InitDict); - previews = Info.Traits.WithInterface() + previews = Info.TraitInfos() .SelectMany(rpi => rpi.RenderPreview(init)) .ToArray(); } diff --git a/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs b/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs index 138e19ce66..42cbaaf7ab 100644 --- a/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs +++ b/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits static void SpawnUnitsForPlayer(World w, Player p, CPos sp) { var spawnClass = p.PlayerReference.StartingUnitsClass ?? w.LobbyInfo.GlobalSettings.StartingUnitsClass; - var unitGroup = w.Map.Rules.Actors["world"].Traits.WithInterface() + var unitGroup = w.Map.Rules.Actors["world"].TraitInfos() .Where(g => g.Class == spawnClass && g.Factions != null && g.Factions.Contains(p.Faction.InternalName)) .RandomOrDefault(w.SharedRandom); diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index eba8970756..4fc7fd370e 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits void OnNotifyResourceClaimLost(Actor self, ResourceClaim claim, Actor claimer); } - public interface IPlaceBuildingDecoration + public interface IPlaceBuildingDecorationInfo : ITraitInfo { IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition); } diff --git a/OpenRA.Mods.Common/Widgets/ActorPreviewWidget.cs b/OpenRA.Mods.Common/Widgets/ActorPreviewWidget.cs index 5eb795c7af..d27b3f1bc9 100644 --- a/OpenRA.Mods.Common/Widgets/ActorPreviewWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ActorPreviewWidget.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets public void SetPreview(ActorInfo actor, TypeDictionary td) { var init = new ActorPreviewInitializer(actor, worldRenderer, td); - preview = actor.Traits.WithInterface() + preview = actor.TraitInfos() .SelectMany(rpi => rpi.RenderPreview(init)) .ToArray(); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/LayerSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/LayerSelectorLogic.cs index 1de2c60540..5f9b351568 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/LayerSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/LayerSelectorLogic.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { layerTemplateList.RemoveChildren(); - var resources = modRules.Actors["world"].Traits.WithInterface(); + var resources = modRules.Actors["world"].TraitInfos(); foreach (var resource in resources) { var newResourcePreviewTemplate = ScrollItemWidget.Setup(layerPreviewTemplate, diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs index fdfd1d74d1..3dd5acaaea 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ObserverStatsLogic.cs @@ -242,7 +242,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var assets = template.Get("ASSETS"); assets.GetText = () => "$" + world.Actors .Where(a => a.Owner == player && !a.IsDead && a.Info.HasTraitInfo()) - .Sum(a => a.Info.Traits.WithInterface().First().Cost); + .Sum(a => a.Info.TraitInfos().First().Cost); var harvesters = template.Get("HARVESTERS"); harvesters.GetText = () => world.Actors.Count(a => a.Owner == player && !a.IsDead && a.Info.HasTraitInfo()).ToString(); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs index 34945e9926..70e69c9a98 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/ProductionTooltipLogic.cs @@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var requiresString = prereqs.Any() ? requiresLabel.Text.F(prereqs.JoinWith(", ")) : ""; requiresLabel.GetText = () => requiresString; - var power = actor.Traits.WithInterface().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(i => i.Amount); + var power = actor.TraitInfos().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(i => i.Amount); var powerString = power.ToString(); powerLabel.GetText = () => powerString; powerLabel.GetColor = () => ((pm.PowerProvided - pm.PowerDrained) >= -power || power > 0) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 38149b4ea1..23f688d9ab 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic colorPreview = lobby.Get("COLOR_MANAGER"); colorPreview.Color = Game.Settings.Player.Color; - foreach (var f in modRules.Actors["world"].Traits.WithInterface()) + foreach (var f in modRules.Actors["world"].TraitInfos()) factions.Add(f.InternalName, new LobbyFaction { Selectable = f.Selectable, Name = f.Name, Side = f.Side, Description = f.Description }); var gameStarting = false; @@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic slotsButton.IsDisabled = () => configurationDisabled() || panel != PanelType.Players || Map.RuleStatus != MapRuleStatus.Cached || !orderManager.LobbyInfo.Slots.Values.Any(s => s.AllowBots || !s.LockTeam); - var botNames = modRules.Actors["player"].Traits.WithInterface().Select(t => t.Name); + var botNames = modRules.Actors["player"].TraitInfos().Select(t => t.Name); slotsButton.OnMouseDown = _ => { var options = new Dictionary>(); @@ -395,7 +395,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var startingUnits = optionsBin.GetOrNull("STARTINGUNITS_DROPDOWNBUTTON"); if (startingUnits != null) { - var startUnitsInfo = modRules.Actors["world"].Traits.WithInterface(); + var startUnitsInfo = modRules.Actors["world"].TraitInfos(); var classes = startUnitsInfo.Select(a => a.Class).Distinct(); Func className = c => { @@ -459,7 +459,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var techLevel = optionsBin.GetOrNull("TECHLEVEL_DROPDOWNBUTTON"); if (techLevel != null) { - var techTraits = modRules.Actors["player"].Traits.WithInterface().ToList(); + var techTraits = modRules.Actors["player"].TraitInfos().ToList(); techLevel.IsVisible = () => techTraits.Count > 0; var techLevelDescription = optionsBin.GetOrNull("TECHLEVEL_DESC"); @@ -610,7 +610,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic Game.LobbyInfoChanged += WidgetUtils.Once(() => { var slot = orderManager.LobbyInfo.FirstEmptyBotSlot(); - var bot = modRules.Actors["player"].Traits.WithInterface().Select(t => t.Name).FirstOrDefault(); + var bot = modRules.Actors["player"].TraitInfos().Select(t => t.Name).FirstOrDefault(); var botController = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.IsAdmin); if (slot != null && bot != null) orderManager.IssueOrder(Order.Command("slot_bot {0} {1} {2}".F(slot, botController.Index, bot))); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 61db02b4c2..d39933f368 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var bots = new List(); if (slot.AllowBots) { - foreach (var b in rules.Actors["player"].Traits.WithInterface().Select(t => t.Name)) + foreach (var b in rules.Actors["player"].TraitInfos().Select(t => t.Name)) { var bot = b; var botController = orderManager.LobbyInfo.Clients.FirstOrDefault(c => c.IsAdmin); diff --git a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs index 6333af98fb..8fd99210d0 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs @@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Widgets { this.world = world; - Groups = world.Map.Rules.Actors.Values.SelectMany(a => a.Traits.WithInterface()) + Groups = world.Map.Rules.Actors.Values.SelectMany(a => a.TraitInfos()) .Select(q => q.Group).Distinct().ToDictionary(g => g, g => new ProductionTabGroup() { Group = g }); // Only visible if the production palette has icons to display diff --git a/OpenRA.Mods.RA/Traits/Disguise.cs b/OpenRA.Mods.RA/Traits/Disguise.cs index a4f9dc53e8..49a86156b5 100644 --- a/OpenRA.Mods.RA/Traits/Disguise.cs +++ b/OpenRA.Mods.RA/Traits/Disguise.cs @@ -170,7 +170,7 @@ namespace OpenRA.Mods.RA.Traits var renderSprites = actorInfo.TraitInfoOrDefault(); AsSprite = renderSprites == null ? null : renderSprites.GetImage(actorInfo, self.World.Map.SequenceProvider, newOwner.Faction.InternalName); AsPlayer = newOwner; - AsTooltipInfo = actorInfo.Traits.WithInterface().FirstOrDefault(); + AsTooltipInfo = actorInfo.TraitInfos().FirstOrDefault(); HandleDisguise(oldEffectiveOwner, oldDisguiseSetting); } diff --git a/OpenRA.Mods.RA/Traits/Infiltration/Infiltrates.cs b/OpenRA.Mods.RA/Traits/Infiltration/Infiltrates.cs index b2e04cc20a..454e886c3d 100644 --- a/OpenRA.Mods.RA/Traits/Infiltration/Infiltrates.cs +++ b/OpenRA.Mods.RA/Traits/Infiltration/Infiltrates.cs @@ -134,7 +134,7 @@ namespace OpenRA.Mods.RA.Traits if (!info.ValidStances.HasStance(stance)) return false; - return target.Info.Traits.WithInterface().Any(t => info.Types.Overlaps(t.GetTargetTypes())); + return target.Info.TraitInfos().Any(t => info.Types.Overlaps(t.GetTargetTypes())); } } } diff --git a/OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs b/OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs index c0e055a92f..c989a8ae9f 100644 --- a/OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs +++ b/OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits { // TODO: remove all the Render*Circle duplication - class RenderJammerCircleInfo : ITraitInfo, IPlaceBuildingDecoration + class RenderJammerCircleInfo : ITraitInfo, IPlaceBuildingDecorationInfo { public IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition) { diff --git a/OpenRA.Mods.RA/Traits/Render/RenderShroudCircle.cs b/OpenRA.Mods.RA/Traits/Render/RenderShroudCircle.cs index abb04806c1..7a95b0b572 100644 --- a/OpenRA.Mods.RA/Traits/Render/RenderShroudCircle.cs +++ b/OpenRA.Mods.RA/Traits/Render/RenderShroudCircle.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Traits { - class RenderShroudCircleInfo : ITraitInfo, IPlaceBuildingDecoration + class RenderShroudCircleInfo : ITraitInfo, IPlaceBuildingDecorationInfo { public IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition) {