Add LandingTick to ProductionAirdrop

This commit is contained in:
dnqbob
2023-10-11 13:11:15 +08:00
committed by Gustas
parent 85c8f6c446
commit fc77c3ce48

View File

@@ -39,6 +39,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Direction the aircraft should face to land.")]
public readonly WAngle Facing = new(256);
[Desc("Tick that aircraft should wait before producing.")]
public readonly int WaitTickBeforeProduce = 0;
[Desc("Tick that aircraft should wait after producing.")]
public readonly int WaitTickAfterProduce = 0;
public override object Create(ActorInitializer init) { return new ProductionAirdrop(init, this); }
}
@@ -104,6 +110,8 @@ namespace OpenRA.Mods.Common.Traits
var exitCell = self.Location + exit.ExitCell;
actor.QueueActivity(new Land(actor, Target.FromActor(self), WDist.Zero, WVec.Zero, info.Facing, clearCells: new CPos[1] { exitCell }));
if (info.WaitTickBeforeProduce > 0)
actor.QueueActivity(new Wait(info.WaitTickBeforeProduce));
actor.QueueActivity(new CallFunc(() =>
{
if (!self.IsInWorld || self.IsDead)
@@ -119,7 +127,8 @@ namespace OpenRA.Mods.Common.Traits
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName);
TextNotificationsManager.AddTransientLine(self.Owner, info.ReadyTextNotification);
}));
if (info.WaitTickAfterProduce > 0)
actor.QueueActivity(new Wait(info.WaitTickAfterProduce));
actor.QueueActivity(new FlyOffMap(actor, Target.FromCell(w, endPos)));
actor.QueueActivity(new RemoveSelf());
});