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

@@ -105,7 +105,18 @@ namespace OpenRA.Mods.Common.Scripting
public bool IsSinglePlayer { get { return Context.World.LobbyInfo.IsSinglePlayer; } }
[Desc("Returns the difficulty selected by the player before starting the mission.")]
public string Difficulty { get { return Context.World.LobbyInfo.GlobalSettings.Difficulty; } }
public string Difficulty
{
get
{
Game.Debug("Map script is using deprecated Map.Difficulty API. This should be changed to Map.LobbyOption(\"difficulty\").");
Log.Write("lua", "Map script is using deprecated Map.Difficulty API. This should be changed to Map.LobbyOption(\"difficulty\").");
var option = Context.World.WorldActor.TraitsImplementing<ScriptLobbyDropdown>()
.FirstOrDefault(sld => sld.Info.ID == "difficulty");
return option != null ? option.Info.Values[option.Value] : null;
}
}
[Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")]
public LuaValue LobbyOption(string id)