(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:
@@ -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++ )
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace Barotrauma.Items.Components
|
||||
: base(item, element)
|
||||
{
|
||||
item.IsShootable = true;
|
||||
// TODO: should define this in xml if we have ranged weapons that don't require aim to use
|
||||
item.RequireAimToUse = true;
|
||||
}
|
||||
|
||||
@@ -75,7 +76,7 @@ namespace Barotrauma.Items.Components
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
{
|
||||
if (character == null || character.Removed) return false;
|
||||
if (!character.IsKeyDown(InputType.Aim) || reloadTimer > 0.0f) return false;
|
||||
if ((item.RequireAimToUse && !character.IsKeyDown(InputType.Aim)) || reloadTimer > 0.0f) return false;
|
||||
IsActive = true;
|
||||
reloadTimer = reload;
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
item.IsShootable = true;
|
||||
// TODO: should define this in xml if we have repair tools that don't require aim to use
|
||||
item.RequireAimToUse = true;
|
||||
InitProjSpecific(element);
|
||||
}
|
||||
@@ -95,7 +96,7 @@ namespace Barotrauma.Items.Components
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
{
|
||||
if (character == null || character.Removed) return false;
|
||||
if (!character.IsKeyDown(InputType.Aim)) return false;
|
||||
if (item.RequireAimToUse && !character.IsKeyDown(InputType.Aim)) return false;
|
||||
|
||||
float degreeOfSuccess = DegreeOfSuccess(character);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user