(276e03242) Reset Use and Select inputs when releasing the Shoot input to prevent accidentally selecting/using items
This commit is contained in:
@@ -148,6 +148,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool wasFiring;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Control the Character according to player input
|
/// Control the Character according to player input
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -163,10 +165,25 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
wasFiring |= keys[(int)InputType.Aim].Held && keys[(int)InputType.Shoot].Held;
|
||||||
for (int i = 0; i < keys.Length; i++)
|
for (int i = 0; i < keys.Length; i++)
|
||||||
{
|
{
|
||||||
keys[i].SetState();
|
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;
|
float targetOffsetAmount = 0.0f;
|
||||||
if (moveCam)
|
if (moveCam)
|
||||||
|
|||||||
@@ -276,6 +276,9 @@ namespace Barotrauma
|
|||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
characterInfos.Add(characterInfo);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove the character from the crew (and crew menus).
|
/// Remove the character from the crew (and crew menus).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -85,6 +85,25 @@ namespace Barotrauma
|
|||||||
return false;
|
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()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
switch (MouseButton)
|
switch (MouseButton)
|
||||||
@@ -134,6 +153,16 @@ namespace Barotrauma
|
|||||||
get { return binding; }
|
get { return binding; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetState()
|
||||||
|
{
|
||||||
|
hit = binding.IsHit();
|
||||||
|
if (hit) hitQueue = true;
|
||||||
|
|
||||||
|
held = binding.IsDown();
|
||||||
|
if (held) heldQueue = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public void SetState()
|
public void SetState()
|
||||||
{
|
{
|
||||||
hit = binding.IsHit();
|
hit = binding.IsHit();
|
||||||
|
|||||||
Reference in New Issue
Block a user