map actor id -> live actor dict for map scripting purposes

This commit is contained in:
Chris Forbes
2010-04-17 12:28:32 +12:00
parent 4b70fa6594
commit 645362fe93

View File

@@ -9,12 +9,14 @@ namespace OpenRA.Traits
class SpawnMapActors : IGameStarted
{
public Dictionary<string, Actor> MapActors = new Dictionary<string, Actor>();
public void GameStarted(World world)
{
Game.skipMakeAnims = true; // rude hack
// TODO: Keep a dictionary of actor reference -> actor somewhere for scripting purposes
foreach (var actorReference in world.Map.Actors)
world.CreateActor(actorReference.Value.Name, actorReference.Value.Location,
MapActors[actorReference.Key] = world.CreateActor(actorReference.Value.Name, actorReference.Value.Location,
world.players.Values.FirstOrDefault(p => p.InternalName == actorReference.Value.Owner)
?? world.NeutralPlayer);