make bot slot usage actually work
This commit is contained in:
@@ -444,6 +444,35 @@ namespace OpenRA.Server
|
|||||||
slotData.Closed = false;
|
slotData.Closed = false;
|
||||||
slotData.Bot = null;
|
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();
|
SyncLobbyInfo();
|
||||||
return true;
|
return true;
|
||||||
}},
|
}},
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s.Bot == null)
|
if (s.Bot == null)
|
||||||
s.Bot = "HackyAI";
|
Game.IssueOrder(Order.Command("slot_bot HackyAI"));
|
||||||
else
|
else
|
||||||
Game.IssueOrder(Order.Command("slot_close " + s.Index));
|
Game.IssueOrder(Order.Command("slot_close " + s.Index));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user