Merge remote-tracking branch 'upstream/master' into develop
This commit is contained in:
@@ -50,8 +50,6 @@ namespace Barotrauma.Networking
|
||||
public enum NetFlags : byte
|
||||
{
|
||||
None = 0x0,
|
||||
Name = 0x1,
|
||||
Message = 0x2,
|
||||
Properties = 0x4,
|
||||
Misc = 0x8,
|
||||
LevelSeed = 0x10,
|
||||
@@ -322,24 +320,26 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
private string serverName;
|
||||
private string serverName = string.Empty;
|
||||
|
||||
[Serialize("", IsPropertySaveable.Yes)]
|
||||
public string ServerName
|
||||
{
|
||||
get { return serverName; }
|
||||
set
|
||||
{
|
||||
string val = value;
|
||||
if (val.Length > NetConfig.ServerNameMaxLength) { val = val.Substring(0, NetConfig.ServerNameMaxLength); }
|
||||
if (serverName == val) { return; }
|
||||
serverName = val;
|
||||
string newName = value;
|
||||
if (newName.Length > NetConfig.ServerNameMaxLength) { newName = newName.Substring(0, NetConfig.ServerNameMaxLength); }
|
||||
if (serverName == newName) { return; }
|
||||
if (newName.IsNullOrWhiteSpace()) { return; }
|
||||
serverName = newName;
|
||||
ServerDetailsChanged = true;
|
||||
#if SERVER
|
||||
UpdateFlag(NetFlags.Name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private string serverMessageText;
|
||||
|
||||
[Serialize("", IsPropertySaveable.Yes)]
|
||||
public string ServerMessageText
|
||||
{
|
||||
get { return serverMessageText; }
|
||||
@@ -348,11 +348,11 @@ namespace Barotrauma.Networking
|
||||
string val = value;
|
||||
if (val.Length > NetConfig.ServerMessageMaxLength) { val = val.Substring(0, NetConfig.ServerMessageMaxLength); }
|
||||
if (serverMessageText == val) { return; }
|
||||
#if SERVER
|
||||
GameMain.Server?.SendChatMessage(TextManager.AddPunctuation(':', TextManager.Get("servermotd"), val).Value, ChatMessageType.Server);
|
||||
#endif
|
||||
serverMessageText = val;
|
||||
ServerDetailsChanged = true;
|
||||
#if SERVER
|
||||
UpdateFlag(NetFlags.Message);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ namespace Barotrauma.Networking
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(50f, IsPropertySaveable.Yes)]
|
||||
[Serialize(20f, IsPropertySaveable.Yes)]
|
||||
/// <summary>
|
||||
/// How much skills drop towards the job's default skill levels when dying
|
||||
/// </summary>
|
||||
@@ -447,6 +447,18 @@ namespace Barotrauma.Networking
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(10f, IsPropertySaveable.Yes)]
|
||||
/// <summary>
|
||||
/// How much more the skills drop towards the job's default skill levels
|
||||
/// when dying, in addition to SkillLossPercentageOnDeath, if the player
|
||||
/// chooses to respawn in the middle of the round
|
||||
/// </summary>
|
||||
public float SkillLossPercentageOnImmediateRespawn
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(60.0f, IsPropertySaveable.Yes)]
|
||||
public float AutoRestartInterval
|
||||
{
|
||||
@@ -554,6 +566,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(false, IsPropertySaveable.Yes)]
|
||||
public bool AutoRestart
|
||||
{
|
||||
get { return autoRestart; }
|
||||
@@ -629,6 +642,7 @@ namespace Barotrauma.Networking
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(0.0f, IsPropertySaveable.Yes)]
|
||||
public float SelectedLevelDifficulty
|
||||
{
|
||||
get { return selectedLevelDifficulty; }
|
||||
@@ -757,13 +771,18 @@ namespace Barotrauma.Networking
|
||||
if (traitorDangerLevel == clampedValue) { return; }
|
||||
traitorDangerLevel = clampedValue;
|
||||
ServerDetailsChanged = true;
|
||||
#if CLIENT
|
||||
GameMain.NetLobbyScreen?.SetTraitorDangerLevel(traitorDangerLevel);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private int traitorsMinPlayerCount;
|
||||
[Serialize(defaultValue: 1, isSaveable: IsPropertySaveable.Yes)]
|
||||
public int TraitorsMinPlayerCount
|
||||
{
|
||||
get;
|
||||
set;
|
||||
get { return traitorsMinPlayerCount; }
|
||||
set { traitorsMinPlayerCount = MathHelper.Clamp(value, 1, NetConfig.MaxPlayers); }
|
||||
}
|
||||
|
||||
[Serialize(defaultValue: 50.0f, isSaveable: IsPropertySaveable.Yes)]
|
||||
@@ -869,7 +888,11 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
karmaEnabled = value;
|
||||
#if CLIENT
|
||||
if (karmaSettingsBlocker != null) { karmaSettingsBlocker.Visible = !karmaEnabled || karmaPresetDD.SelectedData as string != "custom"; }
|
||||
if (karmaSettingsList != null)
|
||||
{
|
||||
SetElementInteractability(karmaSettingsList.Content, !karmaEnabled || KarmaPreset != "custom");
|
||||
}
|
||||
karmaElements.ForEach(e => e.Visible = karmaEnabled);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1039,8 +1062,9 @@ namespace Barotrauma.Networking
|
||||
.OrderBy(k => CharacterPrefab.Prefabs[k].UintIdentifier)
|
||||
.ToImmutableArray();
|
||||
|
||||
public void ReadMonsterEnabled(IReadMessage inc)
|
||||
public bool ReadMonsterEnabled(IReadMessage inc)
|
||||
{
|
||||
bool changed = false;
|
||||
InitMonstersEnabled();
|
||||
var monsterNames = ExtractAndSortKeys(MonsterEnabled);
|
||||
uint receivedMonsterCount = inc.ReadVariableUInt32();
|
||||
@@ -1053,10 +1077,13 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
foreach (Identifier s in monsterNames)
|
||||
{
|
||||
MonsterEnabled.TryGetValue(s, out bool prevEnabled);
|
||||
MonsterEnabled[s] = inc.ReadBoolean();
|
||||
changed |= prevEnabled != MonsterEnabled[s];
|
||||
}
|
||||
}
|
||||
inc.ReadPadBits();
|
||||
return changed;
|
||||
}
|
||||
|
||||
public void WriteMonsterEnabled(IWriteMessage msg, Dictionary<Identifier, bool> monsterEnabled = null)
|
||||
|
||||
Reference in New Issue
Block a user