Add IdleBehavior enum to Aircraft

This commit is contained in:
reaperrr
2019-06-10 06:05:16 +02:00
committed by abcdefg30
parent d185f6e9f1
commit bfcdb3a8a2
13 changed files with 130 additions and 129 deletions

View File

@@ -114,7 +114,8 @@ namespace OpenRA.Mods.Common.Activities
// TODO: It would be better to not take off at all, but we lack the plumbing to detect current airborne/landed state.
// If the aircraft lands when idle and is idle, we let the default idle handler manage this.
// TODO: Remove this after fixing all activities to work properly with arbitrary starting altitudes.
var skipHeightAdjustment = aircraft.Info.LandWhenIdle && self.CurrentActivity.IsCanceling && self.CurrentActivity.NextActivity == null;
var landWhenIdle = aircraft.Info.IdleBehavior == IdleBehaviorType.Land;
var skipHeightAdjustment = landWhenIdle && self.CurrentActivity.IsCanceling && self.CurrentActivity.NextActivity == null;
if (aircraft.Info.CanHover && !skipHeightAdjustment && dat != aircraft.Info.CruiseAltitude)
{
if (dat <= aircraft.LandAltitude)

View File

@@ -81,7 +81,8 @@ namespace OpenRA.Mods.Common.Activities
// If the aircraft lands when idle and is idle, continue landing,
// otherwise climb back to CruiseAltitude.
// TODO: Remove this after fixing all activities to work properly with arbitrary starting altitudes.
var continueLanding = aircraft.Info.LandWhenIdle && self.CurrentActivity.IsCanceling && self.CurrentActivity.NextActivity == null;
var shouldLand = aircraft.Info.IdleBehavior == IdleBehaviorType.Land;
var continueLanding = shouldLand && self.CurrentActivity.IsCanceling && self.CurrentActivity.NextActivity == null;
if (!continueLanding)
{
var dat = self.World.Map.DistanceAboveTerrain(aircraft.CenterPosition);