Add SpawnActorEffect
And use it to drop DelayedAction from ReinforcementsGlobal.
This commit is contained in:
@@ -16,6 +16,7 @@ using Eluant;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Scripting;
|
||||
@@ -84,24 +85,21 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
actors.Add(actor);
|
||||
|
||||
var actionDelay = i * interval;
|
||||
Action actorAction = () =>
|
||||
Activity queuedActivity = null;
|
||||
if (af != null)
|
||||
{
|
||||
Context.World.Add(actor);
|
||||
for (var j = 1; j < entryPath.Length; j++)
|
||||
Move(actor, entryPath[j]);
|
||||
|
||||
if (af != null)
|
||||
queuedActivity = new CallFunc(() =>
|
||||
{
|
||||
actor.QueueActivity(new CallFunc(() =>
|
||||
{
|
||||
using (af)
|
||||
using (var a = actor.ToLuaValue(Context))
|
||||
af.Call(a);
|
||||
}));
|
||||
}
|
||||
};
|
||||
using (af)
|
||||
using (var a = actor.ToLuaValue(Context))
|
||||
af.Call(a);
|
||||
});
|
||||
}
|
||||
|
||||
Context.World.AddFrameEndTask(w => w.Add(new DelayedAction(actionDelay, actorAction)));
|
||||
// We need to exclude the spawn location from the movement path
|
||||
var path = entryPath.Skip(1).ToArray();
|
||||
|
||||
Context.World.AddFrameEndTask(w => w.Add(new SpawnActorEffect(actor, actionDelay, path, queuedActivity)));
|
||||
}
|
||||
|
||||
return actors.ToArray();
|
||||
|
||||
Reference in New Issue
Block a user