add 'h' hotkey to cycle through bases (fact/mcv)

This commit is contained in:
Chris Forbes
2010-05-03 17:47:08 +12:00
parent b47317f9db
commit 8c4502429c
5 changed files with 28 additions and 0 deletions

View File

@@ -146,5 +146,23 @@ namespace OpenRA
public void SetModifiers(Modifiers mods) { modifiers = mods; } public void SetModifiers(Modifiers mods) { modifiers = mods; }
public Modifiers GetModifiers() { return modifiers; } 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);
}
} }
} }

View File

@@ -500,6 +500,9 @@ namespace OpenRA
if (c >= '0' && c <= '9') if (c >= '0' && c <= '9')
Game.controller.selection.DoControlGroup(world, Game.controller.selection.DoControlGroup(world,
c - '0', modifiers); c - '0', modifiers);
if (c == 'h')
Game.controller.GotoNextBase();
} }
if( sync != Game.world.SyncHash() ) if( sync != Game.world.SyncHash() )

View File

@@ -71,4 +71,9 @@ namespace OpenRA.Traits
class MustBeDestroyedInfo : TraitInfo<MustBeDestroyed> { } class MustBeDestroyedInfo : TraitInfo<MustBeDestroyed> { }
class MustBeDestroyed { } class MustBeDestroyed { }
/* tag trait for "bases": mcv/fact */
class BaseBuildingInfo : TraitInfo<BaseBuilding> { }
class BaseBuilding { }
} }

View File

@@ -415,6 +415,7 @@ FACT:
Description: Construction Yard Description: Construction Yard
CustomSellValue: CustomSellValue:
Value: 2500 Value: 2500
BaseBuilding:
PROC: PROC:
Inherits: ^Building Inherits: ^Building

View File

@@ -280,6 +280,7 @@ MCV:
NoTransformSounds: nodeply1.aud NoTransformSounds: nodeply1.aud
RenderUnit: RenderUnit:
MustBeDestroyed: MustBeDestroyed:
BaseBuilding:
JEEP: JEEP:
Inherits: ^Vehicle Inherits: ^Vehicle