Dedicated server loads the name, password and other initial settings from the serversettings file. + Fixed not being able to change the server name if the current name is null or empty
This commit is contained in:
@@ -24,8 +24,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
private NetServer server;
|
||||
private NetPeerConfiguration config;
|
||||
|
||||
private int MaxPlayers;
|
||||
|
||||
private DateTime refreshMasterTimer;
|
||||
|
||||
@@ -69,7 +67,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
get { return updateInterval; }
|
||||
}
|
||||
|
||||
|
||||
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
|
||||
{
|
||||
name = name.Replace(":", "");
|
||||
@@ -78,6 +76,7 @@ namespace Barotrauma.Networking
|
||||
AdminAuthPass = "";
|
||||
|
||||
this.name = name;
|
||||
this.Public = isPublic;
|
||||
this.password = "";
|
||||
if (password.Length>0)
|
||||
{
|
||||
|
||||
@@ -171,6 +171,27 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(8, true)]
|
||||
private int MaxPlayers
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, true)]
|
||||
private bool Public
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, true)]
|
||||
private bool AttemptUPNP
|
||||
{
|
||||
get { return config.EnableUPnP; }
|
||||
set { config.EnableUPnP = value; }
|
||||
}
|
||||
|
||||
public YesNoMaybe TraitorsEnabled
|
||||
{
|
||||
get;
|
||||
@@ -231,6 +252,10 @@ namespace Barotrauma.Networking
|
||||
|
||||
doc.Root.SetAttributeValue("TraitorsEnabled", TraitorsEnabled.ToString());
|
||||
|
||||
#if SERVER
|
||||
doc.Root.SetAttributeValue("password", password);
|
||||
#endif
|
||||
|
||||
if (GameMain.NetLobbyScreen != null
|
||||
#if CLIENT
|
||||
&& GameMain.NetLobbyScreen.ServerMessage != null
|
||||
|
||||
@@ -83,9 +83,6 @@ namespace Barotrauma.Networking
|
||||
protected DateTime updateTimer;
|
||||
|
||||
public int EndVoteCount, EndVoteMax;
|
||||
//private GUITextBlock endVoteText;
|
||||
|
||||
public int Port;
|
||||
|
||||
protected bool gameStarted;
|
||||
|
||||
@@ -94,13 +91,21 @@ namespace Barotrauma.Networking
|
||||
protected RespawnManager respawnManager;
|
||||
|
||||
public Voting Voting;
|
||||
|
||||
[HasDefaultValue(14242, true)]
|
||||
public int Port
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue("", true)]
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) return;
|
||||
if (string.IsNullOrEmpty(value)) return;
|
||||
name = value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user