1 #region Copyright & License Information 2 /* 3 * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) 4 * This file is part of OpenRA, which is free software. It is made 5 * available to you under the terms of the GNU General Public License 6 * as published by the Free Software Foundation, either version 3 of 7 * the License, or (at your option) any later version. For more 8 * information, see COPYING. 9 */ 10 #endregion 11 12 using System; 13 using System.Collections.Generic; 14 using OpenRA.Traits; 15 16 namespace OpenRA.Mods.Common.Orders 17 { 18 public class DeployOrderTargeter : IOrderTargeter 19 { 20 readonly Func<string> cursor; 21 DeployOrderTargeter(string order, int priority)22 public DeployOrderTargeter(string order, int priority) 23 : this(order, priority, () => "deploy") 24 { 25 } 26 DeployOrderTargeter(string order, int priority, Func<string> cursor)27 public DeployOrderTargeter(string order, int priority, Func<string> cursor) 28 { 29 OrderID = order; 30 OrderPriority = priority; 31 this.cursor = cursor; 32 } 33 34 public string OrderID { get; private set; } 35 public int OrderPriority { get; private set; } TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers)36 public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; } 37 CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)38 public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor) 39 { 40 if (target.Type != TargetType.Actor) 41 return false; 42 43 IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue); 44 cursor = this.cursor(); 45 46 return self == target.Actor; 47 } 48 49 public bool IsQueued { get; protected set; } 50 } 51 } 52