From 8cb7a7b8cedf9577f105596f2890bc20347b23de Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Wed, 6 Oct 2010 17:41:52 +1300 Subject: [PATCH] add support for WeaponInfo.MinRange --- OpenRA.Game/GameRules/WeaponInfo.cs | 1 + OpenRA.Mods.RA/AttackBase.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index 645261fd2f..9b19e66aa9 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -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 Warheads; diff --git a/OpenRA.Mods.RA/AttackBase.cs b/OpenRA.Mods.RA/AttackBase.cs index d1901b003e..b57959ae76 100644 --- a/OpenRA.Mods.RA/AttackBase.cs +++ b/OpenRA.Mods.RA/AttackBase.cs @@ -123,6 +123,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;