Draw targeting lines for player-issued orders. Can force-display targets with [alt].

This commit is contained in:
Paul Chote
2010-07-26 12:01:13 +12:00
parent 130b4d29b4
commit e8adc357e9
14 changed files with 189 additions and 18 deletions

View File

@@ -13,7 +13,8 @@ using System.Linq;
using OpenRA.Effects;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
using OpenRA.Traits.Activities;
using OpenRA.Traits.Activities;
using System.Drawing;
namespace OpenRA.Mods.RA
{
@@ -122,7 +123,13 @@ namespace OpenRA.Mods.RA
if (order.OrderString == "Harvest")
{
if (self.Owner == self.World.LocalPlayer)
self.World.AddFrameEndTask(w => w.Add(new MoveFlash(self.World, order.TargetLocation)));
self.World.AddFrameEndTask(w =>
{
w.Add(new MoveFlash(self.World, order.TargetLocation));
var line = self.traits.GetOrDefault<DrawLineToTarget>();
if (line != null)
line.SetTarget(self, order.TargetLocation, Color.Red);
});
self.CancelActivity();
self.QueueActivity(new Move(order.TargetLocation, 0));
@@ -142,7 +149,13 @@ namespace OpenRA.Mods.RA
return;
if (self.Owner == self.World.LocalPlayer)
self.World.AddFrameEndTask(w => w.Add(new FlashTarget(order.TargetActor)));
self.World.AddFrameEndTask(w =>
{
w.Add(new FlashTarget(order.TargetActor));
var line = self.traits.GetOrDefault<DrawLineToTarget>();
if (line != null)
line.SetTarget(self, order.TargetActor, Color.Green);
});
self.CancelActivity();
self.QueueActivity(new DeliverResources());