(cdc68f306) Don't select items when aiming.

This commit is contained in:
Joonas Rikkonen
2019-04-04 11:06:28 +03:00
parent 5f05322fdb
commit 0cd81c6a99
3 changed files with 59 additions and 45 deletions
@@ -468,16 +468,9 @@ namespace Barotrauma.Items.Components
" Remoteplayer: " + c.IsRemotePlayer);
return false;
}
if (IsHorizontal)
else if (connection.Name == "set_state")
{
if (body.SimPosition.X < doorRectSimPos.X || body.SimPosition.X > doorRectSimPos.X + doorRectSimSize.X) { return false; }
diff = body.SimPosition.Y - item.SimPosition.Y;
}
else
{
if (body.SimPosition.Y > doorRectSimPos.Y || body.SimPosition.Y < doorRectSimPos.Y - doorRectSimSize.Y) { return false; }
diff = body.SimPosition.X - item.SimPosition.X;
SetState(signal != "0", false, true);
}
#if SERVER
@@ -1371,20 +1371,40 @@ namespace Barotrauma
}
else
{
if (forceSelectKey)
if (picker.IsKeyDown(InputType.Aim))
{
if (ic.PickKey == InputType.Select) pickHit = true;
if (ic.SelectKey == InputType.Select) selectHit = true;
}
else if (forceActionKey)
{
if (ic.PickKey == InputType.Use) pickHit = true;
if (ic.SelectKey == InputType.Use) selectHit = true;
pickHit = false;
selectHit = false;
}
else
{
pickHit = picker.IsKeyHit(ic.PickKey);
selectHit = picker.IsKeyHit(ic.SelectKey);
if (forceSelectKey)
{
if (ic.PickKey == InputType.Select) pickHit = true;
if (ic.SelectKey == InputType.Select) selectHit = true;
}
else if (forceActionKey)
{
if (ic.PickKey == InputType.Use) pickHit = true;
if (ic.SelectKey == InputType.Use) selectHit = true;
}
else
{
pickHit = picker.IsKeyHit(ic.PickKey);
selectHit = picker.IsKeyHit(ic.SelectKey);
#if CLIENT
//if the cursor is on a UI component, disable interaction with the left mouse button
//to prevent accidentally selecting items when clicking UI elements
if (picker == Character.Controlled && GUI.MouseOn != null)
{
if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
}
#endif
}
}
}
#if CLIENT
//if the cursor is on a UI component, disable interaction with the left mouse button
@@ -1398,9 +1418,6 @@ namespace Barotrauma
}
}
if (!pickHit && !selectHit) continue;
if (!ic.HasRequiredSkills(picker, out Skill tempRequiredSkill)) hasRequiredSkills = false;
bool showUiMsg = false;