Streamline Land activity

Removed some redundant parameters, some redundant overloads
and made Land always consider LandAltitude relative to target.
This commit is contained in:
reaperrr
2019-04-26 01:30:49 +02:00
committed by Paul Chote
parent 14bd5ada1a
commit 0c2666b97e
11 changed files with 47 additions and 70 deletions

View File

@@ -195,6 +195,11 @@ namespace OpenRA.Mods.Common.Traits
public WDist LandAltitude { get; private set; }
public static WPos GroundPosition(Actor self)
{
return self.CenterPosition - new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(self.CenterPosition));
}
bool airborne;
bool cruising;
bool firstTick = true;
@@ -321,7 +326,7 @@ namespace OpenRA.Mods.Common.Traits
if (Info.TurnToLand)
self.QueueActivity(new Turn(self, Info.InitialFacing));
self.QueueActivity(new Land(self, true));
self.QueueActivity(new Land(self));
ForceLanding = true;
}
@@ -625,7 +630,7 @@ namespace OpenRA.Mods.Common.Traits
if (Info.TurnToLand)
self.QueueActivity(new Turn(self, Info.InitialFacing));
self.QueueActivity(new Land(self, true));
self.QueueActivity(new Land(self));
}
else if (!Info.CanHover && !atLandAltitude)
self.QueueActivity(new FlyCircle(self, -1, Info.IdleTurnSpeed > -1 ? Info.IdleTurnSpeed : TurnSpeed));
@@ -812,10 +817,7 @@ namespace OpenRA.Mods.Common.Traits
public Activity MoveIntoTarget(Actor self, Target target)
{
if (!Info.VTOL)
return new Land(self, target, false);
return new Land(self, false);
return new Land(self, target);
}
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos)