Merge pull request #4464 from pchote/attackmove
Add AttackMove to C&C helicopters
This commit is contained in:
@@ -152,5 +152,6 @@ namespace OpenRA.Mods.RA.Air
|
||||
public Activity MoveTo(CPos cell, int nearEnough) { return new HeliFly(cell); }
|
||||
public Activity MoveTo(CPos cell, Actor ignoredActor) { return new HeliFly(cell); }
|
||||
public Activity MoveWithinRange(Target target, WRange range) { return new HeliFly(target.CenterPosition); }
|
||||
public CPos NearestMoveableCell(CPos cell) { return cell; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,5 +92,6 @@ namespace OpenRA.Mods.RA.Air
|
||||
public Activity MoveTo(CPos cell, int nearEnough) { return Fly.ToCell(cell); }
|
||||
public Activity MoveTo(CPos cell, Actor ignoredActor) { return Fly.ToCell(cell); }
|
||||
public Activity MoveWithinRange(Target target, WRange range) { return Fly.ToPos(target.CenterPosition); }
|
||||
public CPos NearestMoveableCell(CPos cell) { return cell; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
class AttackMoveInfo : ITraitInfo
|
||||
{
|
||||
public readonly bool JustMove = false;
|
||||
|
||||
public object Create(ActorInitializer init) { return new AttackMove(init.self, this); }
|
||||
}
|
||||
|
||||
@@ -27,13 +25,11 @@ namespace OpenRA.Mods.RA
|
||||
[Sync] public CPos _targetLocation { get { return TargetLocation.HasValue ? TargetLocation.Value : CPos.Zero; } }
|
||||
public CPos? TargetLocation = null;
|
||||
|
||||
readonly Mobile mobile;
|
||||
readonly AttackMoveInfo info;
|
||||
readonly IMove move;
|
||||
|
||||
public AttackMove(Actor self, AttackMoveInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
mobile = self.Trait<Mobile>();
|
||||
move = self.Trait<IMove>();
|
||||
}
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
@@ -47,7 +43,7 @@ namespace OpenRA.Mods.RA
|
||||
void Activate(Actor self)
|
||||
{
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new AttackMoveActivity(self, mobile.MoveTo(TargetLocation.Value, 1)));
|
||||
self.QueueActivity(new AttackMoveActivity(self, move.MoveTo(TargetLocation.Value, 1)));
|
||||
self.SetTargetLine(Target.FromCell(TargetLocation.Value), Color.Red);
|
||||
}
|
||||
|
||||
@@ -63,13 +59,8 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
if (order.OrderString == "AttackMove")
|
||||
{
|
||||
if (info.JustMove)
|
||||
mobile.ResolveOrder(self, new Order("Move", order));
|
||||
else
|
||||
{
|
||||
TargetLocation = mobile.NearestMoveableCell(order.TargetLocation);
|
||||
Activate(self);
|
||||
}
|
||||
TargetLocation = move.NearestMoveableCell(order.TargetLocation);
|
||||
Activate(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class CheckAutotargetWiring : ILintPass
|
||||
{
|
||||
public void Run(Action<string> emitError, Action<string> emitWarning)
|
||||
{
|
||||
foreach( var i in Rules.Info )
|
||||
{
|
||||
if (i.Key.StartsWith("^"))
|
||||
continue;
|
||||
var attackMove = i.Value.Traits.GetOrDefault<AttackMoveInfo>();
|
||||
if (attackMove != null && !attackMove.JustMove &&
|
||||
!i.Value.Traits.Contains<AutoTargetInfo>())
|
||||
emitError( "{0} has AttackMove setup without AutoTarget, and will crash when resolving that order.".F(i.Key) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,6 @@
|
||||
<Compile Include="LightPaletteRotator.cs" />
|
||||
<Compile Include="LimitedAmmo.cs" />
|
||||
<Compile Include="Lint\CheckActorReferences.cs" />
|
||||
<Compile Include="Lint\CheckAutotargetWiring.cs" />
|
||||
<Compile Include="Lint\CheckSyncAnnotations.cs" />
|
||||
<Compile Include="Lint\CheckTraitPrerequisites.cs" />
|
||||
<Compile Include="Lint\LintBuildablePrerequisites.cs" />
|
||||
|
||||
Reference in New Issue
Block a user