(2d473d38a) Add RequireAimToUse checks for being logical and for future. Shouldn't have any functional implications in the current version, but we could have RepairTools or Weapons that don't require aiming.

This commit is contained in:
Joonas Rikkonen
2019-04-05 16:18:52 +03:00
parent 350e6d6036
commit 8f42801c7a
7 changed files with 49 additions and 142 deletions
@@ -64,13 +64,14 @@ namespace Barotrauma.Items.Components
attack = new Attack(subElement, item.Name + ", MeleeWeapon");
}
item.IsShootable = true;
// TODO: should define this in xml if we have melee weapons that don't require aim to use
item.RequireAimToUse = true;
}
public override bool Use(float deltaTime, Character character = null)
{
if (character == null || reloadTimer > 0.0f) return false;
if (!character.IsKeyDown(InputType.Aim) || hitting) return false;
if (Item.RequireAimToUse && !character.IsKeyDown(InputType.Aim) || hitting) return false;
//don't allow hitting if the character is already hitting with another weapon
for (int i = 0; i < 2; i++ )