Convert BaseProvider range check to world coords.

This commit is contained in:
Paul Chote
2013-07-06 16:10:31 +12:00
parent d631f1b06b
commit 39e699d119
7 changed files with 25 additions and 30 deletions

View File

@@ -83,18 +83,11 @@ namespace OpenRA.Mods.RA
if (buildingInfo.RequiresBaseProvider)
{
var center = buildingInfo.CenterLocation(order.TargetLocation);
foreach (var bp in w.ActorsWithTrait<BaseProvider>())
{
if (bp.Actor.Owner.Stances[self.Owner] != Stance.Ally || !bp.Trait.Ready())
continue;
if (Combat.IsInRange(center, bp.Trait.Info.Range, bp.Actor.CenterLocation))
{
bp.Trait.BeginCooldown();
break;
}
}
// May be null if the build anywhere cheat is active
// BuildingInfo.IsCloseEnoughToBase has already verified that this is a valid build location
var producer = buildingInfo.FindBaseProvider(w, self.Owner, order.TargetLocation);
if (producer != null)
producer.Trait<BaseProvider>().BeginCooldown();
}
if (GetNumBuildables(self.Owner) > prevItems)