diff --git a/OpenRA.Mods.RA/AttackBase.cs b/OpenRA.Mods.RA/AttackBase.cs index 79cbc13381..c1a4ec341a 100644 --- a/OpenRA.Mods.RA/AttackBase.cs +++ b/OpenRA.Mods.RA/AttackBase.cs @@ -282,14 +282,4 @@ namespace OpenRA.Mods.RA } } } - - public class AttackDefaultInfo : AttackBaseInfo - { - public override object Create( ActorInitializer init ) { return new AttackDefault( init.self ); } - } - - public class AttackDefault : AttackBase - { - public AttackDefault( Actor self ) : base( self ) { } - } } diff --git a/OpenRA.Mods.RA/AttackFrontal.cs b/OpenRA.Mods.RA/AttackFrontal.cs index 2bc160ef28..877bdf105f 100644 --- a/OpenRA.Mods.RA/AttackFrontal.cs +++ b/OpenRA.Mods.RA/AttackFrontal.cs @@ -13,12 +13,18 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - abstract class AttackFrontal : AttackBase + public class AttackFrontalInfo : AttackBaseInfo { - public AttackFrontal(Actor self, int facingTolerance) - : base(self) { FacingTolerance = facingTolerance; } + public readonly int FacingTolerance = 1; - readonly int FacingTolerance; + public override object Create( ActorInitializer init ) { return new AttackFrontal( init.self, this ); } + } + + public class AttackFrontal : AttackBase + { + readonly AttackFrontalInfo info; + public AttackFrontal(Actor self, AttackFrontalInfo info) + : base( self ) { this.info = info; } protected override bool CanAttack( Actor self ) { @@ -28,7 +34,7 @@ namespace OpenRA.Mods.RA var facing = self.Trait().Facing; var facingToTarget = Util.GetFacing(target.CenterLocation - self.CenterLocation, facing); - if( Math.Abs( facingToTarget - facing ) % 256 >= FacingTolerance ) + if( Math.Abs( facingToTarget - facing ) % 256 > info.FacingTolerance ) return false; return true; diff --git a/OpenRA.Mods.RA/AttackHeli.cs b/OpenRA.Mods.RA/AttackHeli.cs index f6e9444c28..d659c45310 100644 --- a/OpenRA.Mods.RA/AttackHeli.cs +++ b/OpenRA.Mods.RA/AttackHeli.cs @@ -13,14 +13,14 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - class AttackHeliInfo : AttackBaseInfo + class AttackHeliInfo : AttackFrontalInfo { - public override object Create(ActorInitializer init) { return new AttackHeli(init.self); } + public override object Create(ActorInitializer init) { return new AttackHeli(init.self, this); } } class AttackHeli : AttackFrontal { - public AttackHeli(Actor self) : base(self, 20) { } + public AttackHeli(Actor self, AttackHeliInfo info) : base(self, info) { } protected override void QueueAttack(Actor self, Target newTarget) { diff --git a/OpenRA.Mods.RA/AttackPlane.cs b/OpenRA.Mods.RA/AttackPlane.cs index 59eda241d7..b80e1e137a 100644 --- a/OpenRA.Mods.RA/AttackPlane.cs +++ b/OpenRA.Mods.RA/AttackPlane.cs @@ -13,14 +13,14 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - class AttackPlaneInfo : AttackBaseInfo + class AttackPlaneInfo : AttackFrontalInfo { - public override object Create(ActorInitializer init) { return new AttackPlane(init.self); } + public override object Create(ActorInitializer init) { return new AttackPlane(init.self, this); } } class AttackPlane : AttackFrontal { - public AttackPlane(Actor self) : base(self, 20) { } + public AttackPlane(Actor self, AttackPlaneInfo info) : base(self, info) { } protected override void QueueAttack(Actor self, Target newTarget) { diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index fb0c2480e6..9d547cd66d 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -135,7 +135,7 @@ HP: 20 RevealsShroud: Range: 2 - AttackDefault: + AttackFrontal: PrimaryWeapon: Pistol # ActorLostNotification: # Notification: civdead1.aud @@ -302,4 +302,4 @@ DamagedSound: xplos.aud DestroyedSound: xplobig4.aud Footprint: ______ ______ ______ ______ - Dimensions: 6,4 \ No newline at end of file + Dimensions: 6,4 diff --git a/mods/cnc/rules/infantry.yaml b/mods/cnc/rules/infantry.yaml index 917ce52748..991beb124b 100644 --- a/mods/cnc/rules/infantry.yaml +++ b/mods/cnc/rules/infantry.yaml @@ -15,7 +15,7 @@ E1: Speed: 4 Health: HP: 50 - AttackDefault: + AttackFrontal: PrimaryWeapon: M16 TakeCover: IdleAnimation: @@ -38,7 +38,7 @@ E2: Speed: 4 Health: HP: 50 - AttackDefault: + AttackFrontal: PrimaryWeapon: Grenade PrimaryOffset: 0,0,0,-10 FireDelay: 15 @@ -63,7 +63,7 @@ E3: Speed: 3 Health: HP: 45 - AttackDefault: + AttackFrontal: PrimaryWeapon: Rockets PrimaryOffset: 0,0,0,-10 FireDelay: 5 @@ -89,7 +89,7 @@ E4: Speed: 4 Health: HP: 90 - AttackDefault: + AttackFrontal: PrimaryWeapon: Flamethrower PrimaryOffset: 0,0,0,-5 FireDelay: 3 @@ -118,7 +118,7 @@ E5: Speed: 4 Health: HP: 90 - AttackDefault: + AttackFrontal: PrimaryWeapon: Chemspray PrimaryOffset: 0,0,0,-5 FireDelay: 3 @@ -179,10 +179,10 @@ RMBO: HP: 200 RevealsShroud: Range: 5 - AttackDefault: + AttackFrontal: PrimaryWeapon: Sniper TakeCover: C4Demolition: C4Delay: .03 IdleAnimation: - Animations: idle1,idle2,idle3 \ No newline at end of file + Animations: idle1,idle2,idle3 diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index d51982185b..4f34d4dce8 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -83,7 +83,7 @@ APC: Type: Heavy RevealsShroud: Range: 5 - AttackDefault: + AttackFrontal: PrimaryWeapon: MachineGun PrimaryOffset: 0,0,0,-4 MuzzleFlash: yes @@ -116,7 +116,7 @@ ARTY: Type: Light RevealsShroud: Range: 6 - AttackDefault: + AttackFrontal: PrimaryWeapon: Ballistic RenderUnit: Explodes: @@ -143,7 +143,7 @@ FTNK: Type: Heavy RevealsShroud: Range: 4 - AttackDefault: + AttackFrontal: PrimaryWeapon: BigFlamer PrimaryOffset: 2,-8,0,-2 SecondaryWeapon: BigFlamer @@ -202,7 +202,7 @@ BIKE: Armor: none RevealsShroud: Range: 7 - AttackDefault: + AttackFrontal: PrimaryWeapon: Rockets.Bike PrimaryOffset: 0,0,0,-2 PrimaryLocalOffset: -4,0,25,4,0,-25 @@ -442,7 +442,7 @@ STNK: CloakDelay: 2.0 CloakSound: appear1.aud UncloakSound: appear1.aud - AttackDefault: + AttackFrontal: PrimaryWeapon: 227mm RenderUnit: AutoTarget: @@ -507,6 +507,7 @@ HELI: SecondaryWeapon: HighV PrimaryOffset: -5,0,0,2 SecondaryOffset: 5,0,0,2 + FacingTolerance: 20 RenderUnitRotor: PrimaryOffset: 0,0,0,-2 WithShadow: @@ -539,6 +540,7 @@ ORCA: SecondaryWeapon: Rockets.Orca PrimaryOffset: -5,0,0,2 SecondaryOffset: 5,0,0,2 + FacingTolerance: 20 RenderUnit: WithShadow: FallsToEarth: @@ -717,4 +719,4 @@ MLRS.Husk: Anim: turret Spread: 3,3 Speed: 6 - AnimKey: turret \ No newline at end of file + AnimKey: turret diff --git a/mods/ra/rules/infantry.yaml b/mods/ra/rules/infantry.yaml index 783d4e0b25..81da1ecf83 100644 --- a/mods/ra/rules/infantry.yaml +++ b/mods/ra/rules/infantry.yaml @@ -45,7 +45,7 @@ E1: HP: 50 Mobile: Speed: 4 - AttackDefault: + AttackFrontal: PrimaryWeapon: M1Carbine TakeCover: IdleAnimation: @@ -70,7 +70,7 @@ E2: HP: 50 Mobile: Speed: 5 - AttackDefault: + AttackFrontal: PrimaryWeapon: Grenade PrimaryOffset: 0,0,0,-13 FireDelay: 15 @@ -97,7 +97,7 @@ E3: HP: 45 Mobile: Speed: 3 - AttackDefault: + AttackFrontal: PrimaryWeapon: RedEye SecondaryWeapon: Dragon PrimaryOffset: 0,0,0,-13 @@ -124,7 +124,7 @@ E4: HP: 40 Mobile: Speed: 3 - AttackDefault: + AttackFrontal: PrimaryWeapon: Flamer PrimaryOffset: 0,0,0,-7 FireDelay: 8 @@ -221,7 +221,7 @@ E7: Range: 6 C4Demolition: C4Delay: .03 - AttackDefault: + AttackFrontal: PrimaryWeapon: Colt45 SecondaryWeapon: Colt45 TakeCover: @@ -253,7 +253,7 @@ MEDI: Passenger: PipType: Yellow AutoHeal: - AttackDefault: + AttackFrontal: PrimaryWeapon: Heal TakeCover: -AutoTarget: @@ -277,7 +277,7 @@ C1: Speed: 4 RevealsShroud: Range: 2 - AttackDefault: + AttackFrontal: PrimaryWeapon: Pistol C2: @@ -295,7 +295,7 @@ C2: Speed: 4 RevealsShroud: Range: 2 - AttackDefault: + AttackFrontal: PrimaryWeapon: Pistol SHOK: @@ -318,8 +318,8 @@ SHOK: Speed: 3 RevealsShroud: Range: 4 - AttackDefault: + AttackFrontal: PrimaryWeapon: PortaTesla TakeCover: IdleAnimation: - Animations: idle1,idle2 \ No newline at end of file + Animations: idle1,idle2 diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml index b94b4c4a6c..f61cd34c1f 100644 --- a/mods/ra/rules/vehicles.yaml +++ b/mods/ra/rules/vehicles.yaml @@ -71,7 +71,7 @@ V2RL: Speed: 7 RevealsShroud: Range: 5 - AttackDefault: + AttackFrontal: PrimaryWeapon: SCUD RenderUnitReload: AutoTarget: @@ -245,7 +245,7 @@ ARTY: Speed: 6 RevealsShroud: Range: 5 - AttackDefault: + AttackFrontal: PrimaryWeapon: 155mm RenderUnit: Explodes: @@ -364,7 +364,7 @@ APC: Speed: 10 RevealsShroud: Range: 5 - AttackDefault: + AttackFrontal: PrimaryWeapon: M60mg PrimaryOffset: 0,0,0,-4 MuzzleFlash: yes @@ -482,7 +482,7 @@ SS: CloakDelay: 2.0 CloakSound: subshow1.aud UncloakSound: subshow1.aud - AttackDefault: + AttackFrontal: PrimaryWeapon: TorpTube PrimaryLocalOffset: -4,0,0,4,0,0 FireDelay: 2 @@ -524,7 +524,7 @@ MSUB: CloakDelay: 2.0 CloakSound: subshow1.aud UncloakSound: subshow1.aud - AttackDefault: + AttackFrontal: PrimaryWeapon: SubMissile FireDelay: 2 Selectable: @@ -702,6 +702,7 @@ MIG: SecondaryWeapon: Maverick PrimaryLocalOffset: -15,0,-10,-12,0,6 SecondaryLocalOffset: 15,0,10,12,0,6 + FacingTolerance: 20 Plane: InitialFacing: 192 ROT: 5 @@ -744,6 +745,7 @@ YAK: SecondaryWeapon: ChainGun.Yak PrimaryOffset: -5,-6,0,0 SecondaryOffset: 5,-6,0,0 + FacingTolerance: 20 Plane: RearmBuildings: afld InitialFacing: 192 @@ -790,7 +792,7 @@ TRAN: WithShadow: Cargo: Types: Infantry - Passengers: 5 + Passengers: 5 IronCurtainable: FallsToEarth: @@ -818,6 +820,7 @@ HELI: SecondaryWeapon: Hellfire PrimaryOffset: -5,0,0,2 SecondaryOffset: 5,0,0,2 + FacingTolerance: 20 Helicopter: RearmBuildings: hpad LandWhenIdle: false @@ -856,6 +859,7 @@ HIND: SecondaryWeapon: ChainGun PrimaryOffset: -5,-2,0,2 SecondaryOffset: 5,-2,0,2 + FacingTolerance: 20 Helicopter: RearmBuildings: hpad LandWhenIdle: false @@ -959,7 +963,7 @@ TTNK: Speed: 8 RevealsShroud: Range: 7 - AttackDefault: + AttackFrontal: PrimaryWeapon: TTankZap RenderUnitSpinner: Selectable: