Added buildradius checkbox to lobby options

This commit is contained in:
kosti1
2017-10-18 11:14:02 +03:00
committed by abcdefg30
parent b8326bfead
commit 6a750d7a65
7 changed files with 153 additions and 7 deletions

View File

@@ -23,9 +23,17 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Prevent the ally build radius state from being changed in the lobby.")]
public readonly bool AllyBuildRadiusLocked = false;
[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;
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
{
yield return new LobbyBooleanOption("allybuild", "Build off Allies' ConYards", AllyBuildRadiusEnabled, AllyBuildRadiusLocked);
yield return new LobbyBooleanOption("buildradius", "Limit ConYard Area", BuildRadiusEnabled, BuildRadiusLocked);
}
public object Create(ActorInitializer init) { return new MapBuildRadius(this); }
@@ -35,6 +43,7 @@ namespace OpenRA.Mods.Common.Traits
{
readonly MapBuildRadiusInfo info;
public bool AllyBuildRadiusEnabled { get; private set; }
public bool BuildRadiusEnabled { get; private set; }
public MapBuildRadius(MapBuildRadiusInfo info)
{
@@ -45,6 +54,8 @@ namespace OpenRA.Mods.Common.Traits
{
AllyBuildRadiusEnabled = self.World.LobbyInfo.GlobalSettings
.OptionOrDefault("allybuild", info.AllyBuildRadiusEnabled);
BuildRadiusEnabled = self.World.LobbyInfo.GlobalSettings
.OptionOrDefault("buildradius", info.BuildRadiusEnabled);
}
}
}