Skip to content

Commit

Permalink
Add LandingTick to ProductionAirdrop
Browse files Browse the repository at this point in the history
  • Loading branch information
dnqbob authored and PunkPun committed Oct 13, 2023
1 parent 85c8f6c commit fc77c3c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion OpenRA.Mods.Common/Traits/Buildings/ProductionAirdrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public class ProductionAirdropInfo : ProductionInfo
[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); }
}

Expand Down Expand Up @@ -104,6 +110,8 @@ public override bool Produce(Actor self, ActorInfo producee, string productionTy

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)
Expand All @@ -119,7 +127,8 @@ public override bool Produce(Actor self, ActorInfo producee, string productionTy
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());
});
Expand Down

0 comments on commit fc77c3c

Please sign in to comment.