Pass contextual information to TargetOverridesSelection.
This commit is contained in:
@@ -120,7 +120,7 @@ namespace OpenRA.Orders
|
|||||||
foreach (var a in world.Selection.Actors)
|
foreach (var a in world.Selection.Actors)
|
||||||
{
|
{
|
||||||
var o = OrderForUnit(a, target, actorsAt, cell, mi);
|
var o = OrderForUnit(a, target, actorsAt, cell, mi);
|
||||||
if (o != null && o.Order.TargetOverridesSelection(modifiers))
|
if (o != null && o.Order.TargetOverridesSelection(a, target, actorsAt, cell, modifiers))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ namespace OpenRA.Traits
|
|||||||
int OrderPriority { get; }
|
int OrderPriority { get; }
|
||||||
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor);
|
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor);
|
||||||
bool IsQueued { get; }
|
bool IsQueued { get; }
|
||||||
bool TargetOverridesSelection(TargetModifiers modifiers);
|
bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
{
|
{
|
||||||
public string OrderID { get { return "BeginMinefield"; } }
|
public string OrderID { get { return "BeginMinefield"; } }
|
||||||
public int OrderPriority { get { return 5; } }
|
public int OrderPriority { get { return 5; } }
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; }
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
public string OrderID { get { return "PortableChronoTeleport"; } }
|
public string OrderID { get { return "PortableChronoTeleport"; } }
|
||||||
public int OrderPriority { get { return 5; } }
|
public int OrderPriority { get { return 5; } }
|
||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; }
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
|
|
||||||
public string OrderID { get; private set; }
|
public string OrderID { get; private set; }
|
||||||
public int OrderPriority { get; private set; }
|
public int OrderPriority { get; private set; }
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; }
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
public string OrderID { get; private set; }
|
public string OrderID { get; private set; }
|
||||||
public int OrderPriority { get; private set; }
|
public int OrderPriority { get; private set; }
|
||||||
public bool? ForceAttack = null;
|
public bool? ForceAttack = null;
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; }
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||||
|
|
||||||
public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
|
public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
|
||||||
public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor);
|
public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor);
|
||||||
|
|||||||
@@ -1180,7 +1180,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
OrderID = "Move";
|
OrderID = "Move";
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers)
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers)
|
||||||
{
|
{
|
||||||
return modifiers.HasModifier(TargetModifiers.ForceMove);
|
return modifiers.HasModifier(TargetModifiers.ForceMove);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -436,7 +436,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public string OrderID { get; private set; }
|
public string OrderID { get; private set; }
|
||||||
public int OrderPriority { get; private set; }
|
public int OrderPriority { get; private set; }
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; }
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||||
|
|
||||||
bool CanTargetActor(Actor self, Target target, ref TargetModifiers modifiers, ref string cursor)
|
bool CanTargetActor(Actor self, Target target, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public string OrderID { get { return "SetRallyPoint"; } }
|
public string OrderID { get { return "SetRallyPoint"; } }
|
||||||
public int OrderPriority { get { return 0; } }
|
public int OrderPriority { get { return 0; } }
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; }
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||||
public bool ForceSet { get; private set; }
|
public bool ForceSet { get; private set; }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly TransformsIntoAircraft aircraft;
|
readonly TransformsIntoAircraft aircraft;
|
||||||
|
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers)
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers)
|
||||||
{
|
{
|
||||||
return modifiers.HasModifier(TargetModifiers.ForceMove);
|
return modifiers.HasModifier(TargetModifiers.ForceMove);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly TransformsIntoMobile mobile;
|
readonly TransformsIntoMobile mobile;
|
||||||
readonly bool rejectMove;
|
readonly bool rejectMove;
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers)
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers)
|
||||||
{
|
{
|
||||||
return modifiers.HasModifier(TargetModifiers.ForceMove);
|
return modifiers.HasModifier(TargetModifiers.ForceMove);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public string OrderID { get { return "DeliverUnit"; } }
|
public string OrderID { get { return "DeliverUnit"; } }
|
||||||
public int OrderPriority { get { return 6; } }
|
public int OrderPriority { get { return 6; } }
|
||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; }
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||||
|
|
||||||
public CarryallDeliverUnitTargeter(AircraftInfo aircraftInfo, CarryallInfo info)
|
public CarryallDeliverUnitTargeter(AircraftInfo aircraftInfo, CarryallInfo info)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public string OrderID { get { return "Harvest"; } }
|
public string OrderID { get { return "Harvest"; } }
|
||||||
public int OrderPriority { get { return 10; } }
|
public int OrderPriority { get { return 10; } }
|
||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers) { return true; }
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -956,7 +956,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly Mobile mobile;
|
readonly Mobile mobile;
|
||||||
readonly LocomotorInfo locomotorInfo;
|
readonly LocomotorInfo locomotorInfo;
|
||||||
readonly bool rejectMove;
|
readonly bool rejectMove;
|
||||||
public bool TargetOverridesSelection(TargetModifiers modifiers)
|
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers)
|
||||||
{
|
{
|
||||||
return modifiers.HasModifier(TargetModifiers.ForceMove);
|
return modifiers.HasModifier(TargetModifiers.ForceMove);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user