QueuedActivity's Insert is broken
This commit is contained in:
@@ -10,13 +10,12 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Traits.Activities;
|
||||
|
||||
namespace OpenRA.Mods.RA.Move
|
||||
{
|
||||
public class Drag : IActivity
|
||||
public class Drag : Activity
|
||||
{
|
||||
IActivity NextActivity { get; set; }
|
||||
|
||||
int2 endLocation;
|
||||
int2 startLocation;
|
||||
int length;
|
||||
@@ -29,7 +28,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
}
|
||||
|
||||
int ticks = 0;
|
||||
public IActivity Tick( Actor self )
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
var mobile = self.Trait<Mobile>();
|
||||
mobile.PxPosition = int2.Lerp(startLocation, endLocation, ticks, length - 1);
|
||||
@@ -43,19 +42,14 @@ namespace OpenRA.Mods.RA.Move
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Cancel(Actor self) { }
|
||||
|
||||
public void Queue( IActivity activity )
|
||||
{
|
||||
if( NextActivity != null )
|
||||
NextActivity.Queue( activity );
|
||||
else
|
||||
NextActivity = activity;
|
||||
protected override bool OnCancel(Actor self)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public IEnumerable<float2> GetCurrentPath()
|
||||
public override IEnumerable<Target> GetTargetQueue( Actor self )
|
||||
{
|
||||
yield return endLocation;
|
||||
yield return Target.FromPos(endLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,11 +457,11 @@ namespace OpenRA.Mods.RA.Move
|
||||
}
|
||||
}
|
||||
|
||||
public IActivity ScriptedMove(int2 cell) { return new Move(cell); }
|
||||
public IActivity MoveTo(int2 cell, int nearEnough) { return new Move(cell, nearEnough); }
|
||||
public IActivity MoveTo(int2 cell, Actor ignoredActor) { return new Move(cell, ignoredActor); }
|
||||
public IActivity MoveWithinRange(Actor target, int range) { return new Move(target, range); }
|
||||
public IActivity MoveWithinRange(Target target, int range) { return new Move(target, range); }
|
||||
public IActivity MoveTo(Func<List<int2>> pathFunc) { return new Move(pathFunc); }
|
||||
public Activity ScriptedMove(int2 cell) { return new Move(cell); }
|
||||
public Activity MoveTo(int2 cell, int nearEnough) { return new Move(cell, nearEnough); }
|
||||
public Activity MoveTo(int2 cell, Actor ignoredActor) { return new Move(cell, ignoredActor); }
|
||||
public Activity MoveWithinRange(Actor target, int range) { return new Move(target, range); }
|
||||
public Activity MoveWithinRange(Target target, int range) { return new Move(target, range); }
|
||||
public Activity MoveTo(Func<List<int2>> pathFunc) { return new Move(pathFunc); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Mods.RA.Move
|
||||
{
|
||||
class Move : CancelableActivity
|
||||
class Move : Activity
|
||||
{
|
||||
int2? destination;
|
||||
int nearEnough;
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
return path;
|
||||
}
|
||||
|
||||
public override IActivity Tick( Actor self )
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
var mobile = self.Trait<Mobile>();
|
||||
|
||||
@@ -239,16 +239,16 @@ namespace OpenRA.Mods.RA.Move
|
||||
return true;
|
||||
}
|
||||
|
||||
public override IEnumerable<float2> GetCurrentPath()
|
||||
public override IEnumerable<Target> GetTargetQueue( Actor self )
|
||||
{
|
||||
if( path != null )
|
||||
return Enumerable.Reverse(path).Select( c => (float2)Util.CenterOfCell(c) );
|
||||
return Enumerable.Reverse(path).Select( c => Target.FromCell(c) );
|
||||
if( destination != null )
|
||||
return new float2[] { destination.Value };
|
||||
return new float2[ 0 ];
|
||||
return new Target[] { Target.FromPos(destination.Value) };
|
||||
return Target.NoTargets;
|
||||
}
|
||||
|
||||
abstract class MovePart : IActivity
|
||||
abstract class MovePart : Activity
|
||||
{
|
||||
public readonly Move move;
|
||||
public readonly int2 from, to;
|
||||
@@ -267,17 +267,17 @@ namespace OpenRA.Mods.RA.Move
|
||||
this.moveFractionTotal = ( ( to - from ) * 3 ).Length;
|
||||
}
|
||||
|
||||
public void Cancel( Actor self )
|
||||
protected override bool OnCancel( Actor self )
|
||||
{
|
||||
move.Cancel( self );
|
||||
return move.OnCancel( self );
|
||||
}
|
||||
|
||||
public void Queue( IActivity activity )
|
||||
public override void Queue( Activity activity )
|
||||
{
|
||||
move.Queue( activity );
|
||||
}
|
||||
|
||||
public IActivity Tick( Actor self )
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
var mobile = self.Trait<Mobile>();
|
||||
var ret = InnerTick( self, mobile );
|
||||
@@ -290,7 +290,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
return ret;
|
||||
}
|
||||
|
||||
IActivity InnerTick( Actor self, Mobile mobile )
|
||||
Activity InnerTick( Actor self, Mobile mobile )
|
||||
{
|
||||
moveFraction += mobile.MovementSpeedForCell(self, mobile.toCell);
|
||||
if( moveFraction <= moveFractionTotal )
|
||||
@@ -315,9 +315,9 @@ namespace OpenRA.Mods.RA.Move
|
||||
|
||||
protected abstract MovePart OnComplete( Actor self, Mobile mobile, Move parent );
|
||||
|
||||
public IEnumerable<float2> GetCurrentPath()
|
||||
public override IEnumerable<Target> GetTargetQueue( Actor self )
|
||||
{
|
||||
return move.GetCurrentPath();
|
||||
return move.GetTargetQueue(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user