Fix custom order generators for left-click targeting.
This commit is contained in:
@@ -58,5 +58,11 @@ namespace OpenRA.Orders
|
||||
{
|
||||
return world.Map.Contains(cell) ? Cursor : "generic-blocked";
|
||||
}
|
||||
|
||||
public override bool InputOverridesSelection(World world, int2 xy, MouseInput mi)
|
||||
{
|
||||
// Custom order generators always override selection
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Orders
|
||||
}
|
||||
|
||||
// Used for classic mouse orders, determines whether or not action at xy is move or select
|
||||
public static bool InputOverridesSelection(World world, int2 xy, MouseInput mi)
|
||||
public virtual bool InputOverridesSelection(World world, int2 xy, MouseInput mi)
|
||||
{
|
||||
var actor = world.ScreenMap.ActorsAt(xy).WithHighestSelectionPriority(xy);
|
||||
if (actor == null)
|
||||
@@ -95,8 +95,19 @@ namespace OpenRA.Orders
|
||||
var underCursor = world.Selection.Actors.WithHighestSelectionPriority(xy);
|
||||
|
||||
var o = OrderForUnit(underCursor, target, actorsAt, cell, mi);
|
||||
if (o != null && o.Order.OverrideSelection)
|
||||
return true;
|
||||
if (o != null)
|
||||
{
|
||||
var modifiers = TargetModifiers.None;
|
||||
if (mi.Modifiers.HasModifier(Modifiers.Ctrl))
|
||||
modifiers |= TargetModifiers.ForceAttack;
|
||||
if (mi.Modifiers.HasModifier(Modifiers.Shift))
|
||||
modifiers |= TargetModifiers.ForceQueue;
|
||||
if (mi.Modifiers.HasModifier(Modifiers.Alt))
|
||||
modifiers |= TargetModifiers.ForceMove;
|
||||
|
||||
if (o.Order.TargetOverridesSelection(modifiers))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user