Make 'CloseEnough' on 'RepairableNear' use WDist
This commit is contained in:
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
class RepairableNearInfo : ITraitInfo, Requires<HealthInfo>, Requires<IMoveInfo>
|
||||
{
|
||||
[ActorReference] public readonly HashSet<string> Buildings = new HashSet<string> { "spen", "syrd" };
|
||||
public readonly int CloseEnough = 4;
|
||||
public readonly WDist CloseEnough = WDist.FromCells(4);
|
||||
[VoiceReference] public readonly string Voice = "Action";
|
||||
|
||||
public object Create(ActorInitializer init) { return new RepairableNear(init.Self, this); }
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var target = Target.FromOrder(self.World, order);
|
||||
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(movement.MoveWithinRange(target, new WDist(1024 * info.CloseEnough)));
|
||||
self.QueueActivity(movement.MoveWithinRange(target, info.CloseEnough));
|
||||
self.QueueActivity(new Repair(order.TargetActor));
|
||||
|
||||
self.SetTargetLine(target, Color.Green, false);
|
||||
|
||||
@@ -2683,6 +2683,17 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
// 'CloseEnough' on 'RepairableNear' uses WDist now
|
||||
if (engineVersion < 20151214)
|
||||
{
|
||||
if (node.Key == "RepairableNear")
|
||||
{
|
||||
var ce = node.Value.Nodes.FirstOrDefault(n => n.Key == "CloseEnough");
|
||||
if (ce != null && !ce.Value.Value.Contains("c"))
|
||||
ce.Value.Value = ce.Value.Value + "c0";
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user