Produce actors in a FrameEndTask.
This commit is contained in:
@@ -56,6 +56,8 @@ namespace OpenRA.Mods.RA
|
|||||||
var fi = producee.Traits.Get<IFacingInfo>();
|
var fi = producee.Traits.Get<IFacingInfo>();
|
||||||
var initialFacing = exitinfo.Facing < 0 ? Util.GetFacing(to - spawn, fi.GetInitialFacing()) : exitinfo.Facing;
|
var initialFacing = exitinfo.Facing < 0 ? Util.GetFacing(to - spawn, fi.GetInitialFacing()) : exitinfo.Facing;
|
||||||
|
|
||||||
|
self.World.AddFrameEndTask(w =>
|
||||||
|
{
|
||||||
var newUnit = self.World.CreateActor(producee.Name, new TypeDictionary
|
var newUnit = self.World.CreateActor(producee.Name, new TypeDictionary
|
||||||
{
|
{
|
||||||
new OwnerInit(self.Owner),
|
new OwnerInit(self.Owner),
|
||||||
@@ -72,6 +74,7 @@ namespace OpenRA.Mods.RA
|
|||||||
newUnit.SetTargetLine(Target.FromCell(target), Color.Green, false);
|
newUnit.SetTargetLine(Target.FromCell(target), Color.Green, false);
|
||||||
foreach (var t in self.TraitsImplementing<INotifyProduction>())
|
foreach (var t in self.TraitsImplementing<INotifyProduction>())
|
||||||
t.UnitProduced(self, newUnit, exit);
|
t.UnitProduced(self, newUnit, exit);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPos MoveToRallyPoint(Actor self, Actor newUnit, CPos exitLocation)
|
static CPos MoveToRallyPoint(Actor self, Actor newUnit, CPos exitLocation)
|
||||||
|
|||||||
Reference in New Issue
Block a user