(53f9210d1) Check the line of sight before fixing leaks or extinguishing fires.

This commit is contained in:
Joonas Rikkonen
2019-05-03 13:47:22 +03:00
parent d1dd0c6043
commit 1ff1584be5
7 changed files with 115 additions and 231 deletions
@@ -101,10 +101,22 @@ namespace Barotrauma
HumanAIController.AnimController.Crouching = true;
}
//float reach = HumanAIController.AnimController.ArmLength + ConvertUnits.ToSimUnits(repairTool.Range);
float reach = ConvertUnits.ToSimUnits(repairTool.Range);
bool cannotReach = ConvertUnits.ToSimUnits(gapDiff.Length()) > reach;
if (cannotReach)
bool canReach = ConvertUnits.ToSimUnits(gapDiff.Length()) < reach;
if (canReach)
{
Limb sightLimb = null;
if (character.Inventory.IsInLimbSlot(repairTool.Item, InvSlotType.RightHand))
{
sightLimb = character.AnimController.GetLimb(LimbType.RightHand);
}
else if (character.Inventory.IsInLimbSlot(repairTool.Item, InvSlotType.LeftHand))
{
sightLimb = character.AnimController.GetLimb(LimbType.LeftHand);
}
canReach = character.CanSeeTarget(leak, sightLimb);
}
else
{
if (gotoObjective != null)
{