From 645362fe9375a417a833719eb6faef640d7f4ad4 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 17 Apr 2010 12:28:32 +1200 Subject: [PATCH] map actor id -> live actor dict for map scripting purposes --- OpenRA.Game/Traits/World/SpawnMapActors.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Traits/World/SpawnMapActors.cs b/OpenRA.Game/Traits/World/SpawnMapActors.cs index c7cdd0e724..9b3a127cd7 100644 --- a/OpenRA.Game/Traits/World/SpawnMapActors.cs +++ b/OpenRA.Game/Traits/World/SpawnMapActors.cs @@ -9,12 +9,14 @@ namespace OpenRA.Traits class SpawnMapActors : IGameStarted { + public Dictionary MapActors = new Dictionary(); + 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);