Pass contextual information to TargetOverridesSelection.

This commit is contained in:
Paul Chote
2019-10-29 19:29:43 +00:00
committed by abcdefg30
parent 3d6621f7ff
commit 0e4cb53ada
14 changed files with 14 additions and 14 deletions

View File

@@ -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;
} }

View File

@@ -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); }

View File

@@ -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)
{ {

View File

@@ -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)
{ {

View File

@@ -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)
{ {

View File

@@ -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);

View File

@@ -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);
} }

View File

@@ -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)
{ {

View File

@@ -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)

View File

@@ -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);
} }

View File

@@ -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);
} }

View File

@@ -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)
{ {

View File

@@ -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)
{ {

View File

@@ -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);
} }