remove AttackDefault; use AttackFrontal instead

This commit is contained in:
Bob
2010-10-25 09:51:14 +13:00
parent c338d28d35
commit f5fe1013ee
9 changed files with 55 additions and 53 deletions

View File

@@ -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 ) { }
}
} }

View File

@@ -13,12 +13,18 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
abstract class AttackFrontal : AttackBase public class AttackFrontalInfo : AttackBaseInfo
{ {
public AttackFrontal(Actor self, int facingTolerance) public readonly int FacingTolerance = 1;
: base(self) { FacingTolerance = facingTolerance; }
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 ) protected override bool CanAttack( Actor self )
{ {
@@ -28,7 +34,7 @@ namespace OpenRA.Mods.RA
var facing = self.Trait<IFacing>().Facing; var facing = self.Trait<IFacing>().Facing;
var facingToTarget = Util.GetFacing(target.CenterLocation - self.CenterLocation, 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 false;
return true; return true;

View File

@@ -13,14 +13,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA 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 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) protected override void QueueAttack(Actor self, Target newTarget)
{ {

View File

@@ -13,14 +13,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA 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 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) protected override void QueueAttack(Actor self, Target newTarget)
{ {

View File

@@ -135,7 +135,7 @@
HP: 20 HP: 20
RevealsShroud: RevealsShroud:
Range: 2 Range: 2
AttackDefault: AttackFrontal:
PrimaryWeapon: Pistol PrimaryWeapon: Pistol
# ActorLostNotification: # ActorLostNotification:
# Notification: civdead1.aud # Notification: civdead1.aud
@@ -302,4 +302,4 @@
DamagedSound: xplos.aud DamagedSound: xplos.aud
DestroyedSound: xplobig4.aud DestroyedSound: xplobig4.aud
Footprint: ______ ______ ______ ______ Footprint: ______ ______ ______ ______
Dimensions: 6,4 Dimensions: 6,4

View File

@@ -15,7 +15,7 @@ E1:
Speed: 4 Speed: 4
Health: Health:
HP: 50 HP: 50
AttackDefault: AttackFrontal:
PrimaryWeapon: M16 PrimaryWeapon: M16
TakeCover: TakeCover:
IdleAnimation: IdleAnimation:
@@ -38,7 +38,7 @@ E2:
Speed: 4 Speed: 4
Health: Health:
HP: 50 HP: 50
AttackDefault: AttackFrontal:
PrimaryWeapon: Grenade PrimaryWeapon: Grenade
PrimaryOffset: 0,0,0,-10 PrimaryOffset: 0,0,0,-10
FireDelay: 15 FireDelay: 15
@@ -63,7 +63,7 @@ E3:
Speed: 3 Speed: 3
Health: Health:
HP: 45 HP: 45
AttackDefault: AttackFrontal:
PrimaryWeapon: Rockets PrimaryWeapon: Rockets
PrimaryOffset: 0,0,0,-10 PrimaryOffset: 0,0,0,-10
FireDelay: 5 FireDelay: 5
@@ -89,7 +89,7 @@ E4:
Speed: 4 Speed: 4
Health: Health:
HP: 90 HP: 90
AttackDefault: AttackFrontal:
PrimaryWeapon: Flamethrower PrimaryWeapon: Flamethrower
PrimaryOffset: 0,0,0,-5 PrimaryOffset: 0,0,0,-5
FireDelay: 3 FireDelay: 3
@@ -118,7 +118,7 @@ E5:
Speed: 4 Speed: 4
Health: Health:
HP: 90 HP: 90
AttackDefault: AttackFrontal:
PrimaryWeapon: Chemspray PrimaryWeapon: Chemspray
PrimaryOffset: 0,0,0,-5 PrimaryOffset: 0,0,0,-5
FireDelay: 3 FireDelay: 3
@@ -179,10 +179,10 @@ RMBO:
HP: 200 HP: 200
RevealsShroud: RevealsShroud:
Range: 5 Range: 5
AttackDefault: AttackFrontal:
PrimaryWeapon: Sniper PrimaryWeapon: Sniper
TakeCover: TakeCover:
C4Demolition: C4Demolition:
C4Delay: .03 C4Delay: .03
IdleAnimation: IdleAnimation:
Animations: idle1,idle2,idle3 Animations: idle1,idle2,idle3

View File

@@ -83,7 +83,7 @@ APC:
Type: Heavy Type: Heavy
RevealsShroud: RevealsShroud:
Range: 5 Range: 5
AttackDefault: AttackFrontal:
PrimaryWeapon: MachineGun PrimaryWeapon: MachineGun
PrimaryOffset: 0,0,0,-4 PrimaryOffset: 0,0,0,-4
MuzzleFlash: yes MuzzleFlash: yes
@@ -116,7 +116,7 @@ ARTY:
Type: Light Type: Light
RevealsShroud: RevealsShroud:
Range: 6 Range: 6
AttackDefault: AttackFrontal:
PrimaryWeapon: Ballistic PrimaryWeapon: Ballistic
RenderUnit: RenderUnit:
Explodes: Explodes:
@@ -143,7 +143,7 @@ FTNK:
Type: Heavy Type: Heavy
RevealsShroud: RevealsShroud:
Range: 4 Range: 4
AttackDefault: AttackFrontal:
PrimaryWeapon: BigFlamer PrimaryWeapon: BigFlamer
PrimaryOffset: 2,-8,0,-2 PrimaryOffset: 2,-8,0,-2
SecondaryWeapon: BigFlamer SecondaryWeapon: BigFlamer
@@ -202,7 +202,7 @@ BIKE:
Armor: none Armor: none
RevealsShroud: RevealsShroud:
Range: 7 Range: 7
AttackDefault: AttackFrontal:
PrimaryWeapon: Rockets.Bike PrimaryWeapon: Rockets.Bike
PrimaryOffset: 0,0,0,-2 PrimaryOffset: 0,0,0,-2
PrimaryLocalOffset: -4,0,25,4,0,-25 PrimaryLocalOffset: -4,0,25,4,0,-25
@@ -442,7 +442,7 @@ STNK:
CloakDelay: 2.0 CloakDelay: 2.0
CloakSound: appear1.aud CloakSound: appear1.aud
UncloakSound: appear1.aud UncloakSound: appear1.aud
AttackDefault: AttackFrontal:
PrimaryWeapon: 227mm PrimaryWeapon: 227mm
RenderUnit: RenderUnit:
AutoTarget: AutoTarget:
@@ -507,6 +507,7 @@ HELI:
SecondaryWeapon: HighV SecondaryWeapon: HighV
PrimaryOffset: -5,0,0,2 PrimaryOffset: -5,0,0,2
SecondaryOffset: 5,0,0,2 SecondaryOffset: 5,0,0,2
FacingTolerance: 20
RenderUnitRotor: RenderUnitRotor:
PrimaryOffset: 0,0,0,-2 PrimaryOffset: 0,0,0,-2
WithShadow: WithShadow:
@@ -539,6 +540,7 @@ ORCA:
SecondaryWeapon: Rockets.Orca SecondaryWeapon: Rockets.Orca
PrimaryOffset: -5,0,0,2 PrimaryOffset: -5,0,0,2
SecondaryOffset: 5,0,0,2 SecondaryOffset: 5,0,0,2
FacingTolerance: 20
RenderUnit: RenderUnit:
WithShadow: WithShadow:
FallsToEarth: FallsToEarth:
@@ -717,4 +719,4 @@ MLRS.Husk:
Anim: turret Anim: turret
Spread: 3,3 Spread: 3,3
Speed: 6 Speed: 6
AnimKey: turret AnimKey: turret

View File

@@ -45,7 +45,7 @@ E1:
HP: 50 HP: 50
Mobile: Mobile:
Speed: 4 Speed: 4
AttackDefault: AttackFrontal:
PrimaryWeapon: M1Carbine PrimaryWeapon: M1Carbine
TakeCover: TakeCover:
IdleAnimation: IdleAnimation:
@@ -70,7 +70,7 @@ E2:
HP: 50 HP: 50
Mobile: Mobile:
Speed: 5 Speed: 5
AttackDefault: AttackFrontal:
PrimaryWeapon: Grenade PrimaryWeapon: Grenade
PrimaryOffset: 0,0,0,-13 PrimaryOffset: 0,0,0,-13
FireDelay: 15 FireDelay: 15
@@ -97,7 +97,7 @@ E3:
HP: 45 HP: 45
Mobile: Mobile:
Speed: 3 Speed: 3
AttackDefault: AttackFrontal:
PrimaryWeapon: RedEye PrimaryWeapon: RedEye
SecondaryWeapon: Dragon SecondaryWeapon: Dragon
PrimaryOffset: 0,0,0,-13 PrimaryOffset: 0,0,0,-13
@@ -124,7 +124,7 @@ E4:
HP: 40 HP: 40
Mobile: Mobile:
Speed: 3 Speed: 3
AttackDefault: AttackFrontal:
PrimaryWeapon: Flamer PrimaryWeapon: Flamer
PrimaryOffset: 0,0,0,-7 PrimaryOffset: 0,0,0,-7
FireDelay: 8 FireDelay: 8
@@ -221,7 +221,7 @@ E7:
Range: 6 Range: 6
C4Demolition: C4Demolition:
C4Delay: .03 C4Delay: .03
AttackDefault: AttackFrontal:
PrimaryWeapon: Colt45 PrimaryWeapon: Colt45
SecondaryWeapon: Colt45 SecondaryWeapon: Colt45
TakeCover: TakeCover:
@@ -253,7 +253,7 @@ MEDI:
Passenger: Passenger:
PipType: Yellow PipType: Yellow
AutoHeal: AutoHeal:
AttackDefault: AttackFrontal:
PrimaryWeapon: Heal PrimaryWeapon: Heal
TakeCover: TakeCover:
-AutoTarget: -AutoTarget:
@@ -277,7 +277,7 @@ C1:
Speed: 4 Speed: 4
RevealsShroud: RevealsShroud:
Range: 2 Range: 2
AttackDefault: AttackFrontal:
PrimaryWeapon: Pistol PrimaryWeapon: Pistol
C2: C2:
@@ -295,7 +295,7 @@ C2:
Speed: 4 Speed: 4
RevealsShroud: RevealsShroud:
Range: 2 Range: 2
AttackDefault: AttackFrontal:
PrimaryWeapon: Pistol PrimaryWeapon: Pistol
SHOK: SHOK:
@@ -318,8 +318,8 @@ SHOK:
Speed: 3 Speed: 3
RevealsShroud: RevealsShroud:
Range: 4 Range: 4
AttackDefault: AttackFrontal:
PrimaryWeapon: PortaTesla PrimaryWeapon: PortaTesla
TakeCover: TakeCover:
IdleAnimation: IdleAnimation:
Animations: idle1,idle2 Animations: idle1,idle2

View File

@@ -71,7 +71,7 @@ V2RL:
Speed: 7 Speed: 7
RevealsShroud: RevealsShroud:
Range: 5 Range: 5
AttackDefault: AttackFrontal:
PrimaryWeapon: SCUD PrimaryWeapon: SCUD
RenderUnitReload: RenderUnitReload:
AutoTarget: AutoTarget:
@@ -245,7 +245,7 @@ ARTY:
Speed: 6 Speed: 6
RevealsShroud: RevealsShroud:
Range: 5 Range: 5
AttackDefault: AttackFrontal:
PrimaryWeapon: 155mm PrimaryWeapon: 155mm
RenderUnit: RenderUnit:
Explodes: Explodes:
@@ -364,7 +364,7 @@ APC:
Speed: 10 Speed: 10
RevealsShroud: RevealsShroud:
Range: 5 Range: 5
AttackDefault: AttackFrontal:
PrimaryWeapon: M60mg PrimaryWeapon: M60mg
PrimaryOffset: 0,0,0,-4 PrimaryOffset: 0,0,0,-4
MuzzleFlash: yes MuzzleFlash: yes
@@ -482,7 +482,7 @@ SS:
CloakDelay: 2.0 CloakDelay: 2.0
CloakSound: subshow1.aud CloakSound: subshow1.aud
UncloakSound: subshow1.aud UncloakSound: subshow1.aud
AttackDefault: AttackFrontal:
PrimaryWeapon: TorpTube PrimaryWeapon: TorpTube
PrimaryLocalOffset: -4,0,0,4,0,0 PrimaryLocalOffset: -4,0,0,4,0,0
FireDelay: 2 FireDelay: 2
@@ -524,7 +524,7 @@ MSUB:
CloakDelay: 2.0 CloakDelay: 2.0
CloakSound: subshow1.aud CloakSound: subshow1.aud
UncloakSound: subshow1.aud UncloakSound: subshow1.aud
AttackDefault: AttackFrontal:
PrimaryWeapon: SubMissile PrimaryWeapon: SubMissile
FireDelay: 2 FireDelay: 2
Selectable: Selectable:
@@ -702,6 +702,7 @@ MIG:
SecondaryWeapon: Maverick SecondaryWeapon: Maverick
PrimaryLocalOffset: -15,0,-10,-12,0,6 PrimaryLocalOffset: -15,0,-10,-12,0,6
SecondaryLocalOffset: 15,0,10,12,0,6 SecondaryLocalOffset: 15,0,10,12,0,6
FacingTolerance: 20
Plane: Plane:
InitialFacing: 192 InitialFacing: 192
ROT: 5 ROT: 5
@@ -744,6 +745,7 @@ YAK:
SecondaryWeapon: ChainGun.Yak SecondaryWeapon: ChainGun.Yak
PrimaryOffset: -5,-6,0,0 PrimaryOffset: -5,-6,0,0
SecondaryOffset: 5,-6,0,0 SecondaryOffset: 5,-6,0,0
FacingTolerance: 20
Plane: Plane:
RearmBuildings: afld RearmBuildings: afld
InitialFacing: 192 InitialFacing: 192
@@ -790,7 +792,7 @@ TRAN:
WithShadow: WithShadow:
Cargo: Cargo:
Types: Infantry Types: Infantry
Passengers: 5 Passengers: 5
IronCurtainable: IronCurtainable:
FallsToEarth: FallsToEarth:
@@ -818,6 +820,7 @@ HELI:
SecondaryWeapon: Hellfire SecondaryWeapon: Hellfire
PrimaryOffset: -5,0,0,2 PrimaryOffset: -5,0,0,2
SecondaryOffset: 5,0,0,2 SecondaryOffset: 5,0,0,2
FacingTolerance: 20
Helicopter: Helicopter:
RearmBuildings: hpad RearmBuildings: hpad
LandWhenIdle: false LandWhenIdle: false
@@ -856,6 +859,7 @@ HIND:
SecondaryWeapon: ChainGun SecondaryWeapon: ChainGun
PrimaryOffset: -5,-2,0,2 PrimaryOffset: -5,-2,0,2
SecondaryOffset: 5,-2,0,2 SecondaryOffset: 5,-2,0,2
FacingTolerance: 20
Helicopter: Helicopter:
RearmBuildings: hpad RearmBuildings: hpad
LandWhenIdle: false LandWhenIdle: false
@@ -959,7 +963,7 @@ TTNK:
Speed: 8 Speed: 8
RevealsShroud: RevealsShroud:
Range: 7 Range: 7
AttackDefault: AttackFrontal:
PrimaryWeapon: TTankZap PrimaryWeapon: TTankZap
RenderUnitSpinner: RenderUnitSpinner:
Selectable: Selectable: