added a new hotkey to cycle production buildings except conyards
This commit is contained in:
@@ -157,6 +157,7 @@ namespace OpenRA.GameRules
|
|||||||
|
|
||||||
public Hotkey NextProductionTabKey = new Hotkey(Keycode.PAGEDOWN, Modifiers.None);
|
public Hotkey NextProductionTabKey = new Hotkey(Keycode.PAGEDOWN, Modifiers.None);
|
||||||
public Hotkey PreviousProductionTabKey = new Hotkey(Keycode.PAGEUP, Modifiers.None);
|
public Hotkey PreviousProductionTabKey = new Hotkey(Keycode.PAGEUP, Modifiers.None);
|
||||||
|
public Hotkey CycleProductionBuildingsKey = new Hotkey(Keycode.TAB, Modifiers.None);
|
||||||
|
|
||||||
public Hotkey ToggleStatusBarsKey = new Hotkey(Keycode.INSERT, Modifiers.None);
|
public Hotkey ToggleStatusBarsKey = new Hotkey(Keycode.INSERT, Modifiers.None);
|
||||||
|
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
{ "NextProductionTabKey", "Next production tab" },
|
{ "NextProductionTabKey", "Next production tab" },
|
||||||
{ "PreviousProductionTabKey", "Previous production tab" },
|
{ "PreviousProductionTabKey", "Previous production tab" },
|
||||||
|
{ "CycleProductionBuildingsKey", "Cycle production facilities" },
|
||||||
|
|
||||||
{ "ToggleStatusBarsKey", "Toggle status bars" },
|
{ "ToggleStatusBarsKey", "Toggle status bars" },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,9 +47,13 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
{
|
{
|
||||||
var key = Hotkey.FromKeyInput(e);
|
var key = Hotkey.FromKeyInput(e);
|
||||||
var ks = Game.Settings.Keys;
|
var ks = Game.Settings.Keys;
|
||||||
|
|
||||||
if (key == ks.CycleBaseKey)
|
if (key == ks.CycleBaseKey)
|
||||||
return CycleBases();
|
return CycleBases();
|
||||||
|
|
||||||
|
if (key == ks.CycleProductionBuildingsKey)
|
||||||
|
return CycleProductionBuildings();
|
||||||
|
|
||||||
if (key == ks.ToLastEventKey)
|
if (key == ks.ToLastEventKey)
|
||||||
return ToLastEvent();
|
return ToLastEvent();
|
||||||
|
|
||||||
@@ -199,6 +203,29 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
return ToSelection();
|
return ToSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CycleProductionBuildings()
|
||||||
|
{
|
||||||
|
var facilities = world.ActorsWithTrait<Production>()
|
||||||
|
.Where(a => a.Actor.Owner == world.LocalPlayer && !a.Actor.HasTrait<BaseBuilding>())
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
if (!facilities.Any())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
var next = facilities
|
||||||
|
.Select(b => b.Actor)
|
||||||
|
.SkipWhile(b => !world.Selection.Actors.Contains(b))
|
||||||
|
.Skip(1)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (next == null)
|
||||||
|
next = facilities.Select(b => b.Actor).First();
|
||||||
|
|
||||||
|
world.Selection.Combine(world, new Actor[] { next }, false, true);
|
||||||
|
|
||||||
|
return ToSelection();
|
||||||
|
}
|
||||||
|
|
||||||
bool ToLastEvent()
|
bool ToLastEvent()
|
||||||
{
|
{
|
||||||
if (world.LocalPlayer == null)
|
if (world.LocalPlayer == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user