Add a ParentActorInit for FreeActor spawns.
This commit is contained in:
@@ -34,21 +34,22 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public FreeActor(ActorInitializer init, FreeActorInfo info)
|
public FreeActor(ActorInitializer init, FreeActorInfo info)
|
||||||
{
|
{
|
||||||
if (init.Contains<FreeActorInit>() && !init.Get<FreeActorInit>().value) return;
|
if (init.Contains<FreeActorInit>() && !init.Get<FreeActorInit>().value)
|
||||||
|
return;
|
||||||
|
|
||||||
init.self.World.AddFrameEndTask(
|
init.self.World.AddFrameEndTask(w =>
|
||||||
w =>
|
{
|
||||||
|
var a = w.CreateActor(info.Actor, new TypeDictionary
|
||||||
{
|
{
|
||||||
var a = w.CreateActor(info.Actor, new TypeDictionary
|
new ParentActorInit(init.self),
|
||||||
{
|
new LocationInit(init.self.Location + (CVec)info.SpawnOffset),
|
||||||
new LocationInit( init.self.Location + (CVec)info.SpawnOffset ),
|
new OwnerInit(init.self.Owner),
|
||||||
new OwnerInit( init.self.Owner ),
|
new FacingInit(info.Facing),
|
||||||
new FacingInit( info.Facing ),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (info.InitialActivity != null)
|
|
||||||
a.QueueActivity(Game.CreateObject<Activity>(info.InitialActivity));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (info.InitialActivity != null)
|
||||||
|
a.QueueActivity(Game.CreateObject<Activity>(info.InitialActivity));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,4 +61,11 @@ namespace OpenRA.Mods.RA
|
|||||||
public FreeActorInit(bool init) { value = init; }
|
public FreeActorInit(bool init) { value = init; }
|
||||||
public bool Value(World world) { return value; }
|
public bool Value(World world) { return value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ParentActorInit : IActorInit<Actor>
|
||||||
|
{
|
||||||
|
public readonly Actor value;
|
||||||
|
public ParentActorInit(Actor parent) { value = parent; }
|
||||||
|
public Actor Value(World world) { return value; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user