limited ammo support

This commit is contained in:
Chris Forbes
2009-12-28 18:14:40 +13:00
parent fb38f64c8b
commit 482edb086a
3 changed files with 35 additions and 0 deletions

View File

@@ -91,6 +91,11 @@ namespace OpenRa.Game.Traits
bool CheckFire(Actor self, Unit unit, string weaponName, ref int fireDelay, int[] offset, ref int burst)
{
if (fireDelay > 0) return false;
var limitedAmmo = self.traits.GetOrDefault<LimitedAmmo>();
if (!limitedAmmo.HasAmmo())
return false;
var weapon = Rules.WeaponInfo[weaponName];
if (weapon.Range * weapon.Range < (target.Location - self.Location).LengthSquared) return false;