Moved: AutoAttack key handling out of core => RA
Added: AttackMoveInteraction to RA & CNC rules
This commit is contained in:
@@ -142,22 +142,10 @@ namespace OpenRA.Widgets
|
|||||||
handled = (t.KeyPressed(world.WorldActor, e)) ? true : handled;
|
handled = (t.KeyPressed(world.WorldActor, e)) ? true : handled;
|
||||||
|
|
||||||
if (handled) return true;
|
if (handled) return true;
|
||||||
|
|
||||||
if (e.KeyChar == 'a')
|
|
||||||
{
|
|
||||||
StartAttackMoveOrder();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
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)
|
IEnumerable<Actor> SelectActorsInBox(World world, float2 a, float2 b)
|
||||||
{
|
{
|
||||||
return world.FindUnits(a, b)
|
return world.FindUnits(a, b)
|
||||||
|
|||||||
@@ -289,6 +289,7 @@
|
|||||||
<Compile Include="NullLoadScreen.cs" />
|
<Compile Include="NullLoadScreen.cs" />
|
||||||
<Compile Include="Activities\IdleAnimation.cs" />
|
<Compile Include="Activities\IdleAnimation.cs" />
|
||||||
<Compile Include="IdleAnimation.cs" />
|
<Compile Include="IdleAnimation.cs" />
|
||||||
|
<Compile Include="World\AttackMoveInteraction.cs" />
|
||||||
<Compile Include="World\GotoNextBase.cs" />
|
<Compile Include="World\GotoNextBase.cs" />
|
||||||
<Compile Include="World\SmudgeLayer.cs" />
|
<Compile Include="World\SmudgeLayer.cs" />
|
||||||
<Compile Include="Scripting\Media.cs" />
|
<Compile Include="Scripting\Media.cs" />
|
||||||
|
|||||||
33
OpenRA.Mods.RA/World/AttackMoveInteraction.cs
Normal file
33
OpenRA.Mods.RA/World/AttackMoveInteraction.cs
Normal 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -184,6 +184,7 @@ World:
|
|||||||
PathFinder:
|
PathFinder:
|
||||||
ValidateOrder:
|
ValidateOrder:
|
||||||
GotoNextBase:
|
GotoNextBase:
|
||||||
|
AttackMoveInteraction:
|
||||||
|
|
||||||
CRATE:
|
CRATE:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ World:
|
|||||||
EndMessage: The game will end in {0} seconds.
|
EndMessage: The game will end in {0} seconds.
|
||||||
ValidateOrder:
|
ValidateOrder:
|
||||||
GotoNextBase:
|
GotoNextBase:
|
||||||
|
AttackMoveInteraction:
|
||||||
|
|
||||||
MINP:
|
MINP:
|
||||||
Mine:
|
Mine:
|
||||||
|
|||||||
Reference in New Issue
Block a user