(551008fc1) Abandon FixLeakObjective when the goto subobjective cannot be completed. Reset AIObjectiveLoops when the objective is activated or added. Don't clear ignored targets periodically by default. Calculate AIObjectiveGoTo CloseEnough when the objective is created. Don't use arm length in CloseEnough, because it's not used in range checks. Partial fixes to #1343.

This commit is contained in:
Joonas Rikkonen
2019-04-08 12:01:54 +03:00
parent 55eecc49d8
commit 47ee14227e
6 changed files with 56 additions and 28 deletions
@@ -101,7 +101,8 @@ namespace Barotrauma
HumanAIController.AnimController.Crouching = true;
}
float reach = HumanAIController.AnimController.ArmLength + ConvertUnits.ToSimUnits(repairTool.Range);
//float reach = HumanAIController.AnimController.ArmLength + ConvertUnits.ToSimUnits(repairTool.Range);
float reach = ConvertUnits.ToSimUnits(repairTool.Range);
bool cannotReach = ConvertUnits.ToSimUnits(gapDiff.Length()) > reach;
if (cannotReach)
{
@@ -110,14 +111,19 @@ namespace Barotrauma
// Check if the objective is already removed -> completed/impossible
if (!subObjectives.Contains(gotoObjective))
{
if (!gotoObjective.CanBeCompleted)
{
abandon = true;
}
gotoObjective = null;
return;
}
}
else
{
gotoObjective = new AIObjectiveGoTo(ConvertUnits.ToSimUnits(GetStandPosition()), character)
{
CloseEnough = reach * 0.75f
CloseEnough = reach
};
if (!subObjectives.Contains(gotoObjective))
{