Convert lobby checkboxes to new options backend.
This commit is contained in:
@@ -191,20 +191,12 @@ namespace OpenRA.Network
|
|||||||
public int Timestep = 40;
|
public int Timestep = 40;
|
||||||
public int OrderLatency = 3; // net tick frames (x 120 = ms)
|
public int OrderLatency = 3; // net tick frames (x 120 = ms)
|
||||||
public int RandomSeed = 0;
|
public int RandomSeed = 0;
|
||||||
public bool AllowCheats = false;
|
|
||||||
public bool AllowSpectators = true;
|
public bool AllowSpectators = true;
|
||||||
public bool Dedicated;
|
|
||||||
public string Difficulty;
|
public string Difficulty;
|
||||||
public bool Crates = true;
|
|
||||||
public bool Creeps = true;
|
|
||||||
public bool Shroud = true;
|
|
||||||
public bool Fog = true;
|
|
||||||
public bool AllyBuildRadius = true;
|
|
||||||
public int StartingCash = 5000;
|
public int StartingCash = 5000;
|
||||||
public string TechLevel;
|
public string TechLevel;
|
||||||
public string StartingUnitsClass;
|
public string StartingUnitsClass;
|
||||||
public string GameSpeedType = "default";
|
public string GameSpeedType = "default";
|
||||||
public bool ShortGame = true;
|
|
||||||
public bool AllowVersionMismatch;
|
public bool AllowVersionMismatch;
|
||||||
public string GameUid;
|
public string GameUid;
|
||||||
public bool DisableSingleplayer;
|
public bool DisableSingleplayer;
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ namespace OpenRA.Server
|
|||||||
RandomSeed = randomSeed,
|
RandomSeed = randomSeed,
|
||||||
Map = settings.Map,
|
Map = settings.Map,
|
||||||
ServerName = settings.Name,
|
ServerName = settings.Name,
|
||||||
Dedicated = dedicated,
|
|
||||||
DisableSingleplayer = settings.DisableSinglePlayer,
|
DisableSingleplayer = settings.DisableSinglePlayer,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,10 +9,12 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
[Desc("Attach this to the player actor.")]
|
[Desc("Attach this to the player actor.")]
|
||||||
public class DeveloperModeInfo : ITraitInfo
|
public class DeveloperModeInfo : ITraitInfo, ILobbyOptions
|
||||||
{
|
{
|
||||||
[Desc("Default value of the developer mode checkbox in the lobby.")]
|
[Desc("Default value of the developer mode checkbox in the lobby.")]
|
||||||
public bool Enabled = false;
|
public bool Enabled = false;
|
||||||
@@ -56,6 +58,11 @@ namespace OpenRA.Traits
|
|||||||
[Desc("Enable the actor tags overlay by default.")]
|
[Desc("Enable the actor tags overlay by default.")]
|
||||||
public bool ShowActorTags;
|
public bool ShowActorTags;
|
||||||
|
|
||||||
|
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||||
|
{
|
||||||
|
yield return new LobbyBooleanOption("cheats", "Debug Menu", Enabled, Locked);
|
||||||
|
}
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +113,8 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
Enabled = self.World.LobbyInfo.GlobalSettings.AllowCheats || self.World.LobbyInfo.IsSinglePlayer;
|
Enabled = self.World.LobbyInfo.IsSinglePlayer || self.World.LobbyInfo.GlobalSettings
|
||||||
|
.OptionOrDefault("cheats", info.Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -12,11 +12,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenRA.Network;
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
[Desc("Required for shroud and fog visibility checks. Add this to the player actor.")]
|
[Desc("Required for shroud and fog visibility checks. Add this to the player actor.")]
|
||||||
public class ShroudInfo : ITraitInfo
|
public class ShroudInfo : ITraitInfo, ILobbyOptions
|
||||||
{
|
{
|
||||||
[Desc("Default value of the fog checkbox in the lobby.")]
|
[Desc("Default value of the fog checkbox in the lobby.")]
|
||||||
public bool FogEnabled = true;
|
public bool FogEnabled = true;
|
||||||
@@ -30,7 +31,13 @@ namespace OpenRA.Traits
|
|||||||
[Desc("Prevent the explore map enabled state from being changed in the lobby.")]
|
[Desc("Prevent the explore map enabled state from being changed in the lobby.")]
|
||||||
public bool ExploredMapLocked = false;
|
public bool ExploredMapLocked = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Shroud(init.Self); }
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new Shroud(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Shroud : ISync, INotifyCreated
|
public class Shroud : ISync, INotifyCreated
|
||||||
@@ -38,6 +45,7 @@ namespace OpenRA.Traits
|
|||||||
public event Action<IEnumerable<PPos>> CellsChanged;
|
public event Action<IEnumerable<PPos>> CellsChanged;
|
||||||
|
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
|
readonly ShroudInfo info;
|
||||||
readonly Map map;
|
readonly Map map;
|
||||||
|
|
||||||
readonly CellLayer<short> visibleCount;
|
readonly CellLayer<short> visibleCount;
|
||||||
@@ -72,9 +80,10 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public int Hash { get; private set; }
|
public int Hash { get; private set; }
|
||||||
|
|
||||||
public Shroud(Actor self)
|
public Shroud(Actor self, ShroudInfo info)
|
||||||
{
|
{
|
||||||
this.self = self;
|
this.self = self;
|
||||||
|
this.info = info;
|
||||||
map = self.World.Map;
|
map = self.World.Map;
|
||||||
|
|
||||||
visibleCount = new CellLayer<short>(map);
|
visibleCount = new CellLayer<short>(map);
|
||||||
@@ -84,9 +93,11 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
fogEnabled = self.World.LobbyInfo.GlobalSettings.Fog;
|
var gs = self.World.LobbyInfo.GlobalSettings;
|
||||||
var shroudEnabled = self.World.LobbyInfo.GlobalSettings.Shroud;
|
fogEnabled = gs.OptionOrDefault("fog", info.FogEnabled);
|
||||||
if (!shroudEnabled)
|
|
||||||
|
var exploreMap = gs.OptionOrDefault("explored", info.ExploredMapEnabled);
|
||||||
|
if (exploreMap)
|
||||||
self.World.AddFrameEndTask(w => ExploreAll());
|
self.World.AddFrameEndTask(w => ExploreAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -465,78 +465,6 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "allowcheats",
|
|
||||||
s =>
|
|
||||||
{
|
|
||||||
if (!client.IsAdmin)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var devMode = server.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
|
|
||||||
if (devMode.Locked)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled cheat configuration.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllowCheats);
|
|
||||||
server.SyncLobbyGlobalSettings();
|
|
||||||
server.SendMessage("{0} {1} the Debug Menu."
|
|
||||||
.F(client.Name, server.LobbyInfo.GlobalSettings.AllowCheats ? "enabled" : "disabled"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "shroud",
|
|
||||||
s =>
|
|
||||||
{
|
|
||||||
if (!client.IsAdmin)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var shroud = server.Map.Rules.Actors["player"].TraitInfo<ShroudInfo>();
|
|
||||||
if (shroud.ExploredMapLocked)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled shroud configuration.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Shroud);
|
|
||||||
server.SyncLobbyGlobalSettings();
|
|
||||||
server.SendMessage("{0} {1} Explored map."
|
|
||||||
.F(client.Name, server.LobbyInfo.GlobalSettings.Shroud ? "disabled" : "enabled"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "fog",
|
|
||||||
s =>
|
|
||||||
{
|
|
||||||
if (!client.IsAdmin)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var shroud = server.Map.Rules.Actors["player"].TraitInfo<ShroudInfo>();
|
|
||||||
if (shroud.FogLocked)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled fog configuration.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Fog);
|
|
||||||
server.SyncLobbyGlobalSettings();
|
|
||||||
server.SendMessage("{0} {1} Fog of War."
|
|
||||||
.F(client.Name, server.LobbyInfo.GlobalSettings.Fog ? "enabled" : "disabled"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "assignteams",
|
{ "assignteams",
|
||||||
s =>
|
s =>
|
||||||
{
|
{
|
||||||
@@ -578,78 +506,6 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "crates",
|
|
||||||
s =>
|
|
||||||
{
|
|
||||||
if (!client.IsAdmin)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var crateSpawner = server.Map.Rules.Actors["world"].TraitInfoOrDefault<CrateSpawnerInfo>();
|
|
||||||
if (crateSpawner == null || crateSpawner.Locked)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled crate configuration.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Crates);
|
|
||||||
server.SyncLobbyGlobalSettings();
|
|
||||||
server.SendMessage("{0} {1} Crates."
|
|
||||||
.F(client.Name, server.LobbyInfo.GlobalSettings.Crates ? "enabled" : "disabled"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "creeps",
|
|
||||||
s =>
|
|
||||||
{
|
|
||||||
if (!client.IsAdmin)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var mapCreeps = server.Map.Rules.Actors["world"].TraitInfoOrDefault<MapCreepsInfo>();
|
|
||||||
if (mapCreeps == null || mapCreeps.Locked)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled Creeps spawning configuration.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Creeps);
|
|
||||||
server.SyncLobbyGlobalSettings();
|
|
||||||
server.SendMessage("{0} {1} Creeps spawning."
|
|
||||||
.F(client.Name, server.LobbyInfo.GlobalSettings.Creeps ? "enabled" : "disabled"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "allybuildradius",
|
|
||||||
s =>
|
|
||||||
{
|
|
||||||
if (!client.IsAdmin)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var mapBuildRadius = server.Map.Rules.Actors["world"].TraitInfoOrDefault<MapBuildRadiusInfo>();
|
|
||||||
if (mapBuildRadius == null || mapBuildRadius.AllyBuildRadiusLocked)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled ally build radius configuration.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllyBuildRadius);
|
|
||||||
server.SyncLobbyGlobalSettings();
|
|
||||||
server.SendMessage("{0} {1} Build off Allies' ConYards."
|
|
||||||
.F(client.Name, server.LobbyInfo.GlobalSettings.AllyBuildRadius ? "enabled" : "disabled"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "difficulty",
|
{ "difficulty",
|
||||||
s =>
|
s =>
|
||||||
{
|
{
|
||||||
@@ -1016,30 +872,6 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "shortgame",
|
|
||||||
s =>
|
|
||||||
{
|
|
||||||
if (!client.IsAdmin)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Only the host can set that option.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var mapOptions = server.Map.Rules.Actors["world"].TraitInfo<MapOptionsInfo>();
|
|
||||||
if (mapOptions.ShortGameLocked)
|
|
||||||
{
|
|
||||||
server.SendOrderTo(conn, "Message", "Map has disabled short game configuration.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.ShortGame);
|
|
||||||
server.SyncLobbyGlobalSettings();
|
|
||||||
server.SendMessage("{0} {1} Short Game."
|
|
||||||
.F(client.Name, server.LobbyInfo.GlobalSettings.ShortGame ? "enabled" : "disabled"));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ "sync_lobby",
|
{ "sync_lobby",
|
||||||
s =>
|
s =>
|
||||||
{
|
{
|
||||||
@@ -1139,30 +971,13 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
gs.LobbyOptions[o.Id] = state;
|
gs.LobbyOptions[o.Id] = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
var devMode = rules.Actors["player"].TraitInfo<DeveloperModeInfo>();
|
|
||||||
gs.AllowCheats = devMode.Enabled;
|
|
||||||
|
|
||||||
var crateSpawner = rules.Actors["world"].TraitInfoOrDefault<CrateSpawnerInfo>();
|
|
||||||
gs.Crates = crateSpawner != null && crateSpawner.Enabled;
|
|
||||||
|
|
||||||
var shroud = rules.Actors["player"].TraitInfo<ShroudInfo>();
|
|
||||||
gs.Fog = shroud.FogEnabled;
|
|
||||||
gs.Shroud = !shroud.ExploredMapEnabled;
|
|
||||||
|
|
||||||
var resources = rules.Actors["player"].TraitInfo<PlayerResourcesInfo>();
|
var resources = rules.Actors["player"].TraitInfo<PlayerResourcesInfo>();
|
||||||
gs.StartingCash = resources.DefaultCash;
|
gs.StartingCash = resources.DefaultCash;
|
||||||
|
|
||||||
var startingUnits = rules.Actors["world"].TraitInfoOrDefault<SpawnMPUnitsInfo>();
|
var startingUnits = rules.Actors["world"].TraitInfoOrDefault<SpawnMPUnitsInfo>();
|
||||||
gs.StartingUnitsClass = startingUnits == null ? "none" : startingUnits.StartingUnitsClass;
|
gs.StartingUnitsClass = startingUnits == null ? "none" : startingUnits.StartingUnitsClass;
|
||||||
|
|
||||||
var mapBuildRadius = rules.Actors["world"].TraitInfoOrDefault<MapBuildRadiusInfo>();
|
|
||||||
gs.AllyBuildRadius = mapBuildRadius != null && mapBuildRadius.AllyBuildRadiusEnabled;
|
|
||||||
|
|
||||||
var mapCreeps = rules.Actors["world"].TraitInfoOrDefault<MapCreepsInfo>();
|
|
||||||
gs.Creeps = mapCreeps != null && mapCreeps.Enabled;
|
|
||||||
|
|
||||||
var mapOptions = rules.Actors["world"].TraitInfo<MapOptionsInfo>();
|
var mapOptions = rules.Actors["world"].TraitInfo<MapOptionsInfo>();
|
||||||
gs.ShortGame = mapOptions.ShortGameEnabled;
|
|
||||||
gs.TechLevel = mapOptions.TechLevel;
|
gs.TechLevel = mapOptions.TechLevel;
|
||||||
gs.Difficulty = mapOptions.Difficulty ?? mapOptions.Difficulties.FirstOrDefault();
|
gs.Difficulty = mapOptions.Difficulty ?? mapOptions.Difficulties.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,24 +39,6 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
server.SendOrderTo(conn, "Message", options[kv.Key].Name + ": " + kv.Value.Value);
|
server.SendOrderTo(conn, "Message", options[kv.Key].Name + ": " + kv.Value.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.AllowCheats != defaults.AllowCheats)
|
|
||||||
server.SendOrderTo(conn, "Message", "Allow Cheats: {0}".F(server.LobbyInfo.GlobalSettings.AllowCheats));
|
|
||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.Shroud != defaults.Shroud)
|
|
||||||
server.SendOrderTo(conn, "Message", "Explored map: {0}".F(!server.LobbyInfo.GlobalSettings.Shroud));
|
|
||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.Fog != defaults.Fog)
|
|
||||||
server.SendOrderTo(conn, "Message", "Fog of war: {0}".F(server.LobbyInfo.GlobalSettings.Fog));
|
|
||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.Crates != defaults.Crates)
|
|
||||||
server.SendOrderTo(conn, "Message", "Crates Appear: {0}".F(server.LobbyInfo.GlobalSettings.Crates));
|
|
||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.Creeps != defaults.Creeps)
|
|
||||||
server.SendOrderTo(conn, "Message", "Creeps Spawn: {0}".F(server.LobbyInfo.GlobalSettings.Creeps));
|
|
||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.AllyBuildRadius != defaults.AllyBuildRadius)
|
|
||||||
server.SendOrderTo(conn, "Message", "Build off Ally ConYards: {0}".F(server.LobbyInfo.GlobalSettings.AllyBuildRadius));
|
|
||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.StartingUnitsClass != defaults.StartingUnitsClass)
|
if (server.LobbyInfo.GlobalSettings.StartingUnitsClass != defaults.StartingUnitsClass)
|
||||||
{
|
{
|
||||||
var startUnitsInfo = server.Map.Rules.Actors["world"].TraitInfos<MPStartUnitsInfo>();
|
var startUnitsInfo = server.Map.Rules.Actors["world"].TraitInfos<MPStartUnitsInfo>();
|
||||||
@@ -70,9 +52,6 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.TechLevel != defaults.TechLevel)
|
if (server.LobbyInfo.GlobalSettings.TechLevel != defaults.TechLevel)
|
||||||
server.SendOrderTo(conn, "Message", "Tech Level: {0}".F(server.LobbyInfo.GlobalSettings.TechLevel));
|
server.SendOrderTo(conn, "Message", "Tech Level: {0}".F(server.LobbyInfo.GlobalSettings.TechLevel));
|
||||||
|
|
||||||
if (server.LobbyInfo.GlobalSettings.ShortGame != defaults.ShortGame)
|
|
||||||
server.SendOrderTo(conn, "Message", "Short Game: {0}".F(server.LobbyInfo.GlobalSettings.ShortGame));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var map = init.World.Map;
|
var map = init.World.Map;
|
||||||
|
|
||||||
// Explore map-placed actors if the "Explore Map" option is enabled
|
// Explore map-placed actors if the "Explore Map" option is enabled
|
||||||
var exploredMap = !init.World.LobbyInfo.GlobalSettings.Shroud;
|
var shroudInfo = init.World.Map.Rules.Actors["player"].TraitInfo<ShroudInfo>();
|
||||||
|
var exploredMap = init.World.LobbyInfo.GlobalSettings.OptionOrDefault("explored", shroudInfo.ExploredMapEnabled);
|
||||||
startsRevealed = exploredMap && init.Contains<SpawnedByMapInit>() && !init.Contains<HiddenUnderFogInit>();
|
startsRevealed = exploredMap && init.Contains<SpawnedByMapInit>() && !init.Contains<HiddenUnderFogInit>();
|
||||||
var footprintCells = FootprintUtils.FrozenUnderFogTiles(init.Self).ToList();
|
var footprintCells = FootprintUtils.FrozenUnderFogTiles(init.Self).ToList();
|
||||||
footprint = footprintCells.SelectMany(c => map.ProjectedCellsCovering(c.ToMPos(map))).ToArray();
|
footprint = footprintCells.SelectMany(c => map.ProjectedCellsCovering(c.ToMPos(map))).ToArray();
|
||||||
|
|||||||
@@ -13,12 +13,13 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Mods.Common.Activities;
|
using OpenRA.Mods.Common.Activities;
|
||||||
|
using OpenRA.Network;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class CrateSpawnerInfo : ITraitInfo
|
public class CrateSpawnerInfo : ITraitInfo, ILobbyOptions
|
||||||
{
|
{
|
||||||
[Desc("Default value of the crates checkbox in the lobby.")]
|
[Desc("Default value of the crates checkbox in the lobby.")]
|
||||||
public readonly bool Enabled = true;
|
public readonly bool Enabled = true;
|
||||||
@@ -64,27 +65,39 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Spawn and remove the plane this far outside the map.")]
|
[Desc("Spawn and remove the plane this far outside the map.")]
|
||||||
public readonly WDist Cordon = new WDist(5120);
|
public readonly WDist Cordon = new WDist(5120);
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new CrateSpawner(this, init.Self); }
|
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||||
|
{
|
||||||
|
yield return new LobbyBooleanOption("crates", "Crates", Enabled, Locked);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new CrateSpawner(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CrateSpawner : ITick
|
public class CrateSpawner : ITick, INotifyCreated
|
||||||
{
|
{
|
||||||
readonly CrateSpawnerInfo info;
|
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
int crates = 0;
|
readonly CrateSpawnerInfo info;
|
||||||
int ticks = 0;
|
bool enabled;
|
||||||
|
int crates;
|
||||||
|
int ticks;
|
||||||
|
|
||||||
public CrateSpawner(CrateSpawnerInfo info, Actor self)
|
public CrateSpawner(Actor self, CrateSpawnerInfo info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
|
||||||
this.self = self;
|
this.self = self;
|
||||||
|
this.info = info;
|
||||||
|
|
||||||
ticks = info.InitialSpawnDelay;
|
ticks = info.InitialSpawnDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void INotifyCreated.Created(Actor self)
|
||||||
|
{
|
||||||
|
enabled = self.World.LobbyInfo.GlobalSettings
|
||||||
|
.OptionOrDefault("crates", info.Enabled);
|
||||||
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (!self.World.LobbyInfo.GlobalSettings.Crates)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (--ticks <= 0)
|
if (--ticks <= 0)
|
||||||
|
|||||||
@@ -15,22 +15,36 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Controls the build radius checkboxes in the lobby options.")]
|
[Desc("Controls the build radius checkboxes in the lobby options.")]
|
||||||
public class MapBuildRadiusInfo : TraitInfo<MapBuildRadius>
|
public class MapBuildRadiusInfo : ITraitInfo, ILobbyOptions
|
||||||
{
|
{
|
||||||
[Desc("Default value of the ally build radius checkbox in the lobby.")]
|
[Desc("Default value of the ally build radius checkbox in the lobby.")]
|
||||||
public readonly bool AllyBuildRadiusEnabled = true;
|
public readonly bool AllyBuildRadiusEnabled = true;
|
||||||
|
|
||||||
[Desc("Prevent the ally build radius state from being changed in the lobby.")]
|
[Desc("Prevent the ally build radius state from being changed in the lobby.")]
|
||||||
public readonly bool AllyBuildRadiusLocked = false;
|
public readonly bool AllyBuildRadiusLocked = false;
|
||||||
|
|
||||||
|
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||||
|
{
|
||||||
|
yield return new LobbyBooleanOption("allybuild", "Build off Allies' ConYards", AllyBuildRadiusEnabled, AllyBuildRadiusLocked);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new MapBuildRadius(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapBuildRadius : INotifyCreated
|
public class MapBuildRadius : INotifyCreated
|
||||||
{
|
{
|
||||||
|
readonly MapBuildRadiusInfo info;
|
||||||
public bool AllyBuildRadiusEnabled { get; private set; }
|
public bool AllyBuildRadiusEnabled { get; private set; }
|
||||||
|
|
||||||
|
public MapBuildRadius(MapBuildRadiusInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
AllyBuildRadiusEnabled = self.World.LobbyInfo.GlobalSettings.AllyBuildRadius;
|
AllyBuildRadiusEnabled = self.World.LobbyInfo.GlobalSettings
|
||||||
|
.OptionOrDefault("allybuild", info.AllyBuildRadiusEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,22 +15,36 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Controls the 'Creeps' checkbox in the lobby options.")]
|
[Desc("Controls the 'Creeps' checkbox in the lobby options.")]
|
||||||
public class MapCreepsInfo : TraitInfo<MapCreeps>
|
public class MapCreepsInfo : ITraitInfo, ILobbyOptions
|
||||||
{
|
{
|
||||||
[Desc("Default value of the creeps checkbox in the lobby.")]
|
[Desc("Default value of the creeps checkbox in the lobby.")]
|
||||||
public readonly bool Enabled = true;
|
public readonly bool Enabled = true;
|
||||||
|
|
||||||
[Desc("Prevent the creeps state from being changed in the lobby.")]
|
[Desc("Prevent the creeps state from being changed in the lobby.")]
|
||||||
public readonly bool Locked = false;
|
public readonly bool Locked = false;
|
||||||
|
|
||||||
|
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||||
|
{
|
||||||
|
yield return new LobbyBooleanOption("creeps", "Worms", Enabled, Locked);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new MapCreeps(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapCreeps : INotifyCreated
|
public class MapCreeps : INotifyCreated
|
||||||
{
|
{
|
||||||
|
readonly MapCreepsInfo info;
|
||||||
public bool Enabled { get; private set; }
|
public bool Enabled { get; private set; }
|
||||||
|
|
||||||
|
public MapCreeps(MapCreepsInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
Enabled = self.World.LobbyInfo.GlobalSettings.Creeps;
|
Enabled = self.World.LobbyInfo.GlobalSettings
|
||||||
|
.OptionOrDefault("creeps", info.Enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Controls the map difficulty, tech level, and short game lobby options.")]
|
[Desc("Controls the map difficulty, tech level, and short game lobby options.")]
|
||||||
public class MapOptionsInfo : TraitInfo<MapOptions>
|
public class MapOptionsInfo : ITraitInfo, ILobbyOptions
|
||||||
{
|
{
|
||||||
[Desc("Default value of the short game checkbox in the lobby.")]
|
[Desc("Default value of the short game checkbox in the lobby.")]
|
||||||
public readonly bool ShortGameEnabled = true;
|
public readonly bool ShortGameEnabled = true;
|
||||||
@@ -37,15 +37,30 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
[Desc("Prevent the difficulty from being changed in the lobby.")]
|
[Desc("Prevent the difficulty from being changed in the lobby.")]
|
||||||
public readonly bool DifficultyLocked = false;
|
public readonly bool DifficultyLocked = false;
|
||||||
|
|
||||||
|
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)
|
||||||
|
{
|
||||||
|
yield return new LobbyBooleanOption("shortgame", "Short Game", ShortGameEnabled, ShortGameLocked);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new MapOptions(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapOptions : INotifyCreated
|
public class MapOptions : INotifyCreated
|
||||||
{
|
{
|
||||||
|
readonly MapOptionsInfo info;
|
||||||
|
|
||||||
public bool ShortGame { get; private set; }
|
public bool ShortGame { get; private set; }
|
||||||
|
|
||||||
|
public MapOptions(MapOptionsInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
ShortGame = self.World.LobbyInfo.GlobalSettings.ShortGame;
|
ShortGame = self.World.LobbyInfo.GlobalSettings
|
||||||
|
.OptionOrDefault("shortgame", info.ShortGameEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,12 +75,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Debug/Cheats tab
|
// Debug/Cheats tab
|
||||||
if (lp != null && world.LobbyInfo.GlobalSettings.AllowCheats)
|
// Can't use DeveloperMode.Enabled because there is a hardcoded hack to *always*
|
||||||
|
// enable developer mode for singleplayer games, but we only want to show the button
|
||||||
|
// if it has been explicitly enabled
|
||||||
|
var def = world.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>().Enabled;
|
||||||
|
var developerEnabled = world.LobbyInfo.GlobalSettings.OptionOrDefault("cheats", def);
|
||||||
|
if (lp != null && developerEnabled)
|
||||||
{
|
{
|
||||||
numTabs++;
|
numTabs++;
|
||||||
var debugTabButton = widget.Get<ButtonWidget>(string.Concat("BUTTON", numTabs.ToString()));
|
var debugTabButton = widget.Get<ButtonWidget>(string.Concat("BUTTON", numTabs.ToString()));
|
||||||
debugTabButton.Text = "Debug";
|
debugTabButton.Text = "Debug";
|
||||||
debugTabButton.IsVisible = () => lp != null && world.LobbyInfo.GlobalSettings.AllowCheats && numTabs > 1 && !hasError;
|
debugTabButton.IsVisible = () => lp != null && numTabs > 1 && !hasError;
|
||||||
debugTabButton.IsDisabled = () => world.IsGameOver;
|
debugTabButton.IsDisabled = () => world.IsGameOver;
|
||||||
debugTabButton.OnClick = () => activePanel = IngameInfoPanel.Debug;
|
debugTabButton.OnClick = () => activePanel = IngameInfoPanel.Debug;
|
||||||
debugTabButton.IsHighlighted = () => activePanel == IngameInfoPanel.Debug;
|
debugTabButton.IsHighlighted = () => activePanel == IngameInfoPanel.Debug;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||||
@@ -67,7 +68,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var debug = widget.GetOrNull<MenuButtonWidget>("DEBUG_BUTTON");
|
var debug = widget.GetOrNull<MenuButtonWidget>("DEBUG_BUTTON");
|
||||||
if (debug != null)
|
if (debug != null)
|
||||||
{
|
{
|
||||||
debug.IsVisible = () => world.LobbyInfo.GlobalSettings.AllowCheats;
|
// Can't use DeveloperMode.Enabled because there is a hardcoded hack to *always*
|
||||||
|
// enable developer mode for singleplayer games, but we only want to show the button
|
||||||
|
// if it has been explicitly enabled
|
||||||
|
var def = world.Map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>().Enabled;
|
||||||
|
var enabled = world.LobbyInfo.GlobalSettings.OptionOrDefault("cheats", def);
|
||||||
|
debug.IsVisible = () => enabled;
|
||||||
debug.IsDisabled = () => disableSystemButtons;
|
debug.IsDisabled = () => disableSystemButtons;
|
||||||
debug.OnClick = () => OpenMenuPanel(debug, new WidgetArgs()
|
debug.OnClick = () => OpenMenuPanel(debug, new WidgetArgs()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -347,73 +347,31 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
forceStartBin.Get<ButtonWidget>("CANCEL_BUTTON").OnClick = () => panel = PanelType.Players;
|
forceStartBin.Get<ButtonWidget>("CANCEL_BUTTON").OnClick = () => panel = PanelType.Players;
|
||||||
|
|
||||||
// Options panel
|
// Options panel
|
||||||
var allowCheats = optionsBin.GetOrNull<CheckboxWidget>("ALLOWCHEATS_CHECKBOX");
|
var optionCheckboxes = new Dictionary<string, string>()
|
||||||
if (allowCheats != null)
|
|
||||||
{
|
{
|
||||||
var cheatsLocked = new CachedTransform<MapPreview, bool>(
|
{ "EXPLORED_MAP_CHECKBOX", "explored" },
|
||||||
map => map.Rules.Actors["player"].TraitInfo<DeveloperModeInfo>().Locked);
|
{ "CRATES_CHECKBOX", "crates" },
|
||||||
|
{ "SHORTGAME_CHECKBOX", "shortgame" },
|
||||||
|
{ "FOG_CHECKBOX", "fog" },
|
||||||
|
{ "ALLYBUILDRADIUS_CHECKBOX", "allybuild" },
|
||||||
|
{ "ALLOWCHEATS_CHECKBOX", "cheats" },
|
||||||
|
{ "CREEPS_CHECKBOX", "creeps" },
|
||||||
|
};
|
||||||
|
|
||||||
allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats;
|
foreach (var kv in optionCheckboxes)
|
||||||
allowCheats.IsDisabled = () => configurationDisabled() || cheatsLocked.Update(Map);
|
|
||||||
allowCheats.OnClick = () => orderManager.IssueOrder(Order.Command(
|
|
||||||
"allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats)));
|
|
||||||
}
|
|
||||||
|
|
||||||
var crates = optionsBin.GetOrNull<CheckboxWidget>("CRATES_CHECKBOX");
|
|
||||||
if (crates != null)
|
|
||||||
{
|
{
|
||||||
var cratesLocked = new CachedTransform<MapPreview, bool>(map =>
|
var checkbox = optionsBin.GetOrNull<CheckboxWidget>(kv.Key);
|
||||||
|
if (checkbox != null)
|
||||||
{
|
{
|
||||||
var crateSpawner = map.Rules.Actors["world"].TraitInfoOrDefault<CrateSpawnerInfo>();
|
var option = new CachedTransform<Session.Global, Session.LobbyOptionState>(
|
||||||
return crateSpawner == null || crateSpawner.Locked;
|
gs => gs.LobbyOptions[kv.Value]);
|
||||||
});
|
|
||||||
|
|
||||||
crates.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Crates;
|
checkbox.IsChecked = () => option.Update(orderManager.LobbyInfo.GlobalSettings).Enabled;
|
||||||
crates.IsDisabled = () => configurationDisabled() || cratesLocked.Update(Map);
|
checkbox.IsDisabled = () => configurationDisabled() ||
|
||||||
crates.OnClick = () => orderManager.IssueOrder(Order.Command(
|
option.Update(orderManager.LobbyInfo.GlobalSettings).Locked;
|
||||||
"crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates)));
|
checkbox.OnClick = () => orderManager.IssueOrder(Order.Command(
|
||||||
}
|
"option {0} {1}".F(kv.Value, !option.Update(orderManager.LobbyInfo.GlobalSettings).Enabled)));
|
||||||
|
}
|
||||||
var creeps = optionsBin.GetOrNull<CheckboxWidget>("CREEPS_CHECKBOX");
|
|
||||||
if (creeps != null)
|
|
||||||
{
|
|
||||||
var creepsLocked = new CachedTransform<MapPreview, bool>(map =>
|
|
||||||
{
|
|
||||||
var mapCreeps = map.Rules.Actors["world"].TraitInfoOrDefault<MapCreepsInfo>();
|
|
||||||
return mapCreeps == null || mapCreeps.Locked;
|
|
||||||
});
|
|
||||||
|
|
||||||
creeps.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Creeps;
|
|
||||||
creeps.IsDisabled = () => configurationDisabled() || creepsLocked.Update(Map);
|
|
||||||
creeps.OnClick = () => orderManager.IssueOrder(Order.Command(
|
|
||||||
"creeps {0}".F(!orderManager.LobbyInfo.GlobalSettings.Creeps)));
|
|
||||||
}
|
|
||||||
|
|
||||||
var allybuildradius = optionsBin.GetOrNull<CheckboxWidget>("ALLYBUILDRADIUS_CHECKBOX");
|
|
||||||
if (allybuildradius != null)
|
|
||||||
{
|
|
||||||
var allyBuildRadiusLocked = new CachedTransform<MapPreview, bool>(map =>
|
|
||||||
{
|
|
||||||
var mapBuildRadius = map.Rules.Actors["world"].TraitInfoOrDefault<MapBuildRadiusInfo>();
|
|
||||||
return mapBuildRadius == null || mapBuildRadius.AllyBuildRadiusLocked;
|
|
||||||
});
|
|
||||||
|
|
||||||
allybuildradius.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllyBuildRadius;
|
|
||||||
allybuildradius.IsDisabled = () => configurationDisabled() || allyBuildRadiusLocked.Update(Map);
|
|
||||||
allybuildradius.OnClick = () => orderManager.IssueOrder(Order.Command(
|
|
||||||
"allybuildradius {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllyBuildRadius)));
|
|
||||||
}
|
|
||||||
|
|
||||||
var shortGame = optionsBin.GetOrNull<CheckboxWidget>("SHORTGAME_CHECKBOX");
|
|
||||||
if (shortGame != null)
|
|
||||||
{
|
|
||||||
var shortGameLocked = new CachedTransform<MapPreview, bool>(
|
|
||||||
map => map.Rules.Actors["world"].TraitInfo<MapOptionsInfo>().ShortGameLocked);
|
|
||||||
|
|
||||||
shortGame.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.ShortGame;
|
|
||||||
shortGame.IsDisabled = () => configurationDisabled() || shortGameLocked.Update(Map);
|
|
||||||
shortGame.OnClick = () => orderManager.IssueOrder(Order.Command(
|
|
||||||
"shortgame {0}".F(!orderManager.LobbyInfo.GlobalSettings.ShortGame)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var difficulty = optionsBin.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
|
var difficulty = optionsBin.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
|
||||||
@@ -593,30 +551,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var exploredMap = optionsBin.GetOrNull<CheckboxWidget>("EXPLORED_MAP_CHECKBOX");
|
|
||||||
if (exploredMap != null)
|
|
||||||
{
|
|
||||||
var exploredMapLocked = new CachedTransform<MapPreview, bool>(
|
|
||||||
map => map.Rules.Actors["player"].TraitInfo<ShroudInfo>().ExploredMapLocked);
|
|
||||||
|
|
||||||
exploredMap.IsChecked = () => !orderManager.LobbyInfo.GlobalSettings.Shroud;
|
|
||||||
exploredMap.IsDisabled = () => configurationDisabled() || exploredMapLocked.Update(Map);
|
|
||||||
exploredMap.OnClick = () => orderManager.IssueOrder(Order.Command(
|
|
||||||
"shroud {0}".F(!orderManager.LobbyInfo.GlobalSettings.Shroud)));
|
|
||||||
}
|
|
||||||
|
|
||||||
var enableFog = optionsBin.GetOrNull<CheckboxWidget>("FOG_CHECKBOX");
|
|
||||||
if (enableFog != null)
|
|
||||||
{
|
|
||||||
var fogLocked = new CachedTransform<MapPreview, bool>(
|
|
||||||
map => map.Rules.Actors["player"].TraitInfo<ShroudInfo>().FogLocked);
|
|
||||||
|
|
||||||
enableFog.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Fog;
|
|
||||||
enableFog.IsDisabled = () => configurationDisabled() || fogLocked.Update(Map);
|
|
||||||
enableFog.OnClick = () => orderManager.IssueOrder(Order.Command(
|
|
||||||
"fog {0}".F(!orderManager.LobbyInfo.GlobalSettings.Fog)));
|
|
||||||
}
|
|
||||||
|
|
||||||
var disconnectButton = lobby.Get<ButtonWidget>("DISCONNECT_BUTTON");
|
var disconnectButton = lobby.Get<ButtonWidget>("DISCONNECT_BUTTON");
|
||||||
disconnectButton.OnClick = () => { CloseWindow(); onExit(); };
|
disconnectButton.OnClick = () => { CloseWindow(); onExit(); };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user