Skip to content

Commit

Permalink
add 'h' hotkey to cycle through bases (fact/mcv)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisforbes committed May 3, 2010
1 parent b47317f commit 8c45024
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions OpenRA.Game/Controller.cs
Expand Up @@ -146,5 +146,23 @@ public string ChooseCursor( World world )

public void SetModifiers(Modifiers mods) { modifiers = mods; }
public Modifiers GetModifiers() { return modifiers; }

public void GotoNextBase()
{
var bases = Game.world.Queries.OwnedBy[Game.world.LocalPlayer].WithTrait<BaseBuilding>().ToArray();
if (!bases.Any()) return;

var next = bases
.Select( b => b.Actor )
.SkipWhile(b => Game.controller.selection.Actors.Contains(b))
.Skip(1)
.FirstOrDefault();

if (next == null)
next = bases.Select(b => b.Actor).First();

Game.controller.selection.Combine(Game.world, new Actor[] { next }, false, true);
Game.viewport.Center(Game.controller.selection.Actors);
}
}
}
3 changes: 3 additions & 0 deletions OpenRA.Game/Game.cs
Expand Up @@ -500,6 +500,9 @@ public static void HandleKeyPress( KeyPressEventArgs e, Modifiers modifiers )
if (c >= '0' && c <= '9')
Game.controller.selection.DoControlGroup(world,
c - '0', modifiers);

if (c == 'h')
Game.controller.GotoNextBase();
}

if( sync != Game.world.SyncHash() )
Expand Down
5 changes: 5 additions & 0 deletions OpenRA.Game/Traits/Player/VictoryConditions.cs
Expand Up @@ -71,4 +71,9 @@ void Surrender(Actor self)

class MustBeDestroyedInfo : TraitInfo<MustBeDestroyed> { }
class MustBeDestroyed { }

/* tag trait for "bases": mcv/fact */

class BaseBuildingInfo : TraitInfo<BaseBuilding> { }
class BaseBuilding { }
}
1 change: 1 addition & 0 deletions mods/ra/structures.yaml
Expand Up @@ -415,6 +415,7 @@ FACT:
Description: Construction Yard
CustomSellValue:
Value: 2500
BaseBuilding:

PROC:
Inherits: ^Building
Expand Down
1 change: 1 addition & 0 deletions mods/ra/vehicles.yaml
Expand Up @@ -280,6 +280,7 @@ MCV:
NoTransformSounds: nodeply1.aud
RenderUnit:
MustBeDestroyed:
BaseBuilding:

JEEP:
Inherits: ^Vehicle
Expand Down

0 comments on commit 8c45024

Please sign in to comment.