Merge HeliFly into Fly

This commit is contained in:
reaperrr
2019-05-01 15:45:10 +02:00
committed by Paul Chote
parent 5698ea0910
commit 4f8f8cfb9d
14 changed files with 129 additions and 243 deletions

View File

@@ -755,37 +755,24 @@ namespace OpenRA.Mods.Common.Traits
public Activity MoveTo(CPos cell, int nearEnough)
{
if (!Info.CanHover)
return new Fly(self, Target.FromCell(self.World, cell));
return new HeliFly(self, Target.FromCell(self.World, cell));
return new Fly(self, Target.FromCell(self.World, cell));
}
public Activity MoveTo(CPos cell, Actor ignoreActor)
{
if (!Info.CanHover)
return new Fly(self, Target.FromCell(self.World, cell));
return new HeliFly(self, Target.FromCell(self.World, cell));
return new Fly(self, Target.FromCell(self.World, cell));
}
public Activity MoveWithinRange(Target target, WDist range,
WPos? initialTargetPosition = null, Color? targetLineColor = null)
{
if (!Info.CanHover)
return new Fly(self, target, WDist.Zero, range, initialTargetPosition, targetLineColor);
return new HeliFly(self, target, WDist.Zero, range, initialTargetPosition, targetLineColor);
return new Fly(self, target, WDist.Zero, range, initialTargetPosition, targetLineColor);
}
public Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange,
WPos? initialTargetPosition = null, Color? targetLineColor = null)
{
if (!Info.CanHover)
return new Fly(self, target, minRange, maxRange,
initialTargetPosition, targetLineColor);
return new HeliFly(self, target, minRange, maxRange,
return new Fly(self, target, minRange, maxRange,
initialTargetPosition, targetLineColor);
}
@@ -802,10 +789,7 @@ namespace OpenRA.Mods.Common.Traits
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any)
{
if (!Info.CanHover)
return new Fly(self, Target.FromCell(self.World, cell));
return new HeliFly(self, Target.FromCell(self.World, cell, subCell));
return new Fly(self, Target.FromCell(self.World, cell, subCell));
}
public Activity MoveToTarget(Actor self, Target target,
@@ -816,7 +800,7 @@ namespace OpenRA.Mods.Common.Traits
initialTargetPosition, targetLineColor);
return ActivityUtils.SequenceActivities(self,
new HeliFly(self, target, initialTargetPosition, targetLineColor),
new Fly(self, target, initialTargetPosition, targetLineColor),
new Turn(self, Info.InitialFacing));
}
@@ -828,14 +812,9 @@ namespace OpenRA.Mods.Common.Traits
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos)
{
// TODO: Ignore repulsion when moving
if (!Info.CanHover)
return ActivityUtils.SequenceActivities(self,
new CallFunc(() => SetVisualPosition(self, fromPos)),
new Fly(self, Target.FromPos(toPos)));
return ActivityUtils.SequenceActivities(self,
new CallFunc(() => SetVisualPosition(self, fromPos)),
new HeliFly(self, Target.FromPos(toPos)));
new Fly(self, Target.FromPos(toPos)));
}
public int EstimatedMoveDuration(Actor self, WPos fromPos, WPos toPos)
@@ -940,13 +919,8 @@ namespace OpenRA.Mods.Common.Traits
UnReserve();
var target = Target.FromCell(self.World, cell);
self.SetTargetLine(target, Color.Green);
if (!Info.CanHover)
self.QueueActivity(order.Queued, new Fly(self, target));
else
self.QueueActivity(order.Queued, new HeliFly(self, target));
self.QueueActivity(order.Queued, new Fly(self, target));
}
else if (order.OrderString == "Enter" || order.OrderString == "Repair")
{
@@ -1008,12 +982,7 @@ namespace OpenRA.Mods.Common.Traits
self.CancelActivity();
self.SetTargetLine(target, Color.Green, false);
if (!Info.CanHover)
self.QueueActivity(new Fly(self, target));
else
self.QueueActivity(new HeliFly(self, target));
self.QueueActivity(new Fly(self, target));
UnReserve();
}