diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems
index 991ce2d39..96e169d05 100644
--- a/Barotrauma/BarotraumaClient/ClientCode.projitems
+++ b/Barotrauma/BarotraumaClient/ClientCode.projitems
@@ -223,6 +223,7 @@
Never
+
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
index a1799b683..4ac368ed7 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
@@ -967,7 +967,7 @@ namespace Barotrauma
{
try
{
- OpenFileDialog ofd = new OpenFileDialog()
+ Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
{
Multiselect = true,
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
@@ -1078,7 +1078,7 @@ namespace Barotrauma
{
try
{
- OpenFileDialog ofd = new OpenFileDialog()
+ Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
{
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
Title = TextManager.Get("workshopitemaddfiles"),
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
index c45c37df1..baac2f33d 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
@@ -1074,7 +1074,7 @@ namespace Barotrauma
{
OnClicked = (btn, userdata) =>
{
- OpenFileDialog ofd = new OpenFileDialog()
+ Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
{
InitialDirectory = Path.GetFullPath(Submarine.SavePath),
Filter = "PNG file|*.png",
diff --git a/Barotrauma/BarotraumaClient/Source/Utils/OpenFileDialog.cs b/Barotrauma/BarotraumaClient/Source/Utils/OpenFileDialog.cs
new file mode 100644
index 000000000..b7e5dba5c
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/Source/Utils/OpenFileDialog.cs
@@ -0,0 +1,74 @@
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace Barotrauma
+{
+ public class OpenFileDialog
+ {
+ private System.Windows.Forms.OpenFileDialog ofd;
+
+ public bool Multiselect;
+ public string InitialDirectory;
+ public string Filter;
+ public string Title;
+ public string FileName { get; private set; }
+ public string[] FileNames { get; private set; }
+
+ public OpenFileDialog()
+ {
+ ofd = new System.Windows.Forms.OpenFileDialog();
+ }
+
+ public System.Windows.Forms.DialogResult ShowDialog()
+ {
+ ofd.Multiselect = Multiselect;
+ ofd.InitialDirectory = InitialDirectory;
+ ofd.Filter = Filter;
+ ofd.Title = Title;
+
+#if LINUX
+ var wrapperForm = new WrapperForm(ofd);
+ System.Windows.Forms.Application.Run(wrapperForm);
+ System.Windows.Forms.Application.Exit();
+ FileName = wrapperForm.FileName;
+ FileNames = wrapperForm.FileNames;
+ return wrapperForm.Result;
+#else
+ var result = ofd.ShowDialog();
+ FileName = ofd.FileName;
+ FileNames = ofd.FileNames;
+ return result;
+#endif
+ }
+
+#if LINUX
+ private class WrapperForm : System.Windows.Forms.Form
+ {
+ private System.Windows.Forms.OpenFileDialog ofd;
+
+ public System.Windows.Forms.DialogResult Result { get; private set; }
+ public string FileName { get; private set; }
+ public string[] FileNames { get; private set; }
+
+ public WrapperForm(System.Windows.Forms.OpenFileDialog dialog)
+ {
+ ofd = dialog;
+ Load += WrapperForm_Load;
+ }
+
+ private void WrapperForm_Load(object sender, EventArgs e)
+ {
+ Result = ofd.ShowDialog();
+ FileName = ofd.FileName;
+ FileNames = ofd.FileNames;
+ System.Threading.Thread.Sleep(100);
+ this.Close();
+ }
+ }
+#endif
+ }
+}
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs
index 3cdc8780b..851a0cd01 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs
@@ -122,8 +122,9 @@ namespace Barotrauma
goToObjective = null;
}
TryAddSubObjective(ref goToObjective,
- constructor: () => new AIObjectiveGoTo(currentSafeHull, character, objectiveManager, getDivingGearIfNeeded: true)
+ constructor: () => new AIObjectiveGoTo(currentSafeHull, character, objectiveManager, getDivingGearIfNeeded: false)
{
+ // If we need diving gear, we should already have it, if possible.
AllowGoingOutside = HumanAIController.HasDivingSuit(character)
},
onAbandon: () => unreachable.Add(goToObjective.Target as Hull));