Allow bot players to be created via map.yaml

This commit is contained in:
Paul Chote
2011-06-03 09:14:41 +12:00
parent 64497c9b2f
commit fe5ef82cdf
3 changed files with 9 additions and 1 deletions

View File

@@ -63,13 +63,19 @@ namespace OpenRA
ColorRamp = pr.ColorRamp;
PlayerName = pr.Name;
NonCombatant = pr.NonCombatant;
IsBot = pr.Bot != null;
Country = world.GetCountries()
.FirstOrDefault(c => pr.Race == c.Race)
?? world.GetCountries().Random(world.SharedRandom);
}
PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) });
if (IsBot)
PlayerActor.TraitsImplementing<IBot>()
.Single(b => b.Info.Name == pr.Bot)
.Activate(this);
}
public void GiveAdvice(string advice)