Added IDisableMove
This commit is contained in:
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
var desiredFacing = Util.GetFacing(Target.CenterPosition - self.CenterPosition, 0);
|
||||
if (facing.Facing != desiredFacing)
|
||||
return Util.SequenceActivities(new Turn(desiredFacing), this);
|
||||
return Util.SequenceActivities(new Turn(self, desiredFacing), this);
|
||||
|
||||
attack.DoAttack(self, Target);
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var facing = self.Trait<IFacing>().Facing;
|
||||
var desired = Util.QuantizeFacing(facing, harvInfo.HarvestFacings) * (256 / harvInfo.HarvestFacings);
|
||||
if (desired != facing)
|
||||
return Util.SequenceActivities(new Turn(desired), this);
|
||||
return Util.SequenceActivities(new Turn(self, desired), this);
|
||||
}
|
||||
|
||||
var resLayer = self.World.WorldActor.Trait<ResourceLayer>();
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA
|
||||
return this;
|
||||
case State.Turn:
|
||||
state = State.Dock;
|
||||
return Util.SequenceActivities(new Turn(angle), this);
|
||||
return Util.SequenceActivities(new Turn(self, angle), this);
|
||||
case State.Dock:
|
||||
ru.PlayCustomAnimation(self, "dock", () => {
|
||||
ru.PlayCustomAnimRepeating(self, "dock-loop");
|
||||
|
||||
@@ -8,22 +8,30 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
public class Turn : Activity
|
||||
{
|
||||
int desiredFacing;
|
||||
readonly IEnumerable<IDisableMove> moveDisablers;
|
||||
readonly int desiredFacing;
|
||||
|
||||
public Turn( int desiredFacing )
|
||||
public Turn(Actor self, int desiredFacing)
|
||||
{
|
||||
moveDisablers = self.TraitsImplementing<IDisableMove>();
|
||||
this.desiredFacing = desiredFacing;
|
||||
}
|
||||
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
if (IsCanceled) return NextActivity;
|
||||
if (IsCanceled)
|
||||
return NextActivity;
|
||||
if (moveDisablers.Any(d => d.MoveDisabled(self)))
|
||||
return this;
|
||||
|
||||
var facing = self.Trait<IFacing>();
|
||||
|
||||
if( desiredFacing == facing.Facing )
|
||||
|
||||
Reference in New Issue
Block a user