Add Server.EnableMapGeneration setting.
This commit is contained in:
committed by
Gustas Kažukauskas
parent
924c79b0ad
commit
85e16032c2
@@ -213,9 +213,10 @@ namespace OpenRA.Network
|
||||
public bool AllowSpectators = true;
|
||||
public string GameUid;
|
||||
public bool EnableSingleplayer;
|
||||
public bool EnableMapGeneration;
|
||||
public bool EnableGameSaves;
|
||||
public bool EnableSyncReports;
|
||||
public bool Dedicated;
|
||||
public bool GameSavesEnabled;
|
||||
|
||||
// 120ms network frame interval for 40ms local tick
|
||||
public int NetFrameInterval = 3;
|
||||
|
||||
@@ -331,6 +331,7 @@ namespace OpenRA.Server
|
||||
RandomSeed = randomSeed,
|
||||
ServerName = settings.Name,
|
||||
EnableSingleplayer = settings.EnableSingleplayer || Type != ServerType.Dedicated,
|
||||
EnableMapGeneration = settings.EnableMapGeneration,
|
||||
EnableSyncReports = settings.EnableSyncReports,
|
||||
GameUid = Guid.NewGuid().ToString(),
|
||||
Dedicated = Type == ServerType.Dedicated
|
||||
@@ -1122,6 +1123,9 @@ namespace OpenRA.Server
|
||||
if (!GetClient(conn).IsAdmin || State >= ServerState.GameStarted)
|
||||
break;
|
||||
|
||||
if (!LobbyInfo.GlobalSettings.EnableMapGeneration)
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
var yaml = new MiniYaml(o.OrderString, MiniYaml.FromString(o.TargetString, o.OrderString));
|
||||
@@ -1336,7 +1340,7 @@ namespace OpenRA.Server
|
||||
|
||||
// Enable game saves for singleplayer missions only
|
||||
// TODO: Enable for multiplayer (non-dedicated servers only) once the lobby UI has been created
|
||||
LobbyInfo.GlobalSettings.GameSavesEnabled = Type != ServerType.Dedicated && LobbyInfo.NonBotClients.Count() == 1;
|
||||
LobbyInfo.GlobalSettings.EnableGameSaves = Type != ServerType.Dedicated && LobbyInfo.NonBotClients.Count() == 1;
|
||||
|
||||
// Player list for win/loss tracking
|
||||
// HACK: NonCombatant and non-Playable players are set to null to simplify replay tracking
|
||||
@@ -1381,7 +1385,7 @@ namespace OpenRA.Server
|
||||
if (IsMultiplayer)
|
||||
OrderLatency = gameSpeed.OrderLatency;
|
||||
|
||||
if (GameSave == null && LobbyInfo.GlobalSettings.GameSavesEnabled)
|
||||
if (GameSave == null && LobbyInfo.GlobalSettings.EnableGameSaves)
|
||||
GameSave = new GameSave();
|
||||
|
||||
var startGameData = "";
|
||||
|
||||
@@ -129,6 +129,9 @@ namespace OpenRA
|
||||
[Desc("For dedicated servers only, controls whether a game can be started with just one human player in the lobby.")]
|
||||
public bool EnableSingleplayer = false;
|
||||
|
||||
[Desc("Controls whether generated maps can be used.")]
|
||||
public bool EnableMapGeneration = true;
|
||||
|
||||
[Desc("Query map information from the Resource Center if they are not available locally.")]
|
||||
public bool QueryMapRepository = true;
|
||||
|
||||
|
||||
@@ -401,7 +401,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
void CreateLoadGameButton()
|
||||
{
|
||||
if (world.Type != WorldType.Regular || !world.LobbyInfo.GlobalSettings.GameSavesEnabled || world.IsReplay)
|
||||
if (world.Type != WorldType.Regular || !world.LobbyInfo.GlobalSettings.EnableGameSaves || world.IsReplay)
|
||||
return;
|
||||
|
||||
var button = AddButton("LOAD_GAME", LoadGameButton);
|
||||
@@ -421,7 +421,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
void CreateSaveGameButton()
|
||||
{
|
||||
if (world.Type != WorldType.Regular || !world.LobbyInfo.GlobalSettings.GameSavesEnabled || world.IsReplay)
|
||||
if (world.Type != WorldType.Regular || !world.LobbyInfo.GlobalSettings.EnableGameSaves || world.IsReplay)
|
||||
return;
|
||||
|
||||
var button = AddButton("SAVE_GAME", SaveGameButton);
|
||||
|
||||
@@ -272,6 +272,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
// Check for updated maps, if the user has edited a map we'll preselect it for them
|
||||
modData.MapCache.UpdateMaps();
|
||||
|
||||
var enableMapGenerator = Game.IsHost && orderManager.LobbyInfo.GlobalSettings.EnableMapGeneration;
|
||||
Ui.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs()
|
||||
{
|
||||
{ "initialMap", modData.MapCache.PickLastModifiedMap(MapVisibility.Lobby) ?? map.Uid },
|
||||
@@ -280,7 +281,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "initialTab", MapClassification.System },
|
||||
{ "onExit", modData.MapCache.UpdateMaps },
|
||||
{ "onSelect", Game.IsHost ? onSelect : null },
|
||||
{ "onSelectGenerated", Game.IsHost ? onSelectGenerated : null },
|
||||
{ "onSelectGenerated", enableMapGenerator ? onSelectGenerated : null },
|
||||
{ "filter", MapVisibility.Lobby },
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user