diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
index 6c4c85bb8..62e3aa3b5 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
@@ -148,6 +148,8 @@ namespace Barotrauma
}
}
+ private bool wasFiring;
+
///
/// Control the Character according to player input
///
@@ -163,10 +165,25 @@ namespace Barotrauma
}
else
{
+ wasFiring |= keys[(int)InputType.Aim].Held && keys[(int)InputType.Shoot].Held;
for (int i = 0; i < keys.Length; i++)
{
keys[i].SetState();
}
+ //if we were firing (= pressing the aim and shoot keys at the same time)
+ //and the fire key is the same as Select or Use, reset the key to prevent accidentally selecting/using items
+ if (wasFiring && !keys[(int)InputType.Shoot].Held)
+ {
+ if (GameMain.Config.KeyBind(InputType.Shoot).Equals(GameMain.Config.KeyBind(InputType.Select)))
+ {
+ keys[(int)InputType.Select].Reset();
+ }
+ if (GameMain.Config.KeyBind(InputType.Shoot).Equals(GameMain.Config.KeyBind(InputType.Use)))
+ {
+ keys[(int)InputType.Use].Reset();
+ }
+ wasFiring = false;
+ }
float targetOffsetAmount = 0.0f;
if (moveCam)
diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
index 1a7eaf05b..6b9d55aee 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
@@ -276,6 +276,9 @@ namespace Barotrauma
characterInfos.Add(characterInfo);
}
+ characterInfos.Add(characterInfo);
+ }
+
///
/// Remove the character from the crew (and crew menus).
///
diff --git a/Barotrauma/BarotraumaShared/Source/PlayerInput.cs b/Barotrauma/BarotraumaShared/Source/PlayerInput.cs
index 0898b8588..453699c4a 100644
--- a/Barotrauma/BarotraumaShared/Source/PlayerInput.cs
+++ b/Barotrauma/BarotraumaShared/Source/PlayerInput.cs
@@ -85,6 +85,25 @@ namespace Barotrauma
return false;
}
+ public override bool Equals(object obj)
+ {
+ if (obj is KeyOrMouse keyOrMouse )
+ {
+ if (MouseButton.HasValue)
+ {
+ return keyOrMouse.MouseButton.HasValue && keyOrMouse.MouseButton.Value == MouseButton.Value;
+ }
+ else
+ {
+ return keyOrMouse.Key.Equals(Key);
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
public override string ToString()
{
switch (MouseButton)
@@ -134,6 +153,16 @@ namespace Barotrauma
get { return binding; }
}
+ public void SetState()
+ {
+ hit = binding.IsHit();
+ if (hit) hitQueue = true;
+
+ held = binding.IsDown();
+ if (held) heldQueue = true;
+ }
+#endif
+
public void SetState()
{
hit = binding.IsHit();