Add IBlocksProjectilesInfo interface
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
IEnumerable<IRenderable> 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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user