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 // Send initial ping
SendOrderTo(newConn, "Ping", Game.RunTime.ToString()); SendOrderTo(newConn, "Ping", Game.RunTime.ToString());
// Send Lobby info to newly connected client
if (!client.IsAdmin)
NotifyNewClientOfLobbyInfo(newConn);
if (Settings.Dedicated) if (Settings.Dedicated)
{ {
var motdFile = Path.Combine(Platform.SupportDir, "motd.txt"); var motdFile = Path.Combine(Platform.SupportDir, "motd.txt");
@@ -355,6 +359,19 @@ namespace OpenRA.Server
catch (Exception) { DropClient(newConn); } 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() void SetOrderLag()
{ {
if (LobbyInfo.IsSinglePlayer) if (LobbyInfo.IsSinglePlayer)

View File

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