diff --git a/OpenRA.Mods.Common/Traits/Air/AttackBomber.cs b/OpenRA.Mods.Common/Traits/Air/AttackBomber.cs index 3c2b310f1d..179e150d39 100644 --- a/OpenRA.Mods.Common/Traits/Air/AttackBomber.cs +++ b/OpenRA.Mods.Common/Traits/Air/AttackBomber.cs @@ -18,11 +18,6 @@ namespace OpenRA.Mods.Common.Traits { public class AttackBomberInfo : AttackBaseInfo { - [Desc("Armament name")] - public readonly string Bombs = "primary"; - - [Desc("Armament name")] - public readonly string Guns = "secondary"; public readonly int FacingTolerance = 2; public override object Create(ActorInitializer init) { return new AttackBomber(init.Self, this); } @@ -47,8 +42,8 @@ namespace OpenRA.Mods.Common.Traits void ITick.Tick(Actor self) { - var bombHeight = self.World.Map.DistanceAboveTerrain(self.CenterPosition); - var bombTarget = Target.FromPos(self.CenterPosition - new WVec(WDist.Zero, WDist.Zero, bombHeight)); + var dat = self.World.Map.DistanceAboveTerrain(target.CenterPosition); + target = Target.FromPos(target.CenterPosition - new WVec(WDist.Zero, WDist.Zero, dat)); var wasInAttackRange = inAttackRange; var wasFacingTarget = facingTarget; @@ -59,30 +54,13 @@ namespace OpenRA.Mods.Common.Traits var facingToTarget = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : f; facingTarget = Math.Abs(facingToTarget - f) % 256 <= info.FacingTolerance; - // Bombs drop anywhere in range - foreach (var a in Armaments.Where(a => a.Info.Name == info.Bombs)) + foreach (var a in Armaments) { if (!target.IsInRange(self.CenterPosition, a.MaxRange())) continue; inAttackRange = true; - a.CheckFire(self, facing, bombTarget); - } - - // Guns only fire when approaching the target - if (facingTarget) - { - foreach (var a in Armaments.Where(a => a.Info.Name == info.Guns)) - { - if (!target.IsInRange(self.CenterPosition, a.MaxRange())) - continue; - - inAttackRange = true; - - var gunPos = self.CenterPosition - new WVec(0, a.MaxRange().Length / 2, 0).Rotate(WRot.FromFacing(f)); - var gunHeight = self.World.Map.DistanceAboveTerrain(gunPos); - a.CheckFire(self, facing, Target.FromPos(gunPos - new WVec(WDist.Zero, WDist.Zero, gunHeight))); - } + a.CheckFire(self, facing, target); } // Actors without armaments may want to trigger an action when it passes the target diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 213b721e0a..cff8b4459e 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -829,6 +829,22 @@ namespace OpenRA.Mods.Common.UtilityCommands node.Key = "UseTargetableCellsOffsets"; } + // Refactored AttackBomb so it doesn't need it's own special sauce anymore + if (engineVersion < 20170713) + { + if (node.Key == "AttackBomber") + { + var gunsOrBombs = node.Value.Nodes.FirstOrDefault(n => n.Key == "Guns" || n.Key == "Bombs"); + if (gunsOrBombs != null) + { + Console.WriteLine("Hardcoded Guns and Bombs logic has been removed from AttackBomber."); + Console.WriteLine("Bombs should work like usual, for gun strafing use the new Weapon TargetOffset modifiers."); + Console.WriteLine("Look at the TD mod's A10 for an example."); + node.Value.Nodes.RemoveAll(n => n.Key == "Guns" || n.Key == "Bombs"); + } + } + } + UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); } diff --git a/mods/cnc/rules/aircraft.yaml b/mods/cnc/rules/aircraft.yaml index 04e67a30a4..0cfe428793 100644 --- a/mods/cnc/rules/aircraft.yaml +++ b/mods/cnc/rules/aircraft.yaml @@ -205,8 +205,6 @@ A10: Repulsable: False AttackBomber: Armaments: gun, bombs - Guns: gun - Bombs: bombs Armament@GUNS: Name: gun Weapon: Vulcan diff --git a/mods/cnc/weapons/smallcaliber.yaml b/mods/cnc/weapons/smallcaliber.yaml index 7f806b9f24..910b1da2b0 100644 --- a/mods/cnc/weapons/smallcaliber.yaml +++ b/mods/cnc/weapons/smallcaliber.yaml @@ -36,7 +36,12 @@ HighV: Vulcan: Inherits: ^HeavyMG - ReloadDelay: 2 + Range: 8c0 + Burst: 9 + BurstDelay: 2 + FirstBurstTargetOffset: -2984,0,0 + FollowingBurstTargetOffset: 746,0,0 + ReloadDelay: 125 Report: gun5.aud Warhead@1Dam: SpreadDamage Spread: 426