(8efab43bb) Added "setmaxplayers" command, allow clients to use "setpassword" and remove password protection if the password argument is empty.

This commit is contained in:
Joonas Rikkonen
2019-06-16 18:06:40 +03:00
parent 29a5bc7497
commit 0f73fe356e
3 changed files with 51 additions and 9 deletions
@@ -611,6 +611,7 @@ namespace Barotrauma.Networking
public int MaxPlayers
{
get { return maxPlayers; }
set { maxPlayers = MathHelper.Clamp(value, 1, NetConfig.MaxPlayers); }
}
public List<MissionType> AllowedRandomMissionTypes
@@ -635,7 +636,14 @@ namespace Barotrauma.Networking
public void SetPassword(string password)
{
this.password = Encoding.UTF8.GetString(NetUtility.ComputeSHAHash(Encoding.UTF8.GetBytes(password)));
if (string.IsNullOrEmpty(password))
{
this.password = "";
}
else
{
this.password = Encoding.UTF8.GetString(NetUtility.ComputeSHAHash(Encoding.UTF8.GetBytes(password)));
}
}
public bool IsPasswordCorrect(string input, int nonce)