(0fde6c604) Ignore dangerous targets.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:18:37 +03:00
parent fea0c31e85
commit 65e284bf7c
16 changed files with 200 additions and 238 deletions
@@ -29,6 +29,7 @@ namespace Barotrauma
public override float GetPriority()
{
if (gotoObjective != null && !gotoObjective.CanBeCompleted) { return 0; }
if (Character.CharacterList.Any(c => c.CurrentHull == targetHull && !HumanAIController.IsFriendly(c))) { return 0; }
// Vertical distance matters more than horizontal (climbing up/down is harder than moving horizontally)
float dist = Math.Abs(character.WorldPosition.X - targetHull.WorldPosition.X) + Math.Abs(character.WorldPosition.Y - targetHull.WorldPosition.Y) * 2.0f;
float distanceFactor = MathHelper.Lerp(1, 0.1f, MathUtils.InverseLerp(0, 10000, dist));