Use lobby option display values when clients join
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Server;
|
||||
@@ -31,17 +30,14 @@ namespace OpenRA.Mods.Common.Server
|
||||
|
||||
var options = server.Map.Rules.Actors["player"].TraitInfos<ILobbyOptions>()
|
||||
.Concat(server.Map.Rules.Actors["world"].TraitInfos<ILobbyOptions>())
|
||||
.SelectMany(t => t.LobbyOptions(server.Map.Rules));
|
||||
|
||||
var optionNames = new Dictionary<string, string>();
|
||||
foreach (var o in options)
|
||||
optionNames[o.Id] = o.Name;
|
||||
.SelectMany(t => t.LobbyOptions(server.Map.Rules))
|
||||
.ToDictionary(o => o.Id, o => o);
|
||||
|
||||
foreach (var kv in server.LobbyInfo.GlobalSettings.LobbyOptions)
|
||||
{
|
||||
if (!defaults.LobbyOptions.TryGetValue(kv.Key, out var def) || kv.Value.Value != def.Value)
|
||||
if (optionNames.TryGetValue(kv.Key, out var optionName))
|
||||
server.SendOrderTo(conn, "Message", optionName + ": " + kv.Value.Value);
|
||||
if (options.TryGetValue(kv.Key, out var option))
|
||||
server.SendOrderTo(conn, "Message", option.Name + ": " + option.Values[kv.Value.Value]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user