diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 77354ed31c..f01481d2a0 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -444,6 +444,35 @@ namespace OpenRA.Server slotData.Closed = false; slotData.Bot = null; + SyncLobbyInfo(); + return true; + }}, + { "slot_bot", + s => + { + var parts = s.Split(' '); + + if (parts.Length != 2) + { + SendChatTo( conn, "Malformed slot_bot command" ); + return true; + } + + int slot; + if (!int.TryParse(parts[0], out slot)) { Log.Write("server", "Invalid slot: {0}", s ); return false; } + + var slotData = lobbyInfo.Slots.FirstOrDefault( x => x.Index == slot ); + if (slotData == null) + return false; + + if (conn.PlayerIndex != 0) + { + SendChatTo( conn, "Only the host can alter slots" ); + return true; + } + + slotData.Bot = parts[1]; + SyncLobbyInfo(); return true; }}, diff --git a/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs b/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs index 5b5ce3750d..6758022fad 100644 --- a/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs +++ b/OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs @@ -271,7 +271,7 @@ namespace OpenRA.Widgets.Delegates else { if (s.Bot == null) - s.Bot = "HackyAI"; + Game.IssueOrder(Order.Command("slot_bot HackyAI")); else Game.IssueOrder(Order.Command("slot_close " + s.Index)); }