removing cancelable from Move. remove unnecessary qualified names from Production
This commit is contained in:
@@ -15,16 +15,13 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace OpenRA.Traits.Activities
|
namespace OpenRA.Traits.Activities
|
||||||
{
|
{
|
||||||
public class Move : IActivity
|
public class Move : CancelableActivity
|
||||||
{
|
{
|
||||||
IActivity NextActivity { get; set; }
|
|
||||||
|
|
||||||
int2? destination;
|
int2? destination;
|
||||||
int nearEnough;
|
int nearEnough;
|
||||||
public List<int2> path;
|
public List<int2> path;
|
||||||
Func<Actor, Mobile, List<int2>> getPath;
|
Func<Actor, Mobile, List<int2>> getPath;
|
||||||
public Actor ignoreBuilding;
|
public Actor ignoreBuilding;
|
||||||
bool cancellable = true;
|
|
||||||
|
|
||||||
int ticksBeforePathing;
|
int ticksBeforePathing;
|
||||||
|
|
||||||
@@ -48,7 +45,6 @@ namespace OpenRA.Traits.Activities
|
|||||||
.WithoutLaneBias());
|
.WithoutLaneBias());
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
this.nearEnough = 0;
|
this.nearEnough = 0;
|
||||||
this.cancellable = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Move( int2 destination, int nearEnough )
|
public Move( int2 destination, int nearEnough )
|
||||||
@@ -125,7 +121,7 @@ namespace OpenRA.Traits.Activities
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActivity Tick( Actor self )
|
public override IActivity Tick( Actor self )
|
||||||
{
|
{
|
||||||
var mobile = self.Trait<Mobile>();
|
var mobile = self.Trait<Mobile>();
|
||||||
|
|
||||||
@@ -251,20 +247,9 @@ namespace OpenRA.Traits.Activities
|
|||||||
return nextCell;
|
return nextCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Cancel( Actor self )
|
protected override void OnCancel()
|
||||||
{
|
{
|
||||||
if (!cancellable) return;
|
|
||||||
|
|
||||||
path = new List<int2>();
|
path = new List<int2>();
|
||||||
NextActivity = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Queue( IActivity activity )
|
|
||||||
{
|
|
||||||
if( NextActivity != null )
|
|
||||||
NextActivity.Queue( activity );
|
|
||||||
else
|
|
||||||
NextActivity = activity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class MovePart : IActivity
|
abstract class MovePart : IActivity
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Traits.Activities;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
@@ -61,7 +62,7 @@ namespace OpenRA.Mods.RA
|
|||||||
// Animate the spawn -> exit transition
|
// Animate the spawn -> exit transition
|
||||||
var speed = move.MovementSpeedForCell(self, exit);
|
var speed = move.MovementSpeedForCell(self, exit);
|
||||||
var length = speed > 0 ? (int)( ( to - spawn ).Length*3 / speed ) : 0;
|
var length = speed > 0 ? (int)( ( to - spawn ).Length*3 / speed ) : 0;
|
||||||
newUnit.QueueActivity(new Traits.Activities.Drag(spawn, to, length));
|
newUnit.QueueActivity(new Drag(spawn, to, length));
|
||||||
|
|
||||||
// Log.Write("debug", "length={0} facing={1} exit={2} spawn={3}", length, facing.Facing, exit, spawn);
|
// Log.Write("debug", "length={0} facing={1} exit={2} spawn={3}", length, facing.Facing, exit, spawn);
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
target = rp.rallyPoint;
|
target = rp.rallyPoint;
|
||||||
// Todo: Move implies unit has Mobile
|
// Todo: Move implies unit has Mobile
|
||||||
newUnit.QueueActivity(new Traits.Activities.Move(target, 1));
|
newUnit.QueueActivity(new Move(target, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newUnit.Owner == self.World.LocalPlayer)
|
if (newUnit.Owner == self.World.LocalPlayer)
|
||||||
|
|||||||
Reference in New Issue
Block a user