Make ActorPreview and EditorActorPreview wrap ActorReference.

This commit is contained in:
Paul Chote
2020-06-12 13:21:09 +01:00
committed by reaperrr
parent ae7cfa56b7
commit c6c3a8c60d
22 changed files with 265 additions and 162 deletions

View File

@@ -35,18 +35,17 @@ namespace OpenRA.Mods.Common.Traits
var actorReference = new ActorReference(kv.Value.Value, kv.Value.ToDictionary());
// If there is no real player associated, don't spawn it.
var ownerName = actorReference.InitDict.Get<OwnerInit>().InternalName;
var ownerName = actorReference.Get<OwnerInit>().InternalName;
if (!world.Players.Any(p => p.InternalName == ownerName))
continue;
var initDict = actorReference.InitDict;
initDict.Add(new SkipMakeAnimsInit());
initDict.Add(new SpawnedByMapInit(kv.Key));
actorReference.Add(new SkipMakeAnimsInit());
actorReference.Add(new SpawnedByMapInit(kv.Key));
if (PreventMapSpawn(world, actorReference, preventMapSpawns))
continue;
var actor = world.CreateActor(actorReference.Type, initDict);
var actor = world.CreateActor(true, actorReference);
Actors[kv.Key] = actor;
LastMapActorID = actor.ActorID;
}