Overhaul target line rendering:
- Targets are now defined by the activities - Queued activities are shown - Support custom attack colors
This commit is contained in:
@@ -149,24 +149,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.World.AddFrameEndTask(w => self.QueueActivity(new FindAndDeliverResources(self)));
|
||||
}
|
||||
|
||||
public void SetProcLines(Actor proc)
|
||||
{
|
||||
if (proc == null || proc.IsDead)
|
||||
return;
|
||||
|
||||
var linkedHarvs = proc.World.ActorsHavingTrait<Harvester>(h => h.LinkedProc == proc)
|
||||
.Select(a => Target.FromActor(a))
|
||||
.ToList();
|
||||
|
||||
proc.SetTargetLines(linkedHarvs, Color.Gold);
|
||||
}
|
||||
|
||||
public void LinkProc(Actor self, Actor proc)
|
||||
{
|
||||
var oldProc = LinkedProc;
|
||||
LinkedProc = proc;
|
||||
SetProcLines(oldProc);
|
||||
SetProcLines(proc);
|
||||
}
|
||||
|
||||
public void UnlinkProc(Actor self, Actor proc)
|
||||
@@ -345,10 +330,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
loc = self.Location;
|
||||
}
|
||||
|
||||
self.SetTargetLine(Target.FromCell(self.World, loc), Color.Red);
|
||||
|
||||
// FindResources takes care of calling INotifyHarvesterAction
|
||||
self.QueueActivity(order.Queued, new FindAndDeliverResources(self, loc));
|
||||
self.ShowTargetLines();
|
||||
}
|
||||
else if (order.OrderString == "Deliver")
|
||||
{
|
||||
@@ -362,8 +346,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (iao == null || !iao.AllowDocking || !IsAcceptableProcType(targetActor))
|
||||
return;
|
||||
|
||||
self.SetTargetLine(order.Target, Color.Green);
|
||||
self.QueueActivity(order.Queued, new FindAndDeliverResources(self, targetActor));
|
||||
self.ShowTargetLines();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user