Always make sure to be on the host actor when repairing
This commit is contained in:
@@ -53,11 +53,12 @@ namespace OpenRA.Mods.Cnc.Activities
|
|||||||
if (rearmTarget == null)
|
if (rearmTarget == null)
|
||||||
return new Wait(20);
|
return new Wait(20);
|
||||||
|
|
||||||
|
// Add a CloseEnough range of 512 to the Repair activity in order to ensure that we're at the host actor
|
||||||
return ActivityUtils.SequenceActivities(
|
return ActivityUtils.SequenceActivities(
|
||||||
new MoveAdjacentTo(self, Target.FromActor(rearmTarget)),
|
new MoveAdjacentTo(self, Target.FromActor(rearmTarget)),
|
||||||
movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), rearmTarget),
|
movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), rearmTarget),
|
||||||
new Rearm(self),
|
new Rearm(self),
|
||||||
new Repair(self, rearmTarget),
|
new Repair(self, rearmTarget, new WDist(512)),
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,17 +19,14 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
public class Repair : Activity
|
public class Repair : Activity
|
||||||
{
|
{
|
||||||
|
readonly Health health;
|
||||||
readonly RepairsUnits[] allRepairsUnits;
|
readonly RepairsUnits[] allRepairsUnits;
|
||||||
readonly Target host;
|
readonly Target host;
|
||||||
readonly WDist closeEnough;
|
readonly WDist closeEnough;
|
||||||
|
|
||||||
int remainingTicks;
|
int remainingTicks;
|
||||||
Health health;
|
|
||||||
bool played = false;
|
bool played = false;
|
||||||
|
|
||||||
public Repair(Actor self, Actor host)
|
|
||||||
: this(self, host, WDist.Zero) { }
|
|
||||||
|
|
||||||
public Repair(Actor self, Actor host, WDist closeEnough)
|
public Repair(Actor self, Actor host, WDist closeEnough)
|
||||||
{
|
{
|
||||||
this.host = Target.FromActor(host);
|
this.host = Target.FromActor(host);
|
||||||
|
|||||||
@@ -391,8 +391,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var name = a.Info.Name;
|
var name = a.Info.Name;
|
||||||
if (Info.RearmBuildings.Contains(name))
|
if (Info.RearmBuildings.Contains(name))
|
||||||
yield return new Rearm(self);
|
yield return new Rearm(self);
|
||||||
|
|
||||||
|
// Add a CloseEnough range of 512 to ensure we're at the host actor
|
||||||
if (Info.RepairBuildings.Contains(name))
|
if (Info.RepairBuildings.Contains(name))
|
||||||
yield return new Repair(self, a);
|
yield return new Repair(self, a, new WDist(512));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ModifyDeathActorInit(Actor self, TypeDictionary init)
|
public void ModifyDeathActorInit(Actor self, TypeDictionary init)
|
||||||
|
|||||||
@@ -114,7 +114,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (CanRearmAt(order.TargetActor) && CanRearm())
|
if (CanRearmAt(order.TargetActor) && CanRearm())
|
||||||
self.QueueActivity(new Rearm(self));
|
self.QueueActivity(new Rearm(self));
|
||||||
|
|
||||||
self.QueueActivity(new Repair(self, order.TargetActor));
|
// Add a CloseEnough range of 512 to ensure we're at the host actor
|
||||||
|
self.QueueActivity(new Repair(self, order.TargetActor, new WDist(512)));
|
||||||
|
|
||||||
var rp = order.TargetActor.TraitOrDefault<RallyPoint>();
|
var rp = order.TargetActor.TraitOrDefault<RallyPoint>();
|
||||||
if (rp != null)
|
if (rp != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user