add support for WeaponInfo.MinRange

This commit is contained in:
Chris Forbes
2010-10-06 17:41:52 +13:00
parent ce5cf93077
commit 8cb7a7b8ce
2 changed files with 4 additions and 0 deletions

View File

@@ -93,6 +93,7 @@ namespace OpenRA.GameRules
[FieldLoader.Load] public readonly bool Underwater = false;
[FieldLoader.Load] public readonly string[] ValidTargets = { "Ground" };
[FieldLoader.Load] public readonly int BurstDelay = 5;
[FieldLoader.Load] public readonly float MinRange = 0;
[FieldLoader.LoadUsing( "LoadProjectile" )] public IProjectileInfo Projectile;
[FieldLoader.LoadUsing( "LoadWarheads" )] public List<WarheadInfo> Warheads;

View File

@@ -124,6 +124,9 @@ namespace OpenRA.Mods.RA
if (w.Info.Range * w.Info.Range * Game.CellSize * Game.CellSize
< (target.CenterLocation - self.CenterLocation).LengthSquared) return false;
if (w.Info.MinRange * w.Info.MinRange * Game.CellSize * Game.CellSize >
(target.CenterLocation - self.CenterLocation).LengthSquared) return false;
if (!w.IsValidAgainst(target)) return false;
var barrel = w.Barrels[w.Burst % w.Barrels.Length];