From 9b2cdd4457b1dff077f51eb1f1e2e2f6af5d0138 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 6 Oct 2015 22:21:31 +0200 Subject: [PATCH 1/3] Add Height property to BlocksProjectiles --- OpenRA.Mods.Common/Traits/BlocksProjectiles.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs index 742441e808..3bd90c95a7 100644 --- a/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs +++ b/OpenRA.Mods.Common/Traits/BlocksProjectiles.cs @@ -13,10 +13,11 @@ using OpenRA.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.")] public class BlocksProjectilesInfo : UpgradableTraitInfo { + public readonly WDist Height = WDist.FromCells(1); + 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) { + var dat = world.Map.DistanceAboveTerrain(pos); return world.ActorMap.GetActorsAt(world.Map.CellContaining(pos)) - .Any(a => a.TraitsImplementing().Any(Exts.IsTraitEnabled)); + .Any(a => a.TraitsImplementing() + .Where(t => t.Info.Height.Length >= dat.Length) + .Any(Exts.IsTraitEnabled)); } } } From c1b805ce420b82941580c6aa39d4f0f2f1fd02ad Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 21 Oct 2015 11:06:51 +0200 Subject: [PATCH 2/3] Lower TS wall blocking height Allows Tick Tanks to shoot over them from certain angles/distances, like in the original. --- mods/ts/rules/gdi-support.yaml | 3 +++ mods/ts/rules/nod-support.yaml | 1 + mods/ts/weapons/largeguns.yaml | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ts/rules/gdi-support.yaml b/mods/ts/rules/gdi-support.yaml index 9bebf43ebc..2b062faa6e 100644 --- a/mods/ts/rules/gdi-support.yaml +++ b/mods/ts/rules/gdi-support.yaml @@ -19,6 +19,7 @@ GAWALL: Armor: Type: Concrete BlocksProjectiles: + Height: 640 Crushable: CrushClasses: heavywall LineBuild: @@ -46,6 +47,8 @@ GACTWR: HP: 500 Armor: Type: Light + BlocksProjectiles: + Height: 768 BodyOrientation: QuantizedFacings: 32 DetectCloaked: diff --git a/mods/ts/rules/nod-support.yaml b/mods/ts/rules/nod-support.yaml index 5e7b9e9505..b0e74d87de 100644 --- a/mods/ts/rules/nod-support.yaml +++ b/mods/ts/rules/nod-support.yaml @@ -19,6 +19,7 @@ NAWALL: Armor: Type: Concrete BlocksProjectiles: + Height: 640 Crushable: CrushClasses: heavywall LineBuild: diff --git a/mods/ts/weapons/largeguns.yaml b/mods/ts/weapons/largeguns.yaml index 1d8f92cbaf..93a9ea9d50 100644 --- a/mods/ts/weapons/largeguns.yaml +++ b/mods/ts/weapons/largeguns.yaml @@ -6,7 +6,7 @@ Speed: 682 Image: 120mm Shadow: true - Angle: 62 + Angle: 75 Palette: ra Warhead@1Dam: SpreadDamage Spread: 128 From f7b8eaf1ac746f97bb4e7f10e1d77be119b64a6e Mon Sep 17 00:00:00 2001 From: reaperrr Date: Thu, 22 Oct 2015 13:21:57 +0200 Subject: [PATCH 3/3] Add height visualization to CombatDebugOverlay --- OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs | 16 +++++++++++++++- mods/cnc/rules/defaults.yaml | 1 + mods/d2k/rules/structures.yaml | 1 + mods/ts/rules/defaults.yaml | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs index b42b07b96e..dceb3511d4 100644 --- a/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs +++ b/OpenRA.Mods.Common/Traits/CombatDebugOverlay.cs @@ -27,12 +27,14 @@ namespace OpenRA.Mods.Common.Traits readonly DeveloperMode devMode; readonly HealthInfo healthInfo; + readonly BlocksProjectilesInfo blockInfo; Lazy attack; Lazy coords; public CombatDebugOverlay(Actor self) { healthInfo = self.Info.TraitInfoOrDefault(); + blockInfo = self.Info.TraitInfoOrDefault(); attack = Exts.Lazy(() => self.TraitOrDefault()); coords = Exts.Lazy(() => self.Trait()); @@ -48,11 +50,23 @@ namespace OpenRA.Mods.Common.Traits if (healthInfo != null) 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 if (attack.Value == null) return; - var wlr = Game.Renderer.WorldLineRenderer; var c = Color.White; // Fire ports on garrisonable structures diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index c76fcedc1c..bc27c48b19 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -545,6 +545,7 @@ ^Wall: Inherits@1: ^SpriteActor + CombatDebugOverlay: AppearsOnRadar: Building: Dimensions: 1,1 diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 6dd1bf0483..2aebdfdf79 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -500,6 +500,7 @@ starport: wall: Inherits@1: ^SpriteActor + CombatDebugOverlay: HiddenUnderShroud: Buildable: Queue: Building diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index fb2e6f0dff..24b4dd8535 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -173,6 +173,7 @@ ^Wall: Inherits@1: ^SpriteActor + CombatDebugOverlay: HiddenUnderShroud: AppearsOnRadar: Building: