Merge remote-tracking branch 'upstream/master' into develop

This commit is contained in:
EvilFactory
2024-04-26 12:31:21 -03:00
16 changed files with 97 additions and 50 deletions
@@ -2331,6 +2331,29 @@ namespace Barotrauma
}
}));
commands.Add(new Command("converttowreck", "", (string[] args) =>
{
if (Screen.Selected is not SubEditorScreen)
{
ThrowError("The command can only be used in the submarine editor.");
return;
}
if (Submarine.MainSub == null)
{
ThrowError("Load a submarine first to convert it to a wreck.");
return;
}
if (Submarine.MainSub.Info.SubmarineElement == null)
{
ThrowError("The submarine must be saved before you can convert it to a wreck.");
return;
}
var wreckedSubmarineInfo = new SubmarineInfo(filePath: string.Empty, element: WreckConverter.ConvertToWreck(Submarine.MainSub.Info.SubmarineElement));
wreckedSubmarineInfo.Name += "_Wrecked";
wreckedSubmarineInfo.Type = SubmarineType.Wreck;
GameMain.SubEditorScreen.LoadSub(wreckedSubmarineInfo);
}));
#if DEBUG
commands.Add(new Command("listspamfilters", "Lists filters that are in the global spam filter.", (string[] args) =>
{
@@ -2444,29 +2467,6 @@ namespace Barotrauma
}
}));
commands.Add(new Command("converttowreck", "", (string[] args) =>
{
if (Screen.Selected is not SubEditorScreen)
{
ThrowError("The command can only be used in the submarine editor.");
return;
}
if (Submarine.MainSub == null)
{
ThrowError("Load a submarine first to convert it to a wreck.");
return;
}
if (Submarine.MainSub.Info.SubmarineElement == null)
{
ThrowError("The submarine must be saved before you can convert it to a wreck.");
return;
}
var wreckedSubmarineInfo = new SubmarineInfo(filePath: string.Empty, element: WreckConverter.ConvertToWreck(Submarine.MainSub.Info.SubmarineElement));
wreckedSubmarineInfo.Name += "_Wrecked";
wreckedSubmarineInfo.Type = SubmarineType.Wreck;
GameMain.SubEditorScreen.LoadSub(wreckedSubmarineInfo);
}));
commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
{
float defaultZoom = Screen.Selected.Cam.DefaultZoom;
@@ -1735,7 +1735,7 @@ namespace Barotrauma
if (!ItemAndAllContainersInteractable(subItem)) { continue; }
//don't list items in a character inventory (the ones in a crew member's inventory are counted below)
var rootInventoryOwner = subItem.GetRootInventoryOwner();
if (rootInventoryOwner != null) { continue; }
if (rootInventoryOwner is Character) { continue; }
AddOwnedItem(subItem);
}
}
@@ -1822,7 +1822,7 @@ namespace Barotrauma.Networking
if (Screen.Selected != GameMain.GameScreen)
{
new GUIMessageBox(TextManager.Get("PleaseWait"), TextManager.Get(allowSpectating ? "RoundRunningSpectateEnabled" : "RoundRunningSpectateDisabled"));
if (!(Screen.Selected is ModDownloadScreen)) { GameMain.NetLobbyScreen.Select(); }
if (Screen.Selected is not ModDownloadScreen) { GameMain.NetLobbyScreen.Select(); }
}
}
}
@@ -57,6 +57,7 @@ namespace Barotrauma
private GUILayoutGroup roundControlsHolder;
public GUIButton SettingsButton { get; private set; }
public GUIButton ServerMessageButton { get; private set; }
public static GUIButton JobInfoFrame { get; set; }
private GUITickBox spectateBox;
@@ -427,6 +428,20 @@ namespace Barotrauma
TextGetter = serverNameShadow.TextGetter = () => GameMain.Client?.ServerName
};
ServerMessageButton = new GUIButton(new RectTransform(new Vector2(0.2f, 0.15f), serverInfoContent.RectTransform, Anchor.BottomLeft),
TextManager.Get("workshopitemdescription"), style: "GUIButtonSmall")
{
IgnoreLayoutGroups = true,
OnClicked = (bt, userdata) =>
{
if (GameMain.Client?.ServerSettings is { } serverSettings)
{
CreateServerMessagePopup(serverSettings.ServerName, serverSettings.ServerMessageText);
}
return true;
}
};
playStyleIconContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 0.4f), serverInfoContent.RectTransform, Anchor.BottomRight), isHorizontal: true, childAnchor: Anchor.BottomRight)
{
AbsoluteSpacing = GUI.IntScale(5)
@@ -455,8 +470,23 @@ namespace Barotrauma
}
};
SettingsButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), serverInfoContent.RectTransform, Anchor.TopRight),
TextManager.Get("ServerSettingsButton"), style: "GUIButtonSmall");
SettingsButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.4f), serverInfoContent.RectTransform, Anchor.TopRight),
TextManager.Get("ServerSettingsButton"), style: "GUIButtonFreeScale");
}
private void CreateServerMessagePopup(string serverName, string message)
{
if (string.IsNullOrEmpty(message)) { return; }
var popup = new GUIMessageBox(serverName, string.Empty, minSize: new Point(GUI.IntScale(650), GUI.IntScale(650)));
//popup.Content.Stretch = true;
popup.Header.Font = GUIStyle.LargeFont;
popup.Header.RectTransform.MinSize = new Point(0, (int)popup.Header.TextSize.Y);
var textListBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.7f), popup.Content.RectTransform));
var text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), textListBox.Content.RectTransform), message, wrap: true)
{
CanBeFocused = false
};
text.RectTransform.MinSize = new Point(0, (int)text.TextSize.Y);
}
public void RefreshPlaystyleIcons()
@@ -1474,7 +1504,8 @@ namespace Barotrauma
}
else
{
GameMain.Client.RequestStartRound();
//if a campaign is active, and we're not setting one up atm, start button continues the existing campaign
GameMain.Client.RequestStartRound(continueCampaign: GameMain.GameSession?.GameMode is CampaignMode && CampaignSetupFrame is not { Visible: true });
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton), "WaitForStartRound");
}
return true;
@@ -1570,10 +1601,7 @@ namespace Barotrauma
chatInput.OnTextChanged += GameMain.Client.TypingChatMessage;
chatInput.OnDeselected += (sender, key) =>
{
if (GameMain.Client != null)
{
GameMain.Client.ChatBox.ChatManager.Clear();
}
GameMain.Client?.ChatBox.ChatManager.Clear();
};
//disable/hide elements the clients are not supposed to use/see