Added: Lobby server command "spectator" - will attempt to put the player in an available spectator slot

This commit is contained in:
geckosoft
2010-11-01 04:14:46 +01:00
committed by Chris Forbes
parent 3e08f9b1b1
commit dd38e45f2e

View File

@@ -376,15 +376,25 @@ namespace OpenRA.Server
}}, }},
{ "race", { "race",
s => s =>
{ {
GetClient(conn).Country = s; GetClient(conn).Country = s;
SyncLobbyInfo(); SyncLobbyInfo();
return true; return true;
}}, }},
{ "spectator", { "spectator",
s => s =>
{ {
// GetClient(conn).Slot = -1; /* observer */ var slotData = lobbyInfo.Slots.Where(ax => ax.Spectator && !lobbyInfo.Clients.Any(l => l.Slot == ax.Index)).FirstOrDefault();
if (slotData == null)
return true;
var cl = GetClient(conn);
cl.Slot = slotData.Index;
SyncClientToPlayerReference(cl, slotData.MapPlayer != null ? Map.Players[slotData.MapPlayer] : null);
SyncLobbyInfo(); SyncLobbyInfo();
return true; return true;
}}, }},