Add ScriptLobbyDropdown trait and lua API.
This commit is contained in:
@@ -107,6 +107,18 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Returns the difficulty selected by the player before starting the mission.")]
|
||||
public string Difficulty { get { return Context.World.LobbyInfo.GlobalSettings.Difficulty; } }
|
||||
|
||||
[Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")]
|
||||
public LuaValue LobbyOption(string id)
|
||||
{
|
||||
var option = Context.World.WorldActor.TraitsImplementing<ScriptLobbyDropdown>()
|
||||
.FirstOrDefault(sld => sld.Info.ID == id);
|
||||
|
||||
if (option == null)
|
||||
throw new YamlException("A ScriptLobbyDropdown with ID `" + id + "` was not found.");
|
||||
|
||||
return option.Value;
|
||||
}
|
||||
|
||||
[Desc("Returns a table of all the actors that were specified in the map file.")]
|
||||
public Actor[] NamedActors { get { return sma.Actors.Values.ToArray(); } }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user