GetPrimaryWeapon() dies too.
This commit is contained in:
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return this;
|
||||
}
|
||||
|
||||
var range = self.GetPrimaryWeapon().Range - 1;
|
||||
var range = self.traits.Get<AttackBase>().GetMaximumRange() - 1;
|
||||
var dist = target.CenterLocation - self.CenterLocation;
|
||||
|
||||
var desiredFacing = Util.GetFacing(dist, unit.Facing);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
||||
if (!target.IsValid) return;
|
||||
if (self.GetCurrentActivity() is Leap) return;
|
||||
|
||||
var weapon = self.GetPrimaryWeapon();
|
||||
var weapon = self.traits.Get<AttackBase>().Weapons[0].Info;
|
||||
if (weapon.Range * Game.CellSize * weapon.Range * Game.CellSize
|
||||
< (target.CenterLocation - self.CenterLocation).LengthSquared) return;
|
||||
|
||||
|
||||
@@ -126,6 +126,9 @@ namespace OpenRA.Mods.RA
|
||||
facing = 0
|
||||
};
|
||||
|
||||
if (args.weapon.Report != null)
|
||||
Sound.Play(args.weapon.Report + ".aud", pos);
|
||||
|
||||
DoImpacts(args);
|
||||
}
|
||||
|
||||
@@ -176,17 +179,6 @@ namespace OpenRA.Mods.RA
|
||||
return true;
|
||||
}
|
||||
|
||||
public static WeaponInfo GetPrimaryWeapon(this Actor self)
|
||||
{
|
||||
var info = self.Info.Traits.GetOrDefault<AttackBaseInfo>();
|
||||
if (info == null) return null;
|
||||
|
||||
var weapon = info.PrimaryWeapon;
|
||||
if (weapon == null) return null;
|
||||
|
||||
return Rules.Weapons[weapon.ToLowerInvariant()];
|
||||
}
|
||||
|
||||
static float2 GetRecoil(Actor self, float recoil)
|
||||
{
|
||||
var abInfo = self.Info.Traits.GetOrDefault<AttackBaseInfo>();
|
||||
|
||||
@@ -40,9 +40,6 @@ namespace OpenRA.Mods.RA
|
||||
self.World.AddFrameEndTask( w =>
|
||||
{
|
||||
Combat.DoExplosion(self, info.PrimaryWeapon, self.CenterLocation, altitude);
|
||||
var report = self.GetPrimaryWeapon().Report;
|
||||
if (report != null)
|
||||
Sound.Play(report + ".aud", self.CenterLocation);
|
||||
|
||||
// Remove from world
|
||||
self.Kill(self);
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
self.World.WorldRenderer.DrawRangeCircle(
|
||||
Color.FromArgb(128, Color.Yellow),
|
||||
self.CenterLocation, (int)self.GetPrimaryWeapon().Range);
|
||||
self.CenterLocation, (int)self.traits.Get<AttackBase>().GetMaximumRange());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user