(2c264b075) Improve readability (no functional changes).

This commit is contained in:
Joonas Rikkonen
2019-04-08 19:17:06 +03:00
parent 5876097da4
commit 9a829206af
7 changed files with 85 additions and 126 deletions
@@ -136,8 +136,6 @@ namespace Barotrauma
break;
}
}
hudProgressBars = new Dictionary<object, HUDProgressBar>();
}
partial void UpdateLimbLightSource(Limb limb)
@@ -148,14 +146,12 @@ namespace Barotrauma
}
}
private bool wasFiring;
/// <summary>
/// Control the Character according to player input
/// </summary>
public void ControlLocalPlayer(float deltaTime, Camera cam, bool moveCam = true)
{
if (DisableControls || GUI.PauseMenuOpen || GUI.SettingsMenuOpen)
if (DisableControls)
{
foreach (Key key in keys)
{
@@ -165,25 +161,10 @@ 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)