Convert weapons to world coords.
This commit is contained in:
@@ -144,7 +144,7 @@ namespace OpenRA.Mods.RA
|
||||
public abstract Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove);
|
||||
|
||||
public bool HasAnyValidWeapons(Target t) { return Armaments.Any(a => a.Weapon.IsValidAgainst(t, self.World)); }
|
||||
public WRange GetMaximumRange() { return new WRange((int)(1024 * Armaments.Max(a => a.Weapon.Range))); }
|
||||
public WRange GetMaximumRange() { return Armaments.Max(a => a.Weapon.Range); }
|
||||
|
||||
public Armament ChooseArmamentForTarget(Target t) { return Armaments.FirstOrDefault(a => a.Weapon.IsValidAgainst(t, self.World)); }
|
||||
|
||||
|
||||
@@ -52,9 +52,7 @@ namespace OpenRA.Mods.RA
|
||||
if (a == null)
|
||||
return null;
|
||||
|
||||
// TODO: Define weapon ranges as WRange
|
||||
var range = new WRange(Math.Max(0,(int)(1024*a.Weapon.Range)));
|
||||
return new Activities.Attack(newTarget, range, allowMove);
|
||||
return new Activities.Attack(newTarget, a.Weapon.Range, allowMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,7 @@ namespace OpenRA.Mods.RA
|
||||
if (a == null)
|
||||
return;
|
||||
|
||||
// TODO: Define weapon ranges as WRange
|
||||
var range = new WRange((int)(1024*a.Weapon.Range));
|
||||
if (!target.IsInRange(self.CenterPosition, range))
|
||||
if (!target.IsInRange(self.CenterPosition, a.Weapon.Range))
|
||||
return;
|
||||
|
||||
self.CancelActivity();
|
||||
|
||||
@@ -31,9 +31,7 @@ namespace OpenRA.Mods.RA
|
||||
if (arm == null)
|
||||
return;
|
||||
|
||||
// TODO: Define weapon ranges as WRange
|
||||
var range = new WRange((int)(1024*arm.Weapon.Range));
|
||||
if (!target.IsInRange(self.CenterPosition, range))
|
||||
if (!target.IsInRange(self.CenterPosition, arm.Weapon.Range))
|
||||
return;
|
||||
|
||||
var facing = self.TraitOrDefault<IFacing>();
|
||||
|
||||
@@ -33,9 +33,7 @@ namespace OpenRA.Mods.RA
|
||||
if (a == null)
|
||||
return null;
|
||||
|
||||
// TODO: Define weapon ranges as WRange
|
||||
var range = new WRange(Math.Max(0, (int)(1024 * a.Weapon.Range)));
|
||||
return new Activities.Heal(newTarget, range, allowMove);
|
||||
return new Activities.Heal(newTarget, a.Weapon.Range, allowMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
if (weapon != null)
|
||||
{
|
||||
var range = WRange.FromCells(Math.Max(0, (int)weapon.Weapon.Range - RangeTolerance));
|
||||
var range = WRange.FromCells(Math.Max(0, weapon.Weapon.Range.Range / 1024 - RangeTolerance));
|
||||
|
||||
attack.Target = target;
|
||||
if (allowMove && self.HasTrait<Mobile>() && !self.Info.Traits.Get<MobileInfo>().OnRails)
|
||||
|
||||
Reference in New Issue
Block a user