v1.4.4.1 (Blood in the Water Update)
This commit is contained in:
@@ -89,7 +89,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public readonly List<SubmarineInfo> ServerSubmarines = new List<SubmarineInfo>();
|
||||
|
||||
public string ServerName { get; private set; }
|
||||
public string ServerName => ServerSettings.ServerName;
|
||||
|
||||
private bool canStart;
|
||||
|
||||
@@ -270,11 +270,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
otherClients = new List<Client>();
|
||||
|
||||
ServerSettings = new ServerSettings(this, "Server", 0, 0, 0, false, false);
|
||||
ServerSettings = new ServerSettings(this, serverName, 0, 0, 0, false, false);
|
||||
Voting = new Voting();
|
||||
|
||||
serverEndpoints = endpoints;
|
||||
InitiateServerJoin(serverName);
|
||||
InitiateServerJoin();
|
||||
|
||||
//ServerLog = new ServerLog("");
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace Barotrauma.Networking
|
||||
return serverInfo;
|
||||
}
|
||||
|
||||
private void InitiateServerJoin(string hostName)
|
||||
private void InitiateServerJoin()
|
||||
{
|
||||
LastClientListUpdateID = 0;
|
||||
|
||||
@@ -306,8 +306,6 @@ namespace Barotrauma.Networking
|
||||
GameMain.NetLobbyScreen.ChatInput.Enabled = false;
|
||||
}
|
||||
|
||||
ServerName = hostName;
|
||||
|
||||
myCharacter = Character.Controlled;
|
||||
ChatMessage.LastID = 0;
|
||||
|
||||
@@ -318,9 +316,8 @@ namespace Barotrauma.Networking
|
||||
CoroutineManager.StartCoroutine(WaitForStartingInfo(), "WaitForStartingInfo");
|
||||
}
|
||||
|
||||
public void SetLobbyPublic(bool isPublic)
|
||||
public static void SetLobbyPublic(bool isPublic)
|
||||
{
|
||||
GameMain.NetLobbyScreen.SetPublic(isPublic);
|
||||
SteamManager.SetLobbyPublic(isPublic);
|
||||
}
|
||||
|
||||
@@ -723,7 +720,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (readyToStart && !CoroutineManager.IsCoroutineRunning("WaitForStartRound"))
|
||||
{
|
||||
CoroutineManager.StartCoroutine(GameMain.NetLobbyScreen.WaitForStartRound(startButton: null), "WaitForStartRound");
|
||||
CoroutineManager.StartCoroutine(NetLobbyScreen.WaitForStartRound(startButton: null), "WaitForStartRound");
|
||||
}
|
||||
break;
|
||||
case ServerPacketHeader.STARTGAME:
|
||||
@@ -1096,7 +1093,7 @@ namespace Barotrauma.Networking
|
||||
var prevContentPackages = ClientPeer.ServerContentPackages;
|
||||
//decrement lobby update ID to make sure we update the lobby when we reconnect
|
||||
GameMain.NetLobbyScreen.LastUpdateID--;
|
||||
InitiateServerJoin(ServerName);
|
||||
InitiateServerJoin();
|
||||
if (ClientPeer != null)
|
||||
{
|
||||
//restore the previous list of content packages so we can reconnect immediately without having to recheck that the packages match
|
||||
@@ -1189,7 +1186,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (!CoroutineManager.IsCoroutineRunning("WaitForStartingInfo"))
|
||||
{
|
||||
InitiateServerJoin(ServerName);
|
||||
InitiateServerJoin();
|
||||
yield return new WaitForSeconds(5.0f);
|
||||
}
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
@@ -1253,7 +1250,7 @@ namespace Barotrauma.Networking
|
||||
if (!(this.permittedConsoleCommands.Any(c => !permittedConsoleCommands.Contains(c)) ||
|
||||
permittedConsoleCommands.Any(c => !this.permittedConsoleCommands.Contains(c))))
|
||||
{
|
||||
if (newPermissions == permissions) return;
|
||||
if (newPermissions == permissions) { return; }
|
||||
}
|
||||
|
||||
bool refreshCampaignUI = permissions.HasFlag(ClientPermissions.ManageCampaign) != newPermissions.HasFlag(ClientPermissions.ManageCampaign) ||
|
||||
@@ -1335,6 +1332,8 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
GameMain.NetLobbyScreen.RefreshEnabledElements();
|
||||
//close settings menu in case it was open
|
||||
ServerSettings.Close();
|
||||
OnPermissionChanged.Invoke(new PermissionChangedEvent(permissions, this.permittedConsoleCommands));
|
||||
}
|
||||
|
||||
@@ -2025,18 +2024,15 @@ namespace Barotrauma.Networking
|
||||
GameMain.NetLobbyScreen.LastUpdateID = updateID;
|
||||
|
||||
ServerSettings.ServerLog.ServerName = ServerSettings.ServerName;
|
||||
|
||||
if (!GameMain.NetLobbyScreen.ServerName.Selected) { GameMain.NetLobbyScreen.ServerName.Text = ServerSettings.ServerName; }
|
||||
if (!GameMain.NetLobbyScreen.ServerMessage.Selected) { GameMain.NetLobbyScreen.ServerMessage.Text = ServerSettings.ServerMessageText; }
|
||||
GameMain.NetLobbyScreen.UsingShuttle = usingShuttle;
|
||||
|
||||
if (!allowSubVoting) { GameMain.NetLobbyScreen.TrySelectSub(selectSubName, selectSubHash, GameMain.NetLobbyScreen.SubList); }
|
||||
if (!allowSubVoting || GameMain.NetLobbyScreen.SelectedSub == null) { GameMain.NetLobbyScreen.TrySelectSub(selectSubName, selectSubHash, GameMain.NetLobbyScreen.SubList); }
|
||||
GameMain.NetLobbyScreen.TrySelectSub(selectShuttleName, selectShuttleHash, GameMain.NetLobbyScreen.ShuttleList.ListBox);
|
||||
|
||||
GameMain.NetLobbyScreen.SetTraitorProbability(traitorProbability);
|
||||
GameMain.NetLobbyScreen.SetTraitorDangerLevel(traitorDangerLevel);
|
||||
|
||||
GameMain.NetLobbyScreen.SetMissionType(missionType);
|
||||
GameMain.NetLobbyScreen.LevelSeed = levelSeed;
|
||||
|
||||
GameMain.NetLobbyScreen.SelectMode(modeIndex);
|
||||
if (isInitialUpdate && GameMain.NetLobbyScreen.SelectedMode == GameModePreset.MultiPlayerCampaign)
|
||||
@@ -2053,7 +2049,6 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
GameMain.NetLobbyScreen.SetAllowSpectating(allowSpectating);
|
||||
GameMain.NetLobbyScreen.LevelSeed = levelSeed;
|
||||
GameMain.NetLobbyScreen.SetLevelDifficulty(levelDifficulty);
|
||||
GameMain.NetLobbyScreen.SetBotSpawnMode(botSpawnMode);
|
||||
GameMain.NetLobbyScreen.SetBotCount(botCount);
|
||||
@@ -2574,12 +2569,17 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
public override void CreateEntityEvent(INetSerializable entity, NetEntityEvent.IData extraData = null)
|
||||
{
|
||||
CreateEntityEvent(entity, extraData, requireControlledCharacter: true);
|
||||
}
|
||||
|
||||
public void CreateEntityEvent(INetSerializable entity, NetEntityEvent.IData extraData, bool requireControlledCharacter)
|
||||
{
|
||||
if (entity is not IClientSerializable clientSerializable)
|
||||
{
|
||||
throw new InvalidCastException($"Entity is not {nameof(IClientSerializable)}");
|
||||
}
|
||||
EntityEventManager.CreateEvent(clientSerializable, extraData);
|
||||
EntityEventManager.CreateEvent(clientSerializable, extraData, requireControlledCharacter);
|
||||
}
|
||||
|
||||
public bool HasPermission(ClientPermissions permission)
|
||||
@@ -2703,9 +2703,19 @@ namespace Barotrauma.Networking
|
||||
|
||||
public override void AddChatMessage(ChatMessage message)
|
||||
{
|
||||
base.AddChatMessage(message);
|
||||
|
||||
if (string.IsNullOrEmpty(message.Text)) { return; }
|
||||
if (message.Sender != null && !message.Sender.IsDead)
|
||||
{
|
||||
if (message.Text.IsNullOrEmpty())
|
||||
{
|
||||
message.Sender.ShowTextlessSpeechBubble(2.0f, message.Color);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
message.Sender.ShowSpeechBubble(message.Color, message.Text);
|
||||
}
|
||||
}
|
||||
GameMain.NetLobbyScreen.NewChatMessage(message);
|
||||
chatBox.AddMessage(message);
|
||||
}
|
||||
@@ -2894,7 +2904,7 @@ namespace Barotrauma.Networking
|
||||
ClientPeer.Send(msg, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
public bool SpectateClicked(GUIButton button, object _)
|
||||
public bool JoinOnGoingClicked(GUIButton button, object _)
|
||||
{
|
||||
MultiPlayerCampaign campaign =
|
||||
GameMain.NetLobbyScreen.SelectedMode == GameMain.GameSession?.GameMode.Preset ?
|
||||
@@ -3283,17 +3293,36 @@ namespace Barotrauma.Networking
|
||||
|
||||
private void CreateSelectionRelatedButtons(Client client, GUIComponent frame)
|
||||
{
|
||||
var content = new GUIFrame(new RectTransform(new Vector2(1f, 1.0f - frame.RectTransform.RelativeSize.Y), frame.RectTransform, Anchor.BottomCenter, Pivot.TopCenter),
|
||||
style: null);
|
||||
var content = new GUILayoutGroup(new RectTransform(new Vector2(1f, 1.0f - frame.RectTransform.RelativeSize.Y), frame.RectTransform, Anchor.BottomCenter, Pivot.TopCenter), childAnchor: Anchor.TopCenter);
|
||||
|
||||
var mute = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.5f), content.RectTransform, Anchor.TopCenter),
|
||||
var mute = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.2f), content.RectTransform, Anchor.TopCenter),
|
||||
TextManager.Get("Mute"))
|
||||
{
|
||||
Selected = client.MutedLocally,
|
||||
OnSelected = (tickBox) => { client.MutedLocally = tickBox.Selected; return true; }
|
||||
};
|
||||
|
||||
var volumeLayout = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.45f), content.RectTransform, Anchor.TopCenter), isHorizontal: false);
|
||||
|
||||
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.35f), content.RectTransform, Anchor.BottomCenter), isHorizontal: true, childAnchor: Anchor.BottomLeft)
|
||||
var volumeTextLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.5f), volumeLayout.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1f), volumeTextLayout.RectTransform), TextManager.Get("VoiceChatVolume"));
|
||||
var percentageText = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1f), volumeTextLayout.RectTransform), ToolBox.GetFormattedPercentage(client.VoiceVolume), textAlignment: Alignment.Right);
|
||||
|
||||
var volumeSlider = new GUIScrollBar(new RectTransform(new Vector2(1f, 0.5f), volumeLayout.RectTransform), barSize: 0.1f, style: "GUISlider")
|
||||
{
|
||||
Range = new Vector2(0f, 1f),
|
||||
BarScroll = client.VoiceVolume / Client.MaxVoiceChatBoost,
|
||||
OnMoved = (_, barScroll) =>
|
||||
{
|
||||
float newVolume = barScroll * Client.MaxVoiceChatBoost;
|
||||
|
||||
client.VoiceVolume = newVolume;
|
||||
percentageText.Text = ToolBox.GetFormattedPercentage(newVolume);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.35f), content.RectTransform), isHorizontal: true, childAnchor: Anchor.BottomLeft)
|
||||
{
|
||||
RelativeSpacing = 0.05f,
|
||||
Stretch = true
|
||||
@@ -3327,7 +3356,7 @@ namespace Barotrauma.Networking
|
||||
TextManager.Get("Ban"), style: "GUIButtonSmall")
|
||||
{
|
||||
UserData = client,
|
||||
OnClicked = (btn, userdata) => { GameMain.NetLobbyScreen.BanPlayer(client); return false; }
|
||||
OnClicked = (btn, userdata) => { NetLobbyScreen.BanPlayer(client); return false; }
|
||||
};
|
||||
}
|
||||
if (HasPermission(ClientPermissions.Kick) && client.AllowKicking)
|
||||
@@ -3336,7 +3365,7 @@ namespace Barotrauma.Networking
|
||||
TextManager.Get("Kick"), style: "GUIButtonSmall")
|
||||
{
|
||||
UserData = client,
|
||||
OnClicked = (btn, userdata) => { GameMain.NetLobbyScreen.KickPlayer(client); return false; }
|
||||
OnClicked = (btn, userdata) => { NetLobbyScreen.KickPlayer(client); return false; }
|
||||
};
|
||||
}
|
||||
else if (ServerSettings.AllowVoteKick && client.AllowKicking)
|
||||
|
||||
Reference in New Issue
Block a user