Support a maximum building range (Fixes #2156).
This also implements support for a per-provider cooldown between placing structures, allowing mods with multiple structure queues to rate-limit placement around a single provider. An initial delay parameter is included to support units that deploy into a base provider and require an initial setup time (e.g. the Surveyor unit from C&C TW). The range and time restrictions are not applied to walls as a balance choice.
This commit is contained in:
@@ -80,6 +80,22 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
queue.FinishProduction();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GetNumBuildables(self.Owner) > prevItems)
|
||||
w.Add(new DelayedAction(10,
|
||||
() => Sound.PlayNotification(order.Player, "Speech", "NewOptions", order.Player.Country.Race)));
|
||||
|
||||
Reference in New Issue
Block a user