diff --git a/OpenRA.Game/GameRules/ActorInfo.cs b/OpenRA.Game/GameRules/ActorInfo.cs index 1d7a79e1d9..4d25b46ecc 100644 --- a/OpenRA.Game/GameRules/ActorInfo.cs +++ b/OpenRA.Game/GameRules/ActorInfo.cs @@ -186,9 +186,9 @@ namespace OpenRA i.Name.Replace("Init", ""), i)); } - public bool HasTraitInfo() where T : ITraitInfo { return traits.Contains(); } - public T TraitInfo() where T : ITraitInfo { return traits.Get(); } - public T TraitInfoOrDefault() where T : ITraitInfo { return traits.GetOrDefault(); } - public IEnumerable TraitInfos() where T : ITraitInfo { return traits.WithInterface(); } + public bool HasTraitInfo() where T : ITraitInfoInterface { return traits.Contains(); } + public T TraitInfo() where T : ITraitInfoInterface { return traits.Get(); } + public T TraitInfoOrDefault() where T : ITraitInfoInterface { return traits.GetOrDefault(); } + public IEnumerable TraitInfos() where T : ITraitInfoInterface { return traits.WithInterface(); } } } diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index d0d366060f..5ac5d3feb2 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -134,7 +134,7 @@ namespace OpenRA.Traits public interface ISeedableResource { void Seed(Actor self); } - public interface ISelectionDecorationsInfo : ITraitInfo + public interface ISelectionDecorationsInfo : ITraitInfoInterface { int[] SelectionBoxBounds { get; } } @@ -147,7 +147,7 @@ namespace OpenRA.Traits bool HasVoice(Actor self, string voice); } - public interface IDemolishableInfo : ITraitInfo { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); } + public interface IDemolishableInfo : ITraitInfoInterface { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); } public interface IDemolishable { void Demolish(Actor self, Actor saboteur); @@ -169,7 +169,7 @@ namespace OpenRA.Traits Player Owner { get; } } - public interface ITooltipInfo : ITraitInfo + public interface ITooltipInfo : ITraitInfoInterface { string TooltipForPlayerStance(Stance stance); bool IsOwnerRowVisible { get; } @@ -191,7 +191,7 @@ namespace OpenRA.Traits IEnumerable> RadarSignatureCells(Actor self); } - public interface IDefaultVisibilityInfo : ITraitInfo { } + public interface IDefaultVisibilityInfo : ITraitInfoInterface { } public interface IDefaultVisibility { bool IsVisible(Actor self, Player byPlayer); } public interface IVisibilityModifier { bool IsVisible(Actor self, Player byPlayer); } @@ -203,7 +203,7 @@ namespace OpenRA.Traits public interface IRadarColorModifier { Color RadarColorOverride(Actor self); } - public interface IOccupySpaceInfo : ITraitInfo + public interface IOccupySpaceInfo : ITraitInfoInterface { IReadOnlyDictionary OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any); bool SharesCell { get; } @@ -243,7 +243,7 @@ namespace OpenRA.Traits public interface IReloadModifier { int GetReloadModifier(); } public interface IInaccuracyModifier { int GetInaccuracyModifier(); } public interface IRangeModifier { int GetRangeModifier(); } - public interface IRangeModifierInfo : ITraitInfo { int GetRangeModifierDefault(); } + public interface IRangeModifierInfo : ITraitInfoInterface { int GetRangeModifierDefault(); } public interface IPowerModifier { int GetPowerModifier(); } public interface ILoadsPalettes { void LoadPalettes(WorldRenderer wr); } public interface ILoadsPlayerPalettes { void LoadPlayerPalettes(WorldRenderer wr, string playerName, HSLColor playerColor, bool replaceExisting); } @@ -251,7 +251,7 @@ namespace OpenRA.Traits public interface IPips { IEnumerable GetPips(Actor self); } public interface ISelectionBar { float GetValue(); Color GetColor(); } - public interface IPositionableInfo : ITraitInfo { } + public interface IPositionableInfo : ITraitInfoInterface { } public interface IPositionable : IOccupySpace { bool IsLeavingCell(CPos location, SubCell subCell = SubCell.Any); @@ -263,7 +263,7 @@ namespace OpenRA.Traits void SetVisualPosition(Actor self, WPos pos); } - public interface IMoveInfo : ITraitInfo { } + public interface IMoveInfo : ITraitInfoInterface { } public interface IMove { Activity MoveTo(CPos cell, int nearEnough); @@ -288,7 +288,7 @@ namespace OpenRA.Traits int Facing { get; set; } } - public interface IFacingInfo : ITraitInfo { int GetInitialFacing(); } + public interface IFacingInfo : ITraitInfoInterface { int GetInitialFacing(); } public interface ICrushable { @@ -297,12 +297,13 @@ namespace OpenRA.Traits bool CrushableBy(HashSet crushClasses, Player owner); } - public interface ITraitInfo { object Create(ActorInitializer init); } + public interface ITraitInfoInterface { } + public interface ITraitInfo : ITraitInfoInterface { object Create(ActorInitializer init); } public class TraitInfo : ITraitInfo where T : new() { public virtual object Create(ActorInitializer init) { return new T(); } } [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:InterfaceNamesMustBeginWithI", Justification = "Not a real interface, but more like a tag.")] - public interface Requires where T : class, ITraitInfo { } + public interface Requires where T : class, ITraitInfoInterface { } [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:InterfaceNamesMustBeginWithI", Justification = "Not a real interface, but more like a tag.")] public interface UsesInit : ITraitInfo where T : IActorInit { } @@ -311,7 +312,7 @@ namespace OpenRA.Traits public interface IWorldLoaded { void WorldLoaded(World w, WorldRenderer wr); } public interface ICreatePlayers { void CreatePlayers(World w); } - public interface IBotInfo : ITraitInfo { string Name { get; } } + public interface IBotInfo : ITraitInfoInterface { string Name { get; } } public interface IBot { void Activate(Player p); @@ -334,7 +335,7 @@ namespace OpenRA.Traits public interface IPostRenderSelection { IEnumerable RenderAfterWorld(WorldRenderer wr); } - public interface ITargetableInfo : ITraitInfo + public interface ITargetableInfo : ITraitInfoInterface { HashSet GetTargetTypes(); } @@ -393,5 +394,5 @@ namespace OpenRA.Traits } public interface IRulesetLoaded { void RulesetLoaded(Ruleset rules, TInfo info); } - public interface IRulesetLoaded : IRulesetLoaded, ITraitInfo { } + public interface IRulesetLoaded : IRulesetLoaded, ITraitInfoInterface { } } diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index dbb39bf033..0e58b8a1a5 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -20,7 +20,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public class AircraftInfo : IPositionableInfo, IFacingInfo, IOccupySpaceInfo, IMoveInfo, ICruiseAltitudeInfo, + public class AircraftInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IOccupySpaceInfo, IMoveInfo, ICruiseAltitudeInfo, UsesInit, UsesInit { public readonly WDist CruiseAltitude = new WDist(1280); diff --git a/OpenRA.Mods.Common/Traits/Crates/Crate.cs b/OpenRA.Mods.Common/Traits/Crates/Crate.cs index 722c01c26d..4acbbfcaa4 100644 --- a/OpenRA.Mods.Common/Traits/Crates/Crate.cs +++ b/OpenRA.Mods.Common/Traits/Crates/Crate.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - class CrateInfo : IPositionableInfo, IOccupySpaceInfo, Requires + class CrateInfo : ITraitInfo, IPositionableInfo, IOccupySpaceInfo, Requires { [Desc("Length of time (in seconds) until the crate gets removed automatically. " + "A value of zero disables auto-removal.")] diff --git a/OpenRA.Mods.Common/Traits/Husk.cs b/OpenRA.Mods.Common/Traits/Husk.cs index b5ab9c1134..766137de28 100644 --- a/OpenRA.Mods.Common/Traits/Husk.cs +++ b/OpenRA.Mods.Common/Traits/Husk.cs @@ -17,7 +17,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Spawns remains of a husk actor with the correct facing.")] - public class HuskInfo : IOccupySpaceInfo, IFacingInfo + public class HuskInfo : ITraitInfo, IOccupySpaceInfo, IFacingInfo { public readonly HashSet AllowedTerrain = new HashSet();