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:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -71,9 +72,10 @@ namespace Barotrauma
|
||||
public int MissionTypeIndex
|
||||
{
|
||||
get { return missionTypeIndex; }
|
||||
set {
|
||||
set
|
||||
{
|
||||
lastUpdateID++;
|
||||
missionTypeIndex = Math.Max(0, Math.Min(Mission.MissionTypes.Count()-1, value));
|
||||
missionTypeIndex = Math.Max(0, Math.Min(Mission.MissionTypes.Count() - 1, value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,5 +174,21 @@ namespace Barotrauma
|
||||
|
||||
lastUpdateID++;
|
||||
}
|
||||
|
||||
public void RandomizeSettings()
|
||||
{
|
||||
if (GameMain.Server.RandomizeSeed) LevelSeed = ToolBox.RandomSeed(8);
|
||||
|
||||
if (GameMain.Server.SubSelectionMode == SelectionMode.Random)
|
||||
{
|
||||
var nonShuttles = Submarine.SavedSubmarines.FindAll(c => !c.HasTag(SubmarineTag.Shuttle) && !c.HasTag(SubmarineTag.HideInMenus));
|
||||
SelectedSub = nonShuttles[Rand.Range(0, nonShuttles.Count)];
|
||||
}
|
||||
if (GameMain.Server.ModeSelectionMode == SelectionMode.Random)
|
||||
{
|
||||
var allowedGameModes = Array.FindAll(gameModes, m => !m.IsSinglePlayer && m.Name != "Campaign");
|
||||
SelectedModeName = allowedGameModes[Rand.Range(0, allowedGameModes.Length)].Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user