Add additional metadata to lobby options.
This commit is contained in:
@@ -24,6 +24,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Prevent the developer mode state from being changed in the lobby.")]
|
||||
public bool Locked = false;
|
||||
|
||||
[Desc("Whether to display the developer mode checkbox in the lobby.")]
|
||||
public bool Visible = true;
|
||||
|
||||
[Desc("Display order for the developer mode checkbox in the lobby.")]
|
||||
public int DisplayOrder = 0;
|
||||
|
||||
[Desc("Default cash bonus granted by the give cash cheat.")]
|
||||
public int Cash = 20000;
|
||||
|
||||
@@ -50,7 +56,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("cheats", "Debug Menu", Enabled, Locked);
|
||||
yield return new LobbyBooleanOption("cheats", "Debug Menu",
|
||||
"Enables cheats and developer commands",
|
||||
Visible, DisplayOrder, Enabled, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
||||
|
||||
@@ -27,6 +27,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Prevent the crates state from being changed in the lobby.")]
|
||||
public readonly bool Locked = false;
|
||||
|
||||
[Desc("Whether to display the crates checkbox in the lobby.")]
|
||||
public readonly bool Visible = true;
|
||||
|
||||
[Desc("Display order for the crates checkbox in the lobby.")]
|
||||
public readonly int DisplayOrder = 0;
|
||||
|
||||
[Desc("Minimum number of crates.")]
|
||||
public readonly int Minimum = 1;
|
||||
|
||||
@@ -67,7 +73,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("crates", "Crates", Enabled, Locked);
|
||||
yield return new LobbyBooleanOption("crates", "Crates",
|
||||
"Collect crates with units to recieve random bonuses or penalties",
|
||||
Visible, DisplayOrder, Enabled, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new CrateSpawner(init.Self, this); }
|
||||
|
||||
@@ -23,17 +23,33 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Prevent the ally build radius state from being changed in the lobby.")]
|
||||
public readonly bool AllyBuildRadiusLocked = false;
|
||||
|
||||
[Desc("Whether to display the ally build radius checkbox in the lobby.")]
|
||||
public readonly bool AllyBuildRadiusVisible = true;
|
||||
|
||||
[Desc("Display order for the ally build radius checkbox in the lobby.")]
|
||||
public readonly int AllyBuildRadiusDisplayOrder = 0;
|
||||
|
||||
[Desc("Default value of the build radius checkbox in the lobby.")]
|
||||
public readonly bool BuildRadiusEnabled = true;
|
||||
|
||||
[Desc("Prevent the build radius state from being changed in the lobby.")]
|
||||
public readonly bool BuildRadiusLocked = false;
|
||||
|
||||
[Desc("Display the build radius checkbox in the lobby.")]
|
||||
public readonly bool BuildRadiusVisible = true;
|
||||
|
||||
[Desc("Display order for the build radius checkbox in the lobby.")]
|
||||
public readonly int BuildRadiusDisplayOrder = 0;
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("allybuild", "Build off Allies' ConYards", AllyBuildRadiusEnabled, AllyBuildRadiusLocked);
|
||||
yield return new LobbyBooleanOption("allybuild", "Build off Allies", "Allow allies to place structures inside your build area",
|
||||
AllyBuildRadiusVisible, AllyBuildRadiusDisplayOrder,
|
||||
AllyBuildRadiusEnabled, AllyBuildRadiusLocked);
|
||||
|
||||
yield return new LobbyBooleanOption("buildradius", "Limit ConYard Area", BuildRadiusEnabled, BuildRadiusLocked);
|
||||
yield return new LobbyBooleanOption("buildradius", "Limit Build Area", "Limits structure placement to areas around Construction Yards",
|
||||
BuildRadiusVisible, BuildRadiusDisplayOrder,
|
||||
BuildRadiusEnabled, BuildRadiusLocked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new MapBuildRadius(this); }
|
||||
|
||||
@@ -23,9 +23,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Prevent the creeps state from being changed in the lobby.")]
|
||||
public readonly bool Locked = false;
|
||||
|
||||
[Desc("Whether to display the creeps checkbox in the lobby.")]
|
||||
public readonly bool Visible = true;
|
||||
|
||||
[Desc("Display order for the creeps checkbox in the lobby.")]
|
||||
public readonly int DisplayOrder = 0;
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("creeps", "Worms", Enabled, Locked);
|
||||
yield return new LobbyBooleanOption("creeps", "Worms", "Worms roam the map and devour unprepared forces",
|
||||
Visible, DisplayOrder, Enabled, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new MapCreeps(this); }
|
||||
|
||||
@@ -24,27 +24,48 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Prevent the short game enabled state from being changed in the lobby.")]
|
||||
public readonly bool ShortGameLocked = false;
|
||||
|
||||
[Desc("Whether to display the short game checkbox in the lobby.")]
|
||||
public readonly bool ShortGameVisible = true;
|
||||
|
||||
[Desc("Display order for the short game checkbox in the lobby.")]
|
||||
public readonly int ShortGameDisplayOrder = 0;
|
||||
|
||||
[Desc("Default tech level.")]
|
||||
public readonly string TechLevel = "unrestricted";
|
||||
|
||||
[Desc("Prevent the tech level from being changed in the lobby.")]
|
||||
public readonly bool TechLevelLocked = false;
|
||||
|
||||
[Desc("Display the tech level option in the lobby.")]
|
||||
public readonly bool TechLevelVisible = true;
|
||||
|
||||
[Desc("Display order for the tech level option in the lobby.")]
|
||||
public readonly int TechLevelDisplayOrder = 0;
|
||||
|
||||
[Desc("Default game speed.")]
|
||||
public readonly string GameSpeed = "default";
|
||||
|
||||
[Desc("Prevent the game speed from being changed in the lobby.")]
|
||||
public readonly bool GameSpeedLocked = false;
|
||||
|
||||
[Desc("Display the game speed option in the lobby.")]
|
||||
public readonly bool GameSpeedVisible = true;
|
||||
|
||||
[Desc("Display order for the game speed option in the lobby.")]
|
||||
public readonly int GameSpeedDisplayOrder = 0;
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyBooleanOption("shortgame", "Short Game", ShortGameEnabled, ShortGameLocked);
|
||||
yield return new LobbyBooleanOption("shortgame", "Short Game", "Players are defeated when their bases are destroyed",
|
||||
ShortGameVisible, ShortGameDisplayOrder,
|
||||
ShortGameEnabled, ShortGameLocked);
|
||||
|
||||
var techLevels = rules.Actors["player"].TraitInfos<ProvidesTechPrerequisiteInfo>()
|
||||
.ToDictionary(t => t.Id, t => t.Name);
|
||||
|
||||
if (techLevels.Any())
|
||||
yield return new LobbyOption("techlevel", "Tech Level",
|
||||
yield return new LobbyOption("techlevel", "Tech Level", "Change the units and abilities at your disposal",
|
||||
TechLevelVisible, TechLevelDisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(techLevels),
|
||||
TechLevel, TechLevelLocked);
|
||||
|
||||
@@ -52,7 +73,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.ToDictionary(s => s.Key, s => s.Value.Name);
|
||||
|
||||
// NOTE: The server hardcodes special-case logic for this option id
|
||||
yield return new LobbyOption("gamespeed", "Game Speed",
|
||||
yield return new LobbyOption("gamespeed", "Game Speed", "Change the rate at which time passes",
|
||||
GameSpeedVisible, GameSpeedDisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(gameSpeeds),
|
||||
GameSpeed, GameSpeedLocked);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string ID = null;
|
||||
|
||||
[FieldLoader.Require]
|
||||
[Desc("Display name for this option.")]
|
||||
[Desc("Descriptive label for this option.")]
|
||||
public readonly string Label = null;
|
||||
|
||||
[Desc("Tooltip description for this option.")]
|
||||
public readonly string Description = null;
|
||||
|
||||
[FieldLoader.Require]
|
||||
[Desc("Default option key in the `Values` list.")]
|
||||
public readonly string Default = null;
|
||||
@@ -37,11 +40,18 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Prevent the option from being changed from its default value.")]
|
||||
public readonly bool Locked = false;
|
||||
|
||||
[Desc("Whether to display the option in the lobby.")]
|
||||
public readonly bool Visible = true;
|
||||
|
||||
[Desc("Display order for the option in the lobby.")]
|
||||
public readonly int DisplayOrder = 0;
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
yield return new LobbyOption(ID, Label,
|
||||
yield return new LobbyOption(ID, Label, Description,
|
||||
Visible, DisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(Values),
|
||||
Default, Locked);
|
||||
Default, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new ScriptLobbyDropdown(this); }
|
||||
|
||||
@@ -26,6 +26,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Prevent the starting units option from being changed in the lobby.")]
|
||||
public bool Locked = false;
|
||||
|
||||
[Desc("Whether to display the starting units option in the lobby.")]
|
||||
public bool Visible = true;
|
||||
|
||||
[Desc("Display order for the starting units option in the lobby.")]
|
||||
public int DisplayOrder = 0;
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||
{
|
||||
var startingUnits = new Dictionary<string, string>();
|
||||
@@ -35,7 +41,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
startingUnits[t.Class] = t.ClassName;
|
||||
|
||||
if (startingUnits.Any())
|
||||
yield return new LobbyOption("startingunits", "Starting Units", new ReadOnlyDictionary<string, string>(startingUnits), StartingUnitsClass, Locked);
|
||||
yield return new LobbyOption("startingunits", "Starting Units", "Change the units that you start the game with",
|
||||
Visible, DisplayOrder,
|
||||
new ReadOnlyDictionary<string, string>(startingUnits),
|
||||
StartingUnitsClass, Locked);
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new SpawnMPUnits(this); }
|
||||
|
||||
Reference in New Issue
Block a user