(fdc038d5d) Keymapping and UX test: - Map use to "E" and Select to "Left Mouse". - Introduce a dedicated key for deselecting ("Right Mouse"). - Introduce a dedicated key for shooting ("Left Mouse"). - Define certain objects as shootables, which simply means that they use the "Shoot" key instead of using the "Use" key. This required the least amount of refactoring the existing code. - TODO: don't register the "Select" input when aiming or when an interface is open -> should prevent interacting through UI elements. - TODO: sync the new input types with the server.

This commit is contained in:
Joonas Rikkonen
2019-04-04 11:06:12 +03:00
parent 2290645bc9
commit 5f05322fdb
51 changed files with 444 additions and 525 deletions
@@ -1,5 +1,4 @@
using Barotrauma.Networking;
using FarseerPhysics;
using FarseerPhysics;
using FarseerPhysics.Collision;
using FarseerPhysics.Dynamics;
using Microsoft.Xna.Framework;
@@ -57,6 +56,7 @@ namespace Barotrauma.Items.Components
public RangedWeapon(Item item, XElement element)
: base(item, element)
{
item.IsShootable = true;
}
public override void Update(float deltaTime, Camera cam)
@@ -165,12 +165,11 @@ namespace Barotrauma.Items.Components
//set the rotation of the projectile again because dropping the projectile resets the rotation
projectile.Item.SetTransform(projectilePos,
rotation + (projectile.Item.body.Dir * projectile.LaunchRotationRadians));
rotation + ((item.body.Dir == 1.0f) ? projectile.LaunchRotationRadians : projectile.LaunchRotationRadians - MathHelper.Pi));
//recoil
item.body.ApplyLinearImpulse(
new Vector2((float)Math.Cos(projectile.Item.body.Rotation), (float)Math.Sin(projectile.Item.body.Rotation)) * item.body.Mass * -50.0f,
maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
new Vector2((float)Math.Cos(projectile.Item.body.Rotation), (float)Math.Sin(projectile.Item.body.Rotation)) * item.body.Mass * -50.0f);
item.RemoveContained(projectile.Item);