Merge pull request #9706 from reaperrr/block-height
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,12 +27,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly DeveloperMode devMode;
|
readonly DeveloperMode devMode;
|
||||||
|
|
||||||
readonly HealthInfo healthInfo;
|
readonly HealthInfo healthInfo;
|
||||||
|
readonly BlocksProjectilesInfo blockInfo;
|
||||||
Lazy<AttackBase> attack;
|
Lazy<AttackBase> attack;
|
||||||
Lazy<BodyOrientation> coords;
|
Lazy<BodyOrientation> coords;
|
||||||
|
|
||||||
public CombatDebugOverlay(Actor self)
|
public CombatDebugOverlay(Actor self)
|
||||||
{
|
{
|
||||||
healthInfo = self.Info.TraitInfoOrDefault<HealthInfo>();
|
healthInfo = self.Info.TraitInfoOrDefault<HealthInfo>();
|
||||||
|
blockInfo = self.Info.TraitInfoOrDefault<BlocksProjectilesInfo>();
|
||||||
attack = Exts.Lazy(() => self.TraitOrDefault<AttackBase>());
|
attack = Exts.Lazy(() => self.TraitOrDefault<AttackBase>());
|
||||||
coords = Exts.Lazy(() => self.Trait<BodyOrientation>());
|
coords = Exts.Lazy(() => self.Trait<BodyOrientation>());
|
||||||
|
|
||||||
@@ -48,11 +50,23 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (healthInfo != null)
|
if (healthInfo != null)
|
||||||
wr.DrawRangeCircle(self.CenterPosition, healthInfo.Radius, Color.Red);
|
wr.DrawRangeCircle(self.CenterPosition, healthInfo.Radius, Color.Red);
|
||||||
|
|
||||||
|
var wlr = Game.Renderer.WorldLineRenderer;
|
||||||
|
|
||||||
|
if (blockInfo != null)
|
||||||
|
{
|
||||||
|
var hc = Color.Orange;
|
||||||
|
var height = new WVec(0, 0, blockInfo.Height.Length);
|
||||||
|
var ha = wr.ScreenPosition(self.CenterPosition);
|
||||||
|
var hb = wr.ScreenPosition(self.CenterPosition + height);
|
||||||
|
wlr.DrawLine(ha, hb, hc);
|
||||||
|
wr.DrawTargetMarker(hc, ha);
|
||||||
|
wr.DrawTargetMarker(hc, hb);
|
||||||
|
}
|
||||||
|
|
||||||
// No armaments to draw
|
// No armaments to draw
|
||||||
if (attack.Value == null)
|
if (attack.Value == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var wlr = Game.Renderer.WorldLineRenderer;
|
|
||||||
var c = Color.White;
|
var c = Color.White;
|
||||||
|
|
||||||
// Fire ports on garrisonable structures
|
// Fire ports on garrisonable structures
|
||||||
|
|||||||
@@ -546,6 +546,7 @@
|
|||||||
|
|
||||||
^Wall:
|
^Wall:
|
||||||
Inherits@1: ^SpriteActor
|
Inherits@1: ^SpriteActor
|
||||||
|
CombatDebugOverlay:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
Building:
|
Building:
|
||||||
Dimensions: 1,1
|
Dimensions: 1,1
|
||||||
|
|||||||
@@ -503,6 +503,7 @@ starport:
|
|||||||
|
|
||||||
wall:
|
wall:
|
||||||
Inherits@1: ^SpriteActor
|
Inherits@1: ^SpriteActor
|
||||||
|
CombatDebugOverlay:
|
||||||
HiddenUnderShroud:
|
HiddenUnderShroud:
|
||||||
Buildable:
|
Buildable:
|
||||||
Queue: Building
|
Queue: Building
|
||||||
|
|||||||
@@ -177,6 +177,7 @@
|
|||||||
|
|
||||||
^Wall:
|
^Wall:
|
||||||
Inherits@1: ^SpriteActor
|
Inherits@1: ^SpriteActor
|
||||||
|
CombatDebugOverlay:
|
||||||
HiddenUnderShroud:
|
HiddenUnderShroud:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
Building:
|
Building:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ GAWALL:
|
|||||||
Armor:
|
Armor:
|
||||||
Type: Concrete
|
Type: Concrete
|
||||||
BlocksProjectiles:
|
BlocksProjectiles:
|
||||||
|
Height: 640
|
||||||
Crushable:
|
Crushable:
|
||||||
CrushClasses: heavywall
|
CrushClasses: heavywall
|
||||||
LineBuild:
|
LineBuild:
|
||||||
@@ -46,6 +47,8 @@ GACTWR:
|
|||||||
HP: 500
|
HP: 500
|
||||||
Armor:
|
Armor:
|
||||||
Type: Light
|
Type: Light
|
||||||
|
BlocksProjectiles:
|
||||||
|
Height: 768
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
QuantizedFacings: 32
|
QuantizedFacings: 32
|
||||||
DetectCloaked:
|
DetectCloaked:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ NAWALL:
|
|||||||
Armor:
|
Armor:
|
||||||
Type: Concrete
|
Type: Concrete
|
||||||
BlocksProjectiles:
|
BlocksProjectiles:
|
||||||
|
Height: 640
|
||||||
Crushable:
|
Crushable:
|
||||||
CrushClasses: heavywall
|
CrushClasses: heavywall
|
||||||
LineBuild:
|
LineBuild:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
Speed: 682
|
Speed: 682
|
||||||
Image: 120mm
|
Image: 120mm
|
||||||
Shadow: true
|
Shadow: true
|
||||||
Angle: 62
|
Angle: 75
|
||||||
Palette: ra
|
Palette: ra
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 128
|
Spread: 128
|
||||||
|
|||||||
Reference in New Issue
Block a user