- setting SelectedConstruction back to null if a client is too far from it (-> selecting items doesn't become impossible after selecting a cabinet/reactor/whatever and moving away from it)

- closestItem or closestCharacter aren't checked unless the client pressed Select
This commit is contained in:
Regalis
2016-11-13 21:13:18 +02:00
parent 3d234aef73
commit 44d87613b9
+7 -5
View File
@@ -1418,16 +1418,18 @@ namespace Barotrauma
Control(deltaTime, cam); Control(deltaTime, cam);
} }
if (selectedConstruction != null && !selectedConstruction.IsInPickRange(WorldPosition))
{
selectedConstruction = null;
}
if (controlled != this && !(this is AICharacter)) if (controlled != this && !(this is AICharacter))
{ {
Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition);
if (!LockHands) if (!LockHands)
{ {
//find the closest item if selectkey has been hit, or if the Character is being Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition);
//controlled by the player (in order to highlight it)
if (findClosestTimer <= 0.0f || IsKeyHit(InputType.Select)) if (IsKeyHit(InputType.Select))
{ {
closestCharacter = FindClosestCharacter(mouseSimPos); closestCharacter = FindClosestCharacter(mouseSimPos);
if (closestCharacter != null && closestCharacter.info == null) if (closestCharacter != null && closestCharacter.info == null)