Fixes issues with support powers and adds property to all IOrderGenerator classes to determine priority over selection in the left-click order scheme.
This commit is contained in:
@@ -96,10 +96,10 @@ namespace OpenRA.Orders
|
|||||||
|
|
||||||
var o = OrderForUnit(underCursor, target, mi);
|
var o = OrderForUnit(underCursor, target, mi);
|
||||||
|
|
||||||
if (o == null || o.Trait is IMove)
|
if (o != null && o.Order.OverrideSelection)
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UnitOrderResult OrderForUnit(Actor self, Target target, MouseInput mi)
|
static UnitOrderResult OrderForUnit(Actor self, Target target, MouseInput mi)
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ namespace OpenRA.Traits
|
|||||||
int OrderPriority { get; }
|
int OrderPriority { get; }
|
||||||
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor);
|
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor);
|
||||||
bool IsQueued { get; }
|
bool IsQueued { get; }
|
||||||
|
bool OverrideSelection { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
||||||
|
|||||||
@@ -68,9 +68,15 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
dragStart = xy;
|
dragStart = xy;
|
||||||
|
|
||||||
// Place buildings
|
// Place buildings, use support powers, and other non-unit things
|
||||||
if (!useClassicMouseStyle || !World.Selection.Actors.Any())
|
if (!(World.OrderGenerator is UnitOrderGenerator))
|
||||||
|
{
|
||||||
ApplyOrders(World, xy, mi);
|
ApplyOrders(World, xy, mi);
|
||||||
|
dragStart = dragEnd = null;
|
||||||
|
YieldMouseFocus(mi);
|
||||||
|
lastMousePosition = xy;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Move && dragStart.HasValue)
|
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Move && dragStart.HasValue)
|
||||||
@@ -114,8 +120,6 @@ namespace OpenRA.Widgets
|
|||||||
World.Selection.Combine(World, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
|
World.Selection.Combine(World, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (useClassicMouseStyle)
|
|
||||||
ApplyOrders(World, xy, mi);
|
|
||||||
|
|
||||||
dragStart = dragEnd = null;
|
dragStart = dragEnd = null;
|
||||||
YieldMouseFocus(mi);
|
YieldMouseFocus(mi);
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
|
Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
|
||||||
var info = Info as IonCannonPowerInfo;
|
var info = Info as IonCannonPowerInfo;
|
||||||
return new SelectGenericPowerTarget(order, manager, info.Cursor, MouseButton.Left);
|
return new SelectGenericPowerTarget(order, manager, info.Cursor, MouseButton.Left);
|
||||||
|
|||||||
@@ -32,6 +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 OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
producer = queue.Actor;
|
producer = queue.Actor;
|
||||||
building = name;
|
building = name;
|
||||||
|
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
producer.World.Selection.Clear();
|
||||||
|
|
||||||
var map = producer.World.Map;
|
var map = producer.World.Map;
|
||||||
var tileset = producer.World.TileSet.Id.ToLowerInvariant();
|
var tileset = producer.World.TileSet.Id.ToLowerInvariant();
|
||||||
buildingInfo = map.Rules.Actors[building].Traits.Get<BuildingInfo>();
|
buildingInfo = map.Rules.Actors[building].Traits.Get<BuildingInfo>();
|
||||||
|
|||||||
@@ -31,6 +31,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 OverrideSelection { get { 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);
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
public string OrderID { get { return "Move"; } }
|
public string OrderID { get { return "Move"; } }
|
||||||
public int OrderPriority { get { return 4; } }
|
public int OrderPriority { get { return 4; } }
|
||||||
|
public bool OverrideSelection { get { return false; } }
|
||||||
|
|
||||||
readonly AircraftInfo info;
|
readonly AircraftInfo info;
|
||||||
|
|
||||||
|
|||||||
@@ -194,6 +194,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 OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
bool CanTargetActor(Actor self, Target target, TargetModifiers modifiers, ref string cursor)
|
bool CanTargetActor(Actor self, Target target, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,6 +56,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 OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -445,6 +445,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 OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -619,6 +619,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly MobileInfo unitType;
|
readonly MobileInfo unitType;
|
||||||
readonly bool rejectMove;
|
readonly bool rejectMove;
|
||||||
|
public bool OverrideSelection { get { return false; } }
|
||||||
|
|
||||||
public MoveOrderTargeter(Actor self, MobileInfo unitType)
|
public MoveOrderTargeter(Actor self, MobileInfo unitType)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public SelectTarget(World world, string order, SupportPowerManager manager, GrantUpgradePower power)
|
public SelectTarget(World world, string order, SupportPowerManager manager, GrantUpgradePower power)
|
||||||
{
|
{
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.power = power;
|
this.power = power;
|
||||||
|
|||||||
@@ -239,6 +239,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button)
|
public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button)
|
||||||
{
|
{
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.cursor = cursor;
|
this.cursor = cursor;
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ namespace OpenRA.Mods.RA.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 OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ namespace OpenRA.Mods.RA.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 OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
|
|
||||||
public SelectTarget(World world, string order, SupportPowerManager manager, ChronoshiftPower power)
|
public SelectTarget(World world, string order, SupportPowerManager manager, ChronoshiftPower power)
|
||||||
{
|
{
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.power = power;
|
this.power = power;
|
||||||
|
|||||||
Reference in New Issue
Block a user