Ditto for RallyPoint.
This commit is contained in:
@@ -20,15 +20,15 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
{
|
{
|
||||||
readonly Actor building;
|
readonly Actor building;
|
||||||
readonly RA.RallyPoint rp;
|
readonly RA.RallyPoint rp;
|
||||||
readonly RenderSimple rs;
|
readonly string palettePrefix;
|
||||||
public Animation flag = new Animation("rallypoint");
|
public Animation flag = new Animation("rallypoint");
|
||||||
public Animation circles = new Animation("rallypoint");
|
public Animation circles = new Animation("rallypoint");
|
||||||
|
|
||||||
public RallyPoint(Actor building)
|
public RallyPoint(Actor building, string palettePrefix)
|
||||||
{
|
{
|
||||||
this.building = building;
|
this.building = building;
|
||||||
rp = building.Trait<RA.RallyPoint>();
|
rp = building.Trait<RA.RallyPoint>();
|
||||||
rs = building.Trait<RenderSimple>();
|
this.palettePrefix = palettePrefix;
|
||||||
flag.PlayRepeating("flag");
|
flag.PlayRepeating("flag");
|
||||||
circles.Play("circles");
|
circles.Play("circles");
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
&& building.World.Selection.Actors.Contains(building))
|
&& building.World.Selection.Actors.Contains(building))
|
||||||
{
|
{
|
||||||
var pos = Traits.Util.CenterOfCell(rp.rallyPoint);
|
var pos = Traits.Util.CenterOfCell(rp.rallyPoint);
|
||||||
var palette = rs.Palette(building.Owner, wr);
|
var palette = wr.Palette(palettePrefix+building.Owner.InternalName);
|
||||||
|
|
||||||
yield return new Renderable(circles.Image,
|
yield return new Renderable(circles.Image,
|
||||||
pos.ToFloat2() - .5f * circles.Image.size,
|
pos.ToFloat2() - .5f * circles.Image.size,
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class RallyPointInfo : ITraitInfo, Requires<RenderSimpleInfo>
|
public class RallyPointInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int[] RallyPoint = { 1, 3 };
|
public readonly int[] RallyPoint = { 1, 3 };
|
||||||
|
public readonly string IndicatorPalettePrefix = "player";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new RallyPoint(init.self); }
|
public object Create(ActorInitializer init) { return new RallyPoint(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RallyPoint : IIssueOrder, IResolveOrder, ISync
|
public class RallyPoint : IIssueOrder, IResolveOrder, ISync
|
||||||
@@ -26,11 +27,10 @@ namespace OpenRA.Mods.RA
|
|||||||
[Sync] public CPos rallyPoint;
|
[Sync] public CPos rallyPoint;
|
||||||
public int nearEnough = 1;
|
public int nearEnough = 1;
|
||||||
|
|
||||||
public RallyPoint(Actor self)
|
public RallyPoint(Actor self, RallyPointInfo info)
|
||||||
{
|
{
|
||||||
var info = self.Info.Traits.Get<RallyPointInfo>();
|
|
||||||
rallyPoint = self.Location + new CVec(info.RallyPoint[0], info.RallyPoint[1]);
|
rallyPoint = self.Location + new CVec(info.RallyPoint[0], info.RallyPoint[1]);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Effects.RallyPoint(self)));
|
self.World.AddFrameEndTask(w => w.Add(new Effects.RallyPoint(self, info.IndicatorPalettePrefix)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IOrderTargeter> Orders
|
public IEnumerable<IOrderTargeter> Orders
|
||||||
|
|||||||
Reference in New Issue
Block a user