(513733e88) Check that the character is inside the same room as the target before repairing/operating an item.

This commit is contained in:
Joonas Rikkonen
2019-05-03 13:47:39 +03:00
parent 1ff1584be5
commit 5031432e77
6 changed files with 321 additions and 59 deletions
@@ -85,13 +85,18 @@ namespace Barotrauma
if (Vector2.Distance(character.Position, target.Item.Position) < target.Item.InteractDistance
|| target.Item.IsInsideTrigger(character.WorldPosition))
{
if (character.SelectedConstruction != target.Item && target.CanBeSelected)
if (character.CurrentHull == target.Item.CurrentHull)
{
target.Item.TryInteract(character, false, true);
if (character.SelectedConstruction != target.Item && target.CanBeSelected)
{
target.Item.TryInteract(character, false, true);
}
if (component.AIOperate(deltaTime, character, this))
{
isCompleted = true;
}
return;
}
if (component.AIOperate(deltaTime, character, this)) isCompleted = true;
return;
}
AddSubObjective(gotoObjective = new AIObjectiveGoTo(target.Item, character));