Add additional metadata to lobby options.

This commit is contained in:
Paul Chote
2017-12-09 20:17:39 +00:00
committed by reaperrr
parent b71b2ad523
commit 97cdce7448
19 changed files with 171 additions and 18 deletions

View File

@@ -26,6 +26,12 @@ namespace OpenRA.Traits
[Desc("Force the DefaultCash option by disabling changes in the lobby.")]
public readonly bool DefaultCashLocked = false;
[Desc("Whether to display the DefaultCash option in the lobby.")]
public readonly bool DefaultCashVisible = true;
[Desc("Display order for the DefaultCash option.")]
public readonly int DefaultCashDisplayOrder = 0;
[Desc("Speech notification to play when the player does not have any funds.")]
public readonly string InsufficientFundsNotification = null;
@@ -37,7 +43,10 @@ namespace OpenRA.Traits
var startingCash = SelectableCash.ToDictionary(c => c.ToString(), c => "$" + c.ToString());
if (startingCash.Any())
yield return new LobbyOption("startingcash", "Starting Cash", new ReadOnlyDictionary<string, string>(startingCash), DefaultCash.ToString(), DefaultCashLocked);
yield return new LobbyOption("startingcash", "Starting Cash", "Change the amount of cash that players start with",
DefaultCashVisible, DefaultCashDisplayOrder,
new ReadOnlyDictionary<string, string>(startingCash),
DefaultCash.ToString(), DefaultCashLocked);
}
public object Create(ActorInitializer init) { return new PlayerResources(init.Self, this); }

View File

@@ -23,16 +23,32 @@ namespace OpenRA.Traits
[Desc("Prevent the fog enabled state from being changed in the lobby.")]
public bool FogLocked = false;
[Desc("Whether to display the fog checkbox in the lobby.")]
public bool FogVisible = true;
[Desc("Display order for the fog checkbox in the lobby.")]
public int FogDisplayOrder = 0;
[Desc("Default value of the explore map checkbox in the lobby.")]
public bool ExploredMapEnabled = false;
[Desc("Prevent the explore map enabled state from being changed in the lobby.")]
public bool ExploredMapLocked = false;
[Desc("Whether to display the explore map checkbox in the lobby.")]
public bool ExploredMapVisible = true;
[Desc("Display order for the explore map checkbox in the lobby.")]
public int ExploredMapDisplayOrder = 0;
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
{
yield return new LobbyBooleanOption("explored", "Explored Map", ExploredMapEnabled, ExploredMapLocked);
yield return new LobbyBooleanOption("fog", "Fog of War", FogEnabled, FogLocked);
yield return new LobbyBooleanOption("explored", "Explored Map", "Initial map shroud is revealed",
ExploredMapVisible, ExploredMapDisplayOrder,
ExploredMapEnabled, ExploredMapLocked);
yield return new LobbyBooleanOption("fog", "Fog of War", "Line of sight is required to view enemy forces",
FogVisible, FogDisplayOrder,
FogEnabled, FogLocked);
}
public object Create(ActorInitializer init) { return new Shroud(init.Self, this); }

View File

@@ -389,14 +389,21 @@ namespace OpenRA.Traits
{
public readonly string Id;
public readonly string Name;
public readonly string Description;
public readonly IReadOnlyDictionary<string, string> Values;
public readonly string DefaultValue;
public readonly bool Locked;
public readonly bool Visible;
public readonly int DisplayOrder;
public LobbyOption(string id, string name, IReadOnlyDictionary<string, string> values, string defaultValue, bool locked)
public LobbyOption(string id, string name, string description, bool visible, int displayorder,
IReadOnlyDictionary<string, string> values, string defaultValue, bool locked)
{
Id = id;
Name = name;
Description = description;
Visible = visible;
DisplayOrder = displayorder;
Values = values;
DefaultValue = defaultValue;
Locked = locked;
@@ -416,8 +423,8 @@ namespace OpenRA.Traits
{ false.ToString(), "disabled" }
};
public LobbyBooleanOption(string id, string name, bool defaultValue, bool locked)
: base(id, name, new ReadOnlyDictionary<string, string>(BoolValues), defaultValue.ToString(), locked) { }
public LobbyBooleanOption(string id, string name, string description, bool visible, int displayorder, bool defaultValue, bool locked)
: base(id, name, description, visible, displayorder, new ReadOnlyDictionary<string, string>(BoolValues), defaultValue.ToString(), locked) { }
public override string ValueChangedMessage(string playerName, string newValue)
{

View File

@@ -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); }

View File

@@ -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); }

View File

@@ -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); }

View File

@@ -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); }

View File

@@ -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);
}

View File

@@ -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); }

View File

@@ -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); }

View File

@@ -10,8 +10,10 @@ Player:
AllyRepair:
PlayerResources:
DeveloperMode:
DisplayOrder: 6
BaseAttackNotifier:
Shroud:
FogDisplayOrder: 3
PlayerStatistics:
FrozenActorLayer:
PlaceBeacon:

View File

