Port map difficulty to new options backend.

This commit is contained in:
Paul Chote
2016-06-12 20:31:55 +01:00
parent 1d1b97cb6a
commit 8ce4ab0bd1
31 changed files with 263 additions and 111 deletions

View File

@@ -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 =>
{