Inform client about changes in lobby options

This commit is contained in:
havok13888
2014-07-29 23:13:26 -05:00
parent de1c80af88
commit 65c77677d4
2 changed files with 34 additions and 0 deletions

View File

@@ -336,6 +336,10 @@ namespace OpenRA.Server
// Send initial ping
SendOrderTo(newConn, "Ping", Game.RunTime.ToString());
// Send Lobby info to newly connected client
if (!client.IsAdmin)
NotifyNewClientOfLobbyInfo(newConn);
if (Settings.Dedicated)
{
var motdFile = Path.Combine(Platform.SupportDir, "motd.txt");
@@ -355,6 +359,19 @@ namespace OpenRA.Server
catch (Exception) { DropClient(newConn); }
}
void NotifyNewClientOfLobbyInfo(Connection newConn)
{
SendOrderTo(newConn, "Message", "Diplomacy Changes: {0}".F(LobbyInfo.GlobalSettings.FragileAlliances));
SendOrderTo(newConn, "Message", "Allow Cheats: {0}".F(LobbyInfo.GlobalSettings.AllowCheats));
SendOrderTo(newConn, "Message", "Shroud: {0}".F(LobbyInfo.GlobalSettings.Shroud));
SendOrderTo(newConn, "Message", "Fog of war: {0}".F(LobbyInfo.GlobalSettings.Fog));
SendOrderTo(newConn, "Message", "Crates Appear: {0}".F(LobbyInfo.GlobalSettings.Crates));
SendOrderTo(newConn, "Message", "Build off Ally ConYards: {0}".F(LobbyInfo.GlobalSettings.AllyBuildRadius));
SendOrderTo(newConn, "Message", "Starting Units: {0}".F(LobbyInfo.GlobalSettings.StartingUnitsClass));
SendOrderTo(newConn, "Message", "Starting Cash: ${0}".F(LobbyInfo.GlobalSettings.StartingCash));
SendOrderTo(newConn, "Message", "Tech Level: {0}".F(LobbyInfo.GlobalSettings.TechLevel));
}
void SetOrderLag()
{
if (LobbyInfo.IsSinglePlayer)

View File

@@ -354,6 +354,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.FragileAlliances);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Diplomacy Changes> to {1}.".F(client.Name, s));
return true;
}},
{ "allowcheats",
@@ -373,6 +375,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllowCheats);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Allow Cheats> to {1}.".F(client.Name, s));
return true;
}},
{ "shroud",
@@ -392,6 +396,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Shroud);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Shroud> to {1}.".F(client.Name, s));
return true;
}},
{ "fog",
@@ -412,6 +418,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Fog);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Fog of War> to {1}.".F(client.Name, s));
return true;
}},
{ "assignteams",
@@ -472,6 +480,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Crates);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Crates Appear> to {1}.".F(client.Name, s));
return true;
}},
{ "allybuildradius",
@@ -491,6 +501,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllyBuildRadius);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Build off Ally ConYards> to {1}.".F(client.Name, s));
return true;
}},
{ "difficulty",
@@ -530,6 +542,8 @@ namespace OpenRA.Mods.RA.Server
server.LobbyInfo.GlobalSettings.StartingUnitsClass = s;
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Starting Units> to {1}.".F(client.Name, s));
return true;
}},
{ "startingcash",
@@ -549,6 +563,7 @@ namespace OpenRA.Mods.RA.Server
server.LobbyInfo.GlobalSettings.StartingCash = Exts.ParseIntegerInvariant(s);
server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Starting Cash> to ${1}.".F(client.Name, s));
return true;
}},
@@ -569,6 +584,8 @@ namespace OpenRA.Mods.RA.Server
server.LobbyInfo.GlobalSettings.TechLevel = s;
server.SyncLobbyInfo();
server.SendMessage("{0} modified <Tech Level> to {1}.".F(client.Name, s));
return true;
}},
{ "kick",