Introduce Aircraft VTOL boolean

Rather than hard-linking vertical take-off/land to the CanHover = Helicopter assumption.
This commit is contained in:
reaperrr
2017-08-20 21:18:33 +02:00
committed by Matthias Mailänder
parent 5d58374962
commit 3b01da737c
2 changed files with 9 additions and 5 deletions

View File

@@ -143,12 +143,12 @@ namespace OpenRA.Mods.Common.Scripting
} }
else else
{ {
var aircraftInfo = transport.TraitOrDefault<Aircraft>(); var aircraftInfo = transport.Info.TraitInfoOrDefault<AircraftInfo>();
if (aircraftInfo != null) if (aircraftInfo != null)
{ {
if (!aircraftInfo.IsPlane) if (aircraftInfo.VTOL)
{ {
transport.QueueActivity(new Turn(transport, aircraftInfo.Info.InitialFacing)); transport.QueueActivity(new Turn(transport, aircraftInfo.InitialFacing));
transport.QueueActivity(new HeliLand(transport, true)); transport.QueueActivity(new HeliLand(transport, true));
} }
else else

View File

@@ -69,6 +69,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Can the actor hover in place mid-air? If not, then the actor will have to remain in motion (circle around).")] [Desc("Can the actor hover in place mid-air? If not, then the actor will have to remain in motion (circle around).")]
public readonly bool CanHover = false; public readonly bool CanHover = false;
[Desc("Does the actor land and take off vertically?")]
public readonly bool VTOL = false;
[Desc("Will this actor try to land after it has no more commands?")] [Desc("Will this actor try to land after it has no more commands?")]
public readonly bool LandWhenIdle = true; public readonly bool LandWhenIdle = true;
@@ -620,7 +623,8 @@ namespace OpenRA.Mods.Common.Traits
new CallFunc(() => SetVisualPosition(self, fromPos)), new CallFunc(() => SetVisualPosition(self, fromPos)),
new Fly(self, Target.FromPos(toPos))); new Fly(self, Target.FromPos(toPos)));
return ActivityUtils.SequenceActivities(new CallFunc(() => SetVisualPosition(self, fromPos)), return ActivityUtils.SequenceActivities(
new CallFunc(() => SetVisualPosition(self, fromPos)),
new HeliFly(self, Target.FromPos(toPos))); new HeliFly(self, Target.FromPos(toPos)));
} }
@@ -757,7 +761,7 @@ namespace OpenRA.Mods.Common.Traits
UnReserve(); UnReserve();
// TODO: Implement INotifyBecomingIdle instead // TODO: Implement INotifyBecomingIdle instead
if (!IsPlane && Info.LandWhenIdle) if (Info.VTOL && Info.LandWhenIdle)
{ {
if (Info.TurnToLand) if (Info.TurnToLand)
self.QueueActivity(new Turn(self, Info.InitialFacing)); self.QueueActivity(new Turn(self, Info.InitialFacing));