Disable Move OrderTargeter if the Move order is rejected.
This commit is contained in:
committed by
Matthias Mailänder
parent
7d19e25627
commit
512358eb72
@@ -251,7 +251,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
self.World.ScreenMap.Remove(self);
|
self.World.ScreenMap.Remove(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IOrderTargeter> Orders { get { yield return new MoveOrderTargeter(Info); } }
|
public IEnumerable<IOrderTargeter> Orders { get { yield return new MoveOrderTargeter(self, Info); } }
|
||||||
|
|
||||||
// Note: Returns a valid order even if the unit can't move to the target
|
// Note: Returns a valid order even if the unit can't move to the target
|
||||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||||
@@ -504,10 +504,12 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
class MoveOrderTargeter : IOrderTargeter
|
class MoveOrderTargeter : IOrderTargeter
|
||||||
{
|
{
|
||||||
readonly MobileInfo unitType;
|
readonly MobileInfo unitType;
|
||||||
|
readonly bool rejectMove;
|
||||||
|
|
||||||
public MoveOrderTargeter(MobileInfo unitType)
|
public MoveOrderTargeter(Actor self, MobileInfo unitType)
|
||||||
{
|
{
|
||||||
this.unitType = unitType;
|
this.unitType = unitType;
|
||||||
|
this.rejectMove = !self.AcceptsOrder("Move");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string OrderID { get { return "Move"; } }
|
public string OrderID { get { return "Move"; } }
|
||||||
@@ -516,7 +518,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
if (!target.IsValidFor(self))
|
if (rejectMove || !target.IsValidFor(self))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var location = target.CenterPosition.ToCPos();
|
var location = target.CenterPosition.ToCPos();
|
||||||
|
|||||||
Reference in New Issue
Block a user