Fixes to server settings. Closes #225
- Selected mode and mission type settings are saved and loaded. - RandomizeSeed setting can be changed via the debug console and it also has an effect in the dedicated server. - Dedicated server randomizes sub & mode settings if their selection modes are set to random.
This commit is contained in:
@@ -500,14 +500,6 @@ namespace Barotrauma
|
||||
if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(0);
|
||||
|
||||
GameMain.Server.Voting.ResetVotes(GameMain.Server.ConnectedClients);
|
||||
|
||||
if (GameMain.Server.RandomizeSeed) LevelSeed = ToolBox.RandomSeed(8);
|
||||
if (GameMain.Server.SubSelectionMode == SelectionMode.Random)
|
||||
{
|
||||
var nonShuttles = subList.children.FindAll(c => c.UserData is Submarine && !((Submarine)c.UserData).HasTag(SubmarineTag.Shuttle));
|
||||
subList.Select(nonShuttles[Rand.Range(0, nonShuttles.Count)].UserData);
|
||||
}
|
||||
if (GameMain.Server.ModeSelectionMode == SelectionMode.Random) modeList.Select(Rand.Range(0, modeList.CountChildren));
|
||||
}
|
||||
else if (GameMain.Client != null)
|
||||
{
|
||||
@@ -526,6 +518,23 @@ namespace Barotrauma
|
||||
|
||||
base.Select();
|
||||
}
|
||||
|
||||
public void RandomizeSettings()
|
||||
{
|
||||
if (GameMain.Server == null) return;
|
||||
|
||||
if (GameMain.Server.RandomizeSeed) LevelSeed = ToolBox.RandomSeed(8);
|
||||
if (GameMain.Server.SubSelectionMode == SelectionMode.Random)
|
||||
{
|
||||
var nonShuttles = subList.children.FindAll(c => c.UserData is Submarine && !((Submarine)c.UserData).HasTag(SubmarineTag.Shuttle));
|
||||
subList.Select(nonShuttles[Rand.Range(0, nonShuttles.Count)].UserData);
|
||||
}
|
||||
if (GameMain.Server.ModeSelectionMode == SelectionMode.Random)
|
||||
{
|
||||
var allowedGameModes = GameModePreset.list.FindAll(m => !m.IsSinglePlayer && m.Name != "Campaign");
|
||||
modeList.Select(allowedGameModes[Rand.Range(0, allowedGameModes.Count)]);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowSpectateButton()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user