Pass target line color to inner move activities.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
@@ -24,13 +25,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly WDist minRange;
|
||||
bool soundPlayed;
|
||||
|
||||
public Fly(Actor self, Target t)
|
||||
public Fly(Actor self, Target t, Color? targetLineColor = null)
|
||||
{
|
||||
aircraft = self.Trait<Aircraft>();
|
||||
target = t;
|
||||
}
|
||||
|
||||
public Fly(Actor self, Target t, WDist minRange, WDist maxRange)
|
||||
public Fly(Actor self, Target t, WDist minRange, WDist maxRange, Color? targetLineColor = null)
|
||||
: this(self, t)
|
||||
{
|
||||
this.maxRange = maxRange;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
@@ -17,17 +18,19 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public class FlyFollow : Activity
|
||||
{
|
||||
readonly Aircraft aircraft;
|
||||
readonly WDist minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly Color? targetLineColor;
|
||||
Target target;
|
||||
Aircraft aircraft;
|
||||
WDist minRange;
|
||||
WDist maxRange;
|
||||
|
||||
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange, Color? targetLineColor = null)
|
||||
{
|
||||
this.target = target;
|
||||
aircraft = self.Trait<Aircraft>();
|
||||
this.minRange = minRange;
|
||||
this.maxRange = maxRange;
|
||||
this.targetLineColor = targetLineColor;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
@@ -48,7 +51,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return this;
|
||||
}
|
||||
|
||||
return ActivityUtils.SequenceActivities(new Fly(self, target, minRange, maxRange), this);
|
||||
return ActivityUtils.SequenceActivities(new Fly(self, target, minRange, maxRange, targetLineColor: targetLineColor), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
@@ -24,13 +25,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly WDist minRange;
|
||||
bool soundPlayed;
|
||||
|
||||
public HeliFly(Actor self, Target t)
|
||||
public HeliFly(Actor self, Target t, Color? targetLineColor = null)
|
||||
{
|
||||
aircraft = self.Trait<Aircraft>();
|
||||
target = t;
|
||||
}
|
||||
|
||||
public HeliFly(Actor self, Target t, WDist minRange, WDist maxRange)
|
||||
public HeliFly(Actor self, Target t, WDist minRange, WDist maxRange, Color? targetLineColor = null)
|
||||
: this(self, t)
|
||||
{
|
||||
this.maxRange = maxRange;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
@@ -89,7 +90,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
var target = Target.FromPos(nearestResupplier.CenterPosition + randomPosition);
|
||||
|
||||
return ActivityUtils.SequenceActivities(new HeliFly(self, target, WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase), this);
|
||||
return ActivityUtils.SequenceActivities(
|
||||
new HeliFly(self, target, WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase, targetLineColor: Color.Green),
|
||||
this);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
@@ -140,7 +141,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
if (nearestResupplier != null)
|
||||
return ActivityUtils.SequenceActivities(
|
||||
new Fly(self, Target.FromActor(nearestResupplier), WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase),
|
||||
new Fly(self, Target.FromActor(nearestResupplier), WDist.Zero, aircraft.Info.WaitDistanceFromResupplyBase, targetLineColor: Color.Green),
|
||||
new FlyCircle(self, aircraft.Info.NumberOfTicksToVerifyAvailableAirport),
|
||||
this);
|
||||
else
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
@@ -104,7 +105,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
var sightRange = rs != null ? rs.Range : WDist.FromCells(2);
|
||||
|
||||
attackStatus |= AttackStatus.NeedsToMove;
|
||||
moveActivity = ActivityUtils.SequenceActivities(move.MoveWithinRange(target, sightRange), this);
|
||||
moveActivity = ActivityUtils.SequenceActivities(move.MoveWithinRange(target, sightRange, targetLineColor: Color.Red), this);
|
||||
return AttackStatus.NeedsToMove;
|
||||
}
|
||||
|
||||
@@ -128,7 +129,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return AttackStatus.UnableToAttack;
|
||||
|
||||
attackStatus |= AttackStatus.NeedsToMove;
|
||||
moveActivity = ActivityUtils.SequenceActivities(move.MoveWithinRange(target, minRange, maxRange), this);
|
||||
moveActivity = ActivityUtils.SequenceActivities(move.MoveWithinRange(target, minRange, maxRange, targetLineColor: Color.Red), this);
|
||||
return AttackStatus.NeedsToMove;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
@@ -22,7 +23,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly CaptureManager manager;
|
||||
|
||||
public CaptureActor(Actor self, Actor target)
|
||||
: base(self, target, EnterBehaviour.Exit)
|
||||
: base(self, target, EnterBehaviour.Exit, targetLineColor: Color.Red)
|
||||
{
|
||||
actor = target;
|
||||
manager = self.Trait<CaptureManager>();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
@@ -27,7 +28,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public Demolish(Actor self, Actor target, EnterBehaviour enterBehaviour, int delay,
|
||||
int flashes, int flashesDelay, int flashInterval)
|
||||
: base(self, target, enterBehaviour)
|
||||
: base(self, target, enterBehaviour, targetLineColor: Color.Red)
|
||||
{
|
||||
this.target = target;
|
||||
demolishables = target.TraitsImplementing<IDemolishable>().ToArray();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
|
||||
@@ -21,7 +22,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly int experience;
|
||||
|
||||
public DonateCash(Actor self, Actor target, int payload, int playerExperience)
|
||||
: base(self, target, EnterBehaviour.Dispose)
|
||||
: base(self, target, EnterBehaviour.Dispose, targetLineColor: Color.Yellow)
|
||||
{
|
||||
this.target = target;
|
||||
this.payload = payload;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
|
||||
@@ -22,7 +23,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly int playerExperience;
|
||||
|
||||
public DonateExperience(Actor self, Actor target, int level, int playerExperience, GainsExperience targetGainsExperience)
|
||||
: base(self, target, EnterBehaviour.Dispose)
|
||||
: base(self, target, EnterBehaviour.Dispose, targetLineColor: Color.Yellow)
|
||||
{
|
||||
this.target = target;
|
||||
this.level = level;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
@@ -28,6 +29,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly int maxTries = 0;
|
||||
readonly EnterBehaviour enterBehaviour;
|
||||
readonly bool repathWhileMoving;
|
||||
readonly Color? targetLineColor;
|
||||
|
||||
public Target Target { get { return target; } }
|
||||
Target target;
|
||||
@@ -37,13 +39,15 @@ namespace OpenRA.Mods.Common.Activities
|
||||
Activity inner;
|
||||
bool firstApproach = true;
|
||||
|
||||
protected Enter(Actor self, Actor target, EnterBehaviour enterBehaviour, int maxTries = 1, bool repathWhileMoving = true)
|
||||
protected Enter(Actor self, Actor target, EnterBehaviour enterBehaviour, int maxTries = 1,
|
||||
bool repathWhileMoving = true, Color? targetLineColor = null)
|
||||
{
|
||||
move = self.Trait<IMove>();
|
||||
this.target = Target.FromActor(target);
|
||||
this.maxTries = maxTries;
|
||||
this.enterBehaviour = enterBehaviour;
|
||||
this.repathWhileMoving = repathWhileMoving;
|
||||
this.targetLineColor = targetLineColor;
|
||||
}
|
||||
|
||||
// CanEnter(target) should to be true; otherwise, Enter may abort.
|
||||
@@ -183,7 +187,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
case ReserveStatus.TooFar:
|
||||
{
|
||||
var moveTarget = repathWhileMoving ? target : Target.FromPos(target.Positions.PositionClosestTo(self.CenterPosition));
|
||||
inner = move.MoveToTarget(self, moveTarget); // Approach
|
||||
inner = move.MoveToTarget(self, moveTarget, targetLineColor: targetLineColor); // Approach
|
||||
return EnterState.ApproachingOrEntering;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -23,7 +24,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
Cargo cargo;
|
||||
|
||||
public EnterTransport(Actor self, Actor transport, int maxTries = 0, bool repathWhileMoving = true)
|
||||
: base(self, transport, EnterBehaviour.Exit, maxTries, repathWhileMoving)
|
||||
: base(self, transport, EnterBehaviour.Exit, maxTries, repathWhileMoving, Color.Green)
|
||||
{
|
||||
this.transport = transport;
|
||||
this.maxTries = maxTries;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
@@ -21,12 +22,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly WDist minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly IMove move;
|
||||
readonly Color? targetLineColor;
|
||||
|
||||
public Follow(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
public Follow(Actor self, Target target, WDist minRange, WDist maxRange, Color? targetLineColor = null)
|
||||
{
|
||||
this.target = target;
|
||||
this.minRange = minRange;
|
||||
this.maxRange = maxRange;
|
||||
this.targetLineColor = targetLineColor;
|
||||
|
||||
move = self.Trait<IMove>();
|
||||
}
|
||||
@@ -37,7 +40,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return NextActivity;
|
||||
|
||||
var cachedPosition = target.CenterPosition;
|
||||
var path = move.MoveWithinRange(target, minRange, maxRange);
|
||||
var path = move.MoveWithinRange(target, minRange, maxRange, targetLineColor: targetLineColor);
|
||||
|
||||
// We are already in range, so wait until the target moves before doing anything
|
||||
if (target.IsInRange(self.CenterPosition, maxRange) && !target.IsInRange(self.CenterPosition, minRange))
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
Activity inner;
|
||||
bool repath;
|
||||
|
||||
public MoveAdjacentTo(Actor self, Target target)
|
||||
public MoveAdjacentTo(Actor self, Target target, Color? targetLineColor = null)
|
||||
{
|
||||
Target = target;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -20,8 +21,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
|
||||
public MoveWithinRange(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
: base(self, target)
|
||||
public MoveWithinRange(Actor self, Target target, WDist minRange, WDist maxRange, Color? targetLineColor = null)
|
||||
: base(self, target, targetLineColor)
|
||||
{
|
||||
this.minRange = minRange;
|
||||
this.maxRange = maxRange;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
@@ -72,7 +73,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
switch (state)
|
||||
{
|
||||
case PickupState.Intercept:
|
||||
innerActivity = movement.MoveWithinRange(Target.FromActor(cargo), WDist.FromCells(4));
|
||||
innerActivity = movement.MoveWithinRange(Target.FromActor(cargo), WDist.FromCells(4),
|
||||
targetLineColor: Color.Yellow);
|
||||
state = PickupState.LockCarryable;
|
||||
return this;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -22,7 +23,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly string notification;
|
||||
|
||||
public RepairBridge(Actor self, Actor target, EnterBehaviour enterBehaviour, string notification)
|
||||
: base(self, target, enterBehaviour)
|
||||
: base(self, target, enterBehaviour, targetLineColor: Color.Yellow)
|
||||
{
|
||||
this.target = target;
|
||||
legacyHut = target.TraitOrDefault<LegacyBridgeHut>();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Activities
|
||||
@@ -20,7 +21,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly Stance validStances;
|
||||
|
||||
public RepairBuilding(Actor self, Actor target, EnterBehaviour enterBehaviour, Stance validStances)
|
||||
: base(self, target, enterBehaviour)
|
||||
: base(self, target, enterBehaviour, targetLineColor: Color.Yellow)
|
||||
{
|
||||
this.target = target;
|
||||
this.validStances = validStances;
|
||||
|
||||
Reference in New Issue
Block a user