diff --git a/OpenRA.Mods.RA/HackyAI.cs b/OpenRA.Mods.RA/HackyAI.cs index 350830ec65..8e94c88144 100644 --- a/OpenRA.Mods.RA/HackyAI.cs +++ b/OpenRA.Mods.RA/HackyAI.cs @@ -33,8 +33,18 @@ using XRandom = OpenRA.Thirdparty.Random; namespace OpenRA.Mods.RA { - class HackyAIInfo : ITraitInfo + interface IBotInfo { + string Name { get; } + } + + class HackyAIInfo : IBotInfo, ITraitInfo + { + [FieldLoader.Load] + public readonly string Name; + + string IBotInfo.Name { get { return this.Name; } } + [FieldLoader.LoadUsing("LoadUnits")] public readonly Dictionary UnitsToBuild = null; diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index c5bb5dba45..c716f6bd7c 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -162,7 +162,7 @@ namespace OpenRA.Mods.RA.Server { var parts = s.Split(' '); - if (parts.Length != 2) + if (parts.Length < 2) { server.SendChatTo( conn, "Malformed slot_bot command" ); return true; @@ -181,7 +181,7 @@ namespace OpenRA.Mods.RA.Server return true; } - slotData.Bot = parts[1]; + slotData.Bot = string.Join(" ", parts.Skip(1).ToArray() ); server.SyncLobbyInfo(); return true; diff --git a/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs index 6eb04ed3ad..6d35b6ff08 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs @@ -211,7 +211,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates if (showBotOptions) { - var bots = new string[] { "HackyAI" }; + var bots = Rules.Info["player"].Traits.WithInterface().Select(t => t.Name); bots.Do(bot => dropDownOptions.Add(new Pair("Bot: {0}".F(bot), () => orderManager.IssueOrder(Order.Command("slot_bot {0} {1}".F(slot.Index, bot)))))); diff --git a/mods/ra/rules/system.yaml b/mods/ra/rules/system.yaml index c12468b082..9073e004e9 100644 --- a/mods/ra/rules/system.yaml +++ b/mods/ra/rules/system.yaml @@ -32,7 +32,8 @@ Player: InitialCash: 5000 ActorGroupProxy: DeveloperMode: - HackyAI: + HackyAI@Default: + Name:Easy AI BuildingFractions: proc: 20% barr: 5%