From aadfcdac66e33dd1bddf1478ac280dd69166bcf8 Mon Sep 17 00:00:00 2001 From: Andre Mohren Date: Wed, 25 Oct 2017 22:50:04 +0200 Subject: [PATCH] Allow RallyPoint cursor to be defined via Yaml --- OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs index 5cd55b50b6..8e54d92ab0 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RallyPoint.cs @@ -23,6 +23,8 @@ namespace OpenRA.Mods.Common.Traits [SequenceReference("Image")] public readonly string FlagSequence = "flag"; [SequenceReference("Image")] public readonly string CirclesSequence = "circles"; + public readonly string Cursor = "ability"; + [Desc("Custom indicator palette name")] [PaletteReference("IsPlayerPalette")] public readonly string Palette = "player"; @@ -71,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits public IEnumerable Orders { - get { yield return new RallyPointOrderTargeter(); } + get { yield return new RallyPointOrderTargeter(Info.Cursor); } } public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) @@ -96,6 +98,13 @@ namespace OpenRA.Mods.Common.Traits class RallyPointOrderTargeter : IOrderTargeter { + readonly string cursor; + + public RallyPointOrderTargeter(string cursor) + { + this.cursor = cursor; + } + public string OrderID { get { return "SetRallyPoint"; } } public int OrderPriority { get { return 0; } } public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; } @@ -109,7 +118,7 @@ namespace OpenRA.Mods.Common.Traits var location = self.World.Map.CellContaining(target.CenterPosition); if (self.World.Map.Contains(location)) { - cursor = "ability"; + cursor = this.cursor; // Notify force-set 'RallyPoint' order watchers with Ctrl and only if this is the only building of its type selected if (modifiers.HasModifier(TargetModifiers.ForceAttack))