@@ -77,9 +77,15 @@ World:
WarheadDebugOverlay:
CustomTerrainDebugOverlay:
MapCreeps:
Visible: False
SpawnMapActors:
MapBuildRadius:
AllyBuildRadiusDisplayOrder: 4
BuildRadiusDisplayOrder: 5
MapOptions:
ShortGameDisplayOrder: 2
TechLevelDisplayOrder: 2
GameSpeedDisplayOrder: 3
MPStartLocations:
CreateMPPlayers:
MPStartUnits@mcvonly:
@@ -125,12 +131,14 @@ World:
SupportActors: e1,e1,e1,e1,e1,e2,e2,e2,e3,e3,apc,mtnk
SpawnMPUnits:
StartingUnitsClass: light
DisplayOrder: 0
CrateSpawner:
Minimum: 1
Maximum: 6
SpawnInterval: 3000
WaterChance: 0
InitialSpawnDelay: 1500
DisplayOrder: 1
PathFinder:
ValidateOrder:
DebugPauseState:

View File

@@ -63,8 +63,10 @@ Player:
SelectableCash: 2500, 5000, 7000, 10000, 20000
InsufficientFundsNotification: InsufficientFunds
DeveloperMode:
DisplayOrder: 6
BaseAttackNotifier:
Shroud:
FogDisplayOrder: 3
FrozenActorLayer:
HarvesterAttackNotifier:
PlayerStatistics:

View File

@@ -80,6 +80,7 @@ World:
WaterChance: 0
ValidGround: Sand, Rock, Transition, Spice, SpiceSand, Dune, Concrete
InitialSpawnDelay: 1500
DisplayOrder: 1
DomainIndex:
WarheadDebugOverlay:
BuildableTerrainLayer:
@@ -95,9 +96,15 @@ World:
Sequence: sandcraters
SmokePercentage: 0
MapCreeps:
DisplayOrder: 5
SpawnMapActors:
MapBuildRadius:
AllyBuildRadiusDisplayOrder: 4
BuildRadiusVisible: False
MapOptions:
ShortGameDisplayOrder: 2
TechLevelDisplayOrder: 2
GameSpeedDisplayOrder: 3
CreateMPPlayers:
MPStartLocations:
MPStartUnits@mcv:
@@ -154,6 +161,7 @@ World:
InnerSupportRadius: 3
OuterSupportRadius: 5
SpawnMPUnits:
DisplayOrder: 1
PathFinder:
ValidateOrder:
DebugPauseState:

View File

@@ -43,6 +43,7 @@ World:
ScriptLobbyDropdown@difficulty:
ID: difficulty
Label: Difficulty
Description: Change the difficulty of the mission
Values:
hard: Hard (4P)
normal: Normal (3P)
@@ -51,6 +52,7 @@ World:
tough: Real tough guy
endless: Endless mode
Default: hard
DisplayOrder: 5
FORTCRATE:
Inherits: ^Crate

View File

@@ -43,8 +43,10 @@ Player:
PlayerResources:
InsufficientFundsNotification: InsufficientFunds
DeveloperMode:
DisplayOrder: 6
GpsWatcher:
Shroud:
FogDisplayOrder: 3
FrozenActorLayer:
BaseAttackNotifier:
PlayerStatistics:

View File

@@ -112,6 +112,7 @@ World:
SpawnInterval: 3000
WaterChance: 20
InitialSpawnDelay: 1500
DisplayOrder: 1
DomainIndex:
SmudgeLayer@SCORCH:
Type: Scorch
@@ -125,7 +126,12 @@ World:
WarheadDebugOverlay:
SpawnMapActors:
MapBuildRadius:
AllyBuildRadiusDisplayOrder: 4
BuildRadiusDisplayOrder: 5
MapOptions:
ShortGameDisplayOrder: 2
TechLevelDisplayOrder: 2
GameSpeedDisplayOrder: 3
CreateMPPlayers:
MPStartUnits@mcvonly:
Class: none
@@ -166,6 +172,7 @@ World:
OuterSupportRadius: 5
MPStartLocations:
SpawnMPUnits:
DisplayOrder: 1
PathFinder:
ValidateOrder:
DebugPauseState:

View File

@@ -44,7 +44,9 @@ Player:
InsufficientFundsNotification: InsufficientFunds
DeveloperMode:
Enabled: true
DisplayOrder: 6
Shroud:
FogDisplayOrder: 3
FrozenActorLayer:
BaseAttackNotifier:
AllyNotification: OurAllyIsUnderAttack

View File

@@ -111,9 +111,15 @@ World:
ResourceClaimLayer:
WarheadDebugOverlay:
MapCreeps:
Visible: False
SpawnMapActors:
MapBuildRadius:
AllyBuildRadiusDisplayOrder: 4
BuildRadiusDisplayOrder: 5
MapOptions:
ShortGameDisplayOrder: 2
TechLevelDisplayOrder: 2
GameSpeedDisplayOrder: 3
CreateMPPlayers:
MPStartUnits@MCV:
Class: none
@@ -170,6 +176,7 @@ World:
OuterSupportRadius: 5
MPStartLocations:
SpawnMPUnits:
DisplayOrder: 1
CrateSpawner:
Minimum: 1
Maximum: 6
@@ -177,6 +184,7 @@ World:
WaterChance: 0
ValidGround: Clear, Rough, Road, DirtRoad, Tiberium, BlueTiberium
InitialSpawnDelay: 1500
DisplayOrder: 1
PathFinder:
ValidateOrder:
DebugPauseState: