Interaction logic tweaking again:

- Reverted the item distance calculation change in commit c7fd681 (it made interaction way less precise, as items near the character tended to get focus even if the cursor was nowhere near them), and replaced it with:
- Aim assist considers the distance to an item to be 0.0 if the cursor is inside a trigger of the item.
- Reverted 769a012 and disabled aim assist when an item is selected. Meaning that now items don't have to be deselected before interacting with another item, but the cursor has to be directly on the other item to make accidental interaction less likely.
- Removed some redundant trigger calculations from CanInteractWith.
This commit is contained in:
Joonas Rikkonen
2017-07-13 23:32:39 +03:00
parent 8693dc3d3d
commit cc9ebe9fc2
2 changed files with 31 additions and 49 deletions
@@ -552,17 +552,17 @@ namespace Barotrauma
public Rectangle TransformTrigger(Rectangle trigger, bool world = false)
{
return world ?
new Rectangle(
WorldRect.X + trigger.X,
WorldRect.Y + trigger.Y,
(trigger.Width == 0) ? Rect.Width : trigger.Width,
(trigger.Height == 0) ? Rect.Height : trigger.Height)
:
new Rectangle(
Rect.X + trigger.X,
Rect.Y + trigger.Y,
(trigger.Width == 0) ? Rect.Width : trigger.Width,
(trigger.Height == 0) ? Rect.Height : trigger.Height);
new Rectangle(
WorldRect.X + trigger.X,
WorldRect.Y + trigger.Y,
(trigger.Width == 0) ? Rect.Width : trigger.Width,
(trigger.Height == 0) ? Rect.Height : trigger.Height)
:
new Rectangle(
Rect.X + trigger.X,
Rect.Y + trigger.Y,
(trigger.Width == 0) ? Rect.Width : trigger.Width,
(trigger.Height == 0) ? Rect.Height : trigger.Height);
}
/// <summary>
@@ -1033,7 +1033,7 @@ namespace Barotrauma
return c != null && c.Character != null && c.Character.CanInteractWith(this);
}
public bool TryInteract(Character picker, bool ignoreRequiredItems=false, bool forceSelectKey=false, bool forceActionKey=false)
public bool TryInteract(Character picker, bool ignoreRequiredItems = false, bool forceSelectKey = false, bool forceActionKey = false)
{
bool hasRequiredSkills = true;