diff --git a/OpenRA.Mods.RA/AttackBomber.cs b/OpenRA.Mods.RA/AttackBomber.cs index 5f43f80dd3..29b020d0da 100644 --- a/OpenRA.Mods.RA/AttackBomber.cs +++ b/OpenRA.Mods.RA/AttackBomber.cs @@ -19,28 +19,59 @@ namespace OpenRA.Mods.RA { class AttackBomberInfo : AttackBaseInfo { - public override object Create(ActorInitializer init) { return new AttackBomber(init.self); } + [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); } } class AttackBomber : AttackBase, ISync { + AttackBomberInfo info; [Sync] Target target; - public AttackBomber(Actor self) - : base(self) { } + public AttackBomber(Actor self, AttackBomberInfo info) + : base(self) + { + this.info = info; + } public override void Tick(Actor self) { base.Tick(self); - if (!target.IsInRange(self.CenterPosition, GetMaximumRange())) - return; - var facing = self.TraitOrDefault(); var cp = self.CenterPosition; - var t = Target.FromPos(cp - new WVec(0, 0, cp.Z)); - foreach (var a in Armaments) + var bombTarget = Target.FromPos(cp - new WVec(0, 0, cp.Z)); + + // Bombs drop anywhere in range + foreach (var a in Armaments.Where(a => a.Info.Name == info.Bombs)) + { + var range = new WRange((int)(1024 * a.Weapon.Range)); + if (!target.IsInRange(self.CenterPosition, range)) + continue; + + a.CheckFire(self, this, facing, bombTarget); + } + + // Guns only fire when approaching the target + var facingToTarget = Util.GetFacing(target.CenterPosition - self.CenterPosition, facing.Facing); + if (Math.Abs(facingToTarget - facing.Facing) % 256 > info.FacingTolerance) + return; + + foreach (var a in Armaments.Where(a => a.Info.Name == info.Guns)) + { + var range = new WRange((int)(1024 * a.Weapon.Range)); + if (!target.IsInRange(self.CenterPosition, range)) + continue; + + var t = Target.FromPos(cp - new WVec(0, range.Range / 2, cp.Z).Rotate(WRot.FromFacing(facing.Facing))); a.CheckFire(self, this, facing, t); + } } public void SetTarget(WPos pos) { target = Target.FromPos(pos); } diff --git a/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs index 2838bc4ae6..a04eb7ebf3 100755 --- a/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA [ActorReference] public readonly string UnitType = "badr.bomber"; public readonly int SquadSize = 1; - public readonly WVec SquadOffset = new WVec(-1536, 2048, 0); + public readonly WVec SquadOffset = new WVec(-1536, 1536, 0); public readonly int QuantizedFacings = 32; public readonly WRange Cordon = new WRange(5120); diff --git a/mods/cnc/rules/aircraft.yaml b/mods/cnc/rules/aircraft.yaml index 15c7121180..1a1e979880 100644 --- a/mods/cnc/rules/aircraft.yaml +++ b/mods/cnc/rules/aircraft.yaml @@ -197,10 +197,17 @@ A10: Range: 12 RenderUnit: WithShadow: - LimitedAmmo: - Ammo: 10 AttackBomber: - Armament: + Guns: gun + Bombs: bombs + Armament@GUNS: + Name: gun + Weapon: Vulcan + LocalOffset: 1024,0,-85 + WithMuzzleFlash@SECONDARY: + Armament: gun + Armament@BOMBS: + Name: bombs Weapon: Napalm LocalOffset: 0,-256,-43, 0,256,-43 -Selectable: diff --git a/mods/cnc/sequences/aircraft.yaml b/mods/cnc/sequences/aircraft.yaml index e85b0ac724..324d9f93e2 100644 --- a/mods/cnc/sequences/aircraft.yaml +++ b/mods/cnc/sequences/aircraft.yaml @@ -60,5 +60,9 @@ a10: idle: Start: 0 Facings: 32 + muzzle: minigun + Start: 0 + Length: 6 + Facings: 8 icon: a10icnh Start: 0 \ No newline at end of file diff --git a/mods/cnc/weapons.yaml b/mods/cnc/weapons.yaml index 5b18cf5dd7..4be159906f 100644 --- a/mods/cnc/weapons.yaml +++ b/mods/cnc/weapons.yaml @@ -725,12 +725,30 @@ TowerMissle: SmudgeType: Crater Damage: 45 +Vulcan: + ValidTargets: Ground, Water + ROF: 2 + Range: 6 + Report: gun5.aud + Projectile: Bullet + Speed: 100 + Warhead: + Damage: 75 + Spread: 10 + Versus: + None: 100% + Wood: 50% + Light: 100% + Heavy: 25% + InfDeath: 2 + Explosion: piffs + Napalm: ValidTargets: Ground, Water ROF: 4 - Range: 3 + Range: 2 Burst: 2 - BurstDelay: 3 + BurstDelay: 2 Projectile: GravityBomb Image: BOMBLET Warhead: @@ -745,7 +763,7 @@ Napalm: WaterExplosion: med_napalm ImpactSound: flamer2.aud SmudgeType: Scorch - Damage: 45 + Damage: 50 Napalm.Crate: Warhead: