Fallback to normal difficulty when none is set.
This commit is contained in:
committed by
Gustas
parent
b30285e38d
commit
0fb5853b7a
@@ -120,6 +120,18 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
return option.Value;
|
return option.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby or fallback to a default value.")]
|
||||||
|
public LuaValue LobbyOptionOrDefault(string id, string fallback)
|
||||||
|
{
|
||||||
|
var option = Context.World.WorldActor.TraitsImplementing<ScriptLobbyDropdown>()
|
||||||
|
.FirstOrDefault(sld => sld.Info.ID == id);
|
||||||
|
|
||||||
|
if (option == null)
|
||||||
|
return fallback;
|
||||||
|
|
||||||
|
return option.Value;
|
||||||
|
}
|
||||||
|
|
||||||
[Desc("Returns a table of all the actors that were specified in the map file.")]
|
[Desc("Returns a table of all the actors that were specified in the map file.")]
|
||||||
public Actor[] NamedActors => sma.Actors.Values.ToArray();
|
public Actor[] NamedActors => sma.Actors.Values.ToArray();
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
information, see COPYING.
|
information, see COPYING.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
Difficulty = Map.LobbyOption("difficulty")
|
Difficulty = Map.LobbyOptionOrDefault("difficulty", "normal")
|
||||||
|
|
||||||
InitObjectives = function(player)
|
InitObjectives = function(player)
|
||||||
Trigger.OnObjectiveCompleted(player, function(p, id)
|
Trigger.OnObjectiveCompleted(player, function(p, id)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
information, see COPYING.
|
information, see COPYING.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
Difficulty = Map.LobbyOption("difficulty")
|
Difficulty = Map.LobbyOptionOrDefault("difficulty", "normal")
|
||||||
|
|
||||||
InitObjectives = function(player)
|
InitObjectives = function(player)
|
||||||
Trigger.OnObjectiveCompleted(player, function(p, id)
|
Trigger.OnObjectiveCompleted(player, function(p, id)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
information, see COPYING.
|
information, see COPYING.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
Difficulty = Map.LobbyOption("difficulty")
|
Difficulty = Map.LobbyOptionOrDefault("difficulty", "normal")
|
||||||
|
|
||||||
InitObjectives = function(player)
|
InitObjectives = function(player)
|
||||||
Trigger.OnObjectiveCompleted(player, function(p, id)
|
Trigger.OnObjectiveCompleted(player, function(p, id)
|
||||||
|
|||||||
Reference in New Issue
Block a user