(883c460d5) Don't require holding the aim key when using the periscope/controller. Move the RequireAimToUse from Controller component to Item. Change the use and shoot logic accordingly. TODO: fix the camera centering.

This commit is contained in:
Joonas Rikkonen
2019-04-04 11:07:14 +03:00
parent c8a7815ef8
commit 2d52a8ddf4
10 changed files with 74 additions and 32 deletions
@@ -80,6 +80,7 @@ namespace Barotrauma.Items.Components
}
}
item.IsShootable = true;
item.RequireAimToUse = true;
InitProjSpecific(element);
}
@@ -311,7 +312,10 @@ namespace Barotrauma.Items.Components
sinTime += deltaTime;
character.CursorPosition = leak.Position + VectorExtensions.Forward(Item.body.TransformedRotation + (float)Math.Sin(sinTime), dist);
character.SetInput(InputType.Aim, false, true);
if (item.RequireAimToUse)
{
character.SetInput(InputType.Aim, false, true);
}
// Press the trigger only when the tool is approximately facing the target.
// If the character is climbing, ignore the check, because we cannot aim while climbing.