Make VisualMove uninterruptible by making Turn a Child of Drag.
This commit is contained in:
@@ -23,17 +23,25 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
WPos start, end;
|
WPos start, end;
|
||||||
int length;
|
int length;
|
||||||
int ticks = 0;
|
int ticks = 0;
|
||||||
|
int desiredFacing;
|
||||||
|
|
||||||
public Drag(Actor self, WPos start, WPos end, int length)
|
public Drag(Actor self, WPos start, WPos end, int length, int facing = -1)
|
||||||
{
|
{
|
||||||
positionable = self.Trait<IPositionable>();
|
positionable = self.Trait<IPositionable>();
|
||||||
disableable = self.TraitOrDefault<IMove>() as IDisabledTrait;
|
disableable = self.TraitOrDefault<IMove>() as IDisabledTrait;
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
|
desiredFacing = facing;
|
||||||
IsInterruptible = false;
|
IsInterruptible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnFirstRun(Actor self)
|
||||||
|
{
|
||||||
|
if (desiredFacing != -1)
|
||||||
|
QueueChild(new Turn(self, desiredFacing));
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Tick(Actor self)
|
public override bool Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (disableable != null && disableable.IsTraitDisabled)
|
if (disableable != null && disableable.IsTraitDisabled)
|
||||||
|
|||||||
@@ -698,9 +698,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var delta = toPos - fromPos;
|
var delta = toPos - fromPos;
|
||||||
var facing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : Facing;
|
var facing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : Facing;
|
||||||
|
|
||||||
var activities = new Turn(self, facing);
|
return new Drag(self, fromPos, toPos, length, facing);
|
||||||
activities.Queue(new Drag(self, fromPos, toPos, length));
|
|
||||||
return activities;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CPos? ClosestGroundCell()
|
CPos? ClosestGroundCell()
|
||||||
|
|||||||
Reference in New Issue
Block a user