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

@@ -377,14 +377,24 @@ namespace OpenRA.Server
{ "race",
s =>
{
GetClient(conn).Country = s;
GetClient(conn).Country = s;
SyncLobbyInfo();
return true;
}},
{ "spectator",
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();
return true;
}},