diff --git a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs index eaa3d749e1..8ef72a925b 100644 --- a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs +++ b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs @@ -14,14 +14,8 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - [RequireExplicitImplementation] - public interface IBlocksProjectiles - { - WDist BlockingHeight { get; } - } - [Desc("This actor blocks bullets and missiles with 'Blockable' property.")] - public class BlocksProjectilesInfo : ConditionalTraitInfo + public class BlocksProjectilesInfo : ConditionalTraitInfo, IBlocksProjectilesInfo { public readonly WDist Height = WDist.FromCells(1); diff --git a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs index 771b1e4ba2..76691d667f 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Will open and be passable for actors that appear friendly when there are no enemies in range.")] - public class GateInfo : BuildingInfo + public class GateInfo : BuildingInfo, IBlocksProjectilesInfo { public readonly string OpeningSound = null; public readonly string ClosingSound = null; @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int TransitionDelay = 33; [Desc("Blocks bullets scaled to open value.")] - public readonly int BlocksProjectilesHeight = 640; + public readonly WDist BlocksProjectilesHeight = new WDist(640); public override object Create(ActorInitializer init) { return new Gate(init, this); } } @@ -129,7 +129,7 @@ namespace OpenRA.Mods.Common.Traits { get { - return new WDist(info.BlocksProjectilesHeight * (OpenPosition - Position) / OpenPosition); + return new WDist(info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition); } } } diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index 0fb9d5261b..32c5240df6 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -38,6 +38,15 @@ namespace OpenRA.Mods.Common.Traits IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition); } + [RequireExplicitImplementation] + public interface IBlocksProjectiles + { + WDist BlockingHeight { get; } + } + + [RequireExplicitImplementation] + public interface IBlocksProjectilesInfo : ITraitInfoInterface { } + [RequireExplicitImplementation] public interface INotifySold {