Port map difficulty to new options backend.
This commit is contained in:
@@ -506,39 +506,6 @@ namespace OpenRA.Mods.Common.Server
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{ "difficulty",
|
||||
s =>
|
||||
{
|
||||
if (server.LobbyInfo.GlobalSettings.Difficulty == s)
|
||||
return true;
|
||||
|
||||
if (!client.IsAdmin)
|
||||
{
|
||||
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
|
||||
return true;
|
||||
}
|
||||
|
||||
var mapOptions = server.Map.Rules.Actors["world"].TraitInfo<MapOptionsInfo>();
|
||||
if (mapOptions.DifficultyLocked || !mapOptions.Difficulties.Any())
|
||||
{
|
||||
server.SendOrderTo(conn, "Message", "Map has disabled difficulty configuration.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s != null && !mapOptions.Difficulties.Contains(s))
|
||||
{
|
||||
server.SendOrderTo(conn, "Message", "Invalid difficulty selected: {0}".F(s));
|
||||
server.SendOrderTo(conn, "Message", "Supported values: {0}".F(mapOptions.Difficulties.JoinWith(", ")));
|
||||
return true;
|
||||
}
|
||||
|
||||
server.LobbyInfo.GlobalSettings.Difficulty = s;
|
||||
server.SyncLobbyGlobalSettings();
|
||||
server.SendMessage("{0} changed difficulty to {1}.".F(client.Name, s));
|
||||
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{ "gamespeed",
|
||||
s =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user