Moved: AutoAttack key handling out of core => RA

Added: AttackMoveInteraction to RA & CNC rules
This commit is contained in:
geckosoft
2010-11-10 07:10:13 +01:00
committed by Bob
parent ebca421856
commit 5608756a24
5 changed files with 36 additions and 12 deletions

View File

@@ -142,22 +142,10 @@ namespace OpenRA.Widgets
handled = (t.KeyPressed(world.WorldActor, e)) ? true : handled;
if (handled) return true;
if (e.KeyChar == 'a')
{
StartAttackMoveOrder();
return true;
}
}
return false;
}
public void StartAttackMoveOrder()
{
if (world.Selection.Actors.Count() > 0)
world.OrderGenerator = new GenericSelectTarget(world.Selection.Actors, "AttackMove", "attackmove");
}
IEnumerable<Actor> SelectActorsInBox(World world, float2 a, float2 b)
{
return world.FindUnits(a, b)

View File

@@ -289,6 +289,7 @@
<Compile Include="NullLoadScreen.cs" />
<Compile Include="Activities\IdleAnimation.cs" />
<Compile Include="IdleAnimation.cs" />
<Compile Include="World\AttackMoveInteraction.cs" />
<Compile Include="World\GotoNextBase.cs" />
<Compile Include="World\SmudgeLayer.cs" />
<Compile Include="Scripting\Media.cs" />

View File

@@ -0,0 +1,33 @@
using System.Linq;
using OpenRA.Orders;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public class AttackMoveInteractionInfo : TraitInfo<AttackMoveInteraction>
{
}
public class AttackMoveInteraction : INotifyKeyPress
{
public bool KeyPressed(Actor self, KeyInput e)
{
if (self.World.LocalPlayer == null) return false;
if (e.KeyChar == 'a')
{
StartAttackMoveOrder(self.World);
return true;
}
return false;
}
public static void StartAttackMoveOrder(World world)
{
if (world.Selection.Actors.Count() > 0)
world.OrderGenerator = new GenericSelectTarget(world.Selection.Actors, "AttackMove", "attackmove");
}
}
}

View File

@@ -184,6 +184,7 @@ World:
PathFinder:
ValidateOrder:
GotoNextBase:
AttackMoveInteraction:
CRATE:
Tooltip:

View File

@@ -228,6 +228,7 @@ World:
EndMessage: The game will end in {0} seconds.
ValidateOrder:
GotoNextBase:
AttackMoveInteraction:
MINP:
Mine: