Add Height property to BlocksProjectiles
This commit is contained in:
@@ -13,10 +13,11 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
// TODO: Add functionality like a customizable Height that is compared to projectile altitude
|
|
||||||
[Desc("This actor blocks bullets and missiles with 'Blockable' property.")]
|
[Desc("This actor blocks bullets and missiles with 'Blockable' property.")]
|
||||||
public class BlocksProjectilesInfo : UpgradableTraitInfo
|
public class BlocksProjectilesInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
|
public readonly WDist Height = WDist.FromCells(1);
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new BlocksProjectiles(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new BlocksProjectiles(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,8 +28,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public static bool AnyBlockingActorAt(World world, WPos pos)
|
public static bool AnyBlockingActorAt(World world, WPos pos)
|
||||||
{
|
{
|
||||||
|
var dat = world.Map.DistanceAboveTerrain(pos);
|
||||||
return world.ActorMap.GetActorsAt(world.Map.CellContaining(pos))
|
return world.ActorMap.GetActorsAt(world.Map.CellContaining(pos))
|
||||||
.Any(a => a.TraitsImplementing<BlocksProjectiles>().Any(Exts.IsTraitEnabled));
|
.Any(a => a.TraitsImplementing<BlocksProjectiles>()
|
||||||
|
.Where(t => t.Info.Height.Length >= dat.Length)
|
||||||
|
.Any(Exts.IsTraitEnabled));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user