Merge pull request #11008 from pchote/left-click-guard-fix
Fix order generator vs unit targeting under left click orders.
This commit is contained in:
@@ -100,9 +100,13 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
if (!IsValidDragbox && World.Selection.Actors.Any() && !multiClick)
|
if (!IsValidDragbox && World.Selection.Actors.Any() && !multiClick)
|
||||||
{
|
{
|
||||||
if (!(World.ScreenMap.ActorsAt(mousePos).Any(x => x.Info.HasTraitInfo<SelectableInfo>() &&
|
var selectableActor = World.ScreenMap.ActorsAt(mousePos).Any(x =>
|
||||||
(x.Owner.IsAlliedWith(World.RenderPlayer) || !World.FogObscures(x))) && !mi.Modifiers.HasModifier(Modifiers.Ctrl) &&
|
x.Info.HasTraitInfo<SelectableInfo>() && (x.Owner.IsAlliedWith(World.RenderPlayer) || !World.FogObscures(x)));
|
||||||
!mi.Modifiers.HasModifier(Modifiers.Alt) && UnitOrderGenerator.InputOverridesSelection(World, mousePos, mi)))
|
|
||||||
|
var ignoreSelection = mi.Modifiers.HasModifier(Modifiers.Ctrl) || mi.Modifiers.HasModifier(Modifiers.Alt) ||
|
||||||
|
UnitOrderGenerator.InputOverridesSelection(World, mousePos, mi);
|
||||||
|
|
||||||
|
if (ignoreSelection || !selectableActor)
|
||||||
{
|
{
|
||||||
// Order units instead of selecting
|
// Order units instead of selecting
|
||||||
ApplyOrders(World, mi);
|
ApplyOrders(World, mi);
|
||||||
|
|||||||
@@ -23,8 +23,10 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
|
|
||||||
protected override IEnumerable<Order> OrderInner(World world, CPos xy, MouseInput mi)
|
protected override IEnumerable<Order> OrderInner(World world, CPos xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
var target = FriendlyGuardableUnits(world, mi).FirstOrDefault();
|
if (mi.Button != ExpectedButton)
|
||||||
|
yield break;
|
||||||
|
|
||||||
|
var target = FriendlyGuardableUnits(world, mi).FirstOrDefault();
|
||||||
if (target == null || Subjects.All(s => s.IsDead))
|
if (target == null || Subjects.All(s => s.IsDead))
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user