Spawn ejected pilots inside a FrameEndTask.
This commit is contained in:
@@ -58,6 +58,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if ((inAir && !Info.EjectInAir) || (!inAir && !Info.EjectOnGround))
|
if ((inAir && !Info.EjectInAir) || (!inAir && !Info.EjectOnGround))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
self.World.AddFrameEndTask(w =>
|
||||||
|
{
|
||||||
if (!Info.AllowUnsuitableCell)
|
if (!Info.AllowUnsuitableCell)
|
||||||
{
|
{
|
||||||
var pilotInfo = self.World.Map.Rules.Actors[Info.PilotActor.ToLowerInvariant()];
|
var pilotInfo = self.World.Map.Rules.Actors[Info.PilotActor.ToLowerInvariant()];
|
||||||
@@ -89,16 +91,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var pilot = self.World.CreateActor(true, Info.PilotActor.ToLowerInvariant(), td);
|
var pilot = self.World.CreateActor(true, Info.PilotActor.ToLowerInvariant(), td);
|
||||||
|
|
||||||
if (!inAir)
|
if (!inAir)
|
||||||
{
|
|
||||||
self.World.AddFrameEndTask(w =>
|
|
||||||
{
|
{
|
||||||
var pilotMobile = pilot.TraitOrDefault<Mobile>();
|
var pilotMobile = pilot.TraitOrDefault<Mobile>();
|
||||||
if (pilotMobile != null)
|
if (pilotMobile != null)
|
||||||
pilotMobile.Nudge(pilot);
|
pilotMobile.Nudge(pilot);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Game.Sound.Play(SoundType.World, Info.ChuteSound, cp);
|
Game.Sound.Play(SoundType.World, Info.ChuteSound, cp);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user