protected override float GetPriority()
 {
     if (!IsAllowed || Item.IgnoreByAI(character))
     {
         Priority = 0;
         Abandon  = true;
         if (IsRepairing())
         {
             Item.Repairables.ForEach(r => r.StopRepairing(character));
         }
         return(Priority);
     }
     if (HumanAIController.IsItemRepairedByAnother(Item, out _))
     {
         Priority    = 0;
         IsCompleted = true;
     }
     else
     {
         float distanceFactor = 1;
         if (!isPriority && Item.CurrentHull != character.CurrentHull)
         {
             float yDist = Math.Abs(character.WorldPosition.Y - Item.WorldPosition.Y);
             yDist = yDist > 100 ? yDist * 5 : 0;
             float dist = Math.Abs(character.WorldPosition.X - Item.WorldPosition.X) + yDist;
             distanceFactor = MathHelper.Lerp(1, 0.25f, MathUtils.InverseLerp(0, 4000, dist));
         }
         float requiredSuccessFactor = objectiveManager.HasOrder <AIObjectiveRepairItems>() ? 0 : AIObjectiveRepairItems.RequiredSuccessFactor;
         float severity      = isPriority ? 1 : AIObjectiveRepairItems.GetTargetPriority(Item, character, requiredSuccessFactor) / 100;
         bool  isSelected    = IsRepairing();
         float selectedBonus = isSelected ? 100 - MaxDevotion : 0;
         float devotion      = (CumulatedDevotion + selectedBonus) / 100;
         float reduction     = isPriority ? 1 : isSelected ? 2 : 3;
         float max           = AIObjectiveManager.LowestOrderPriority - reduction;
         float highestWeight = -1;
         foreach (string tag in Item.Prefab.Tags)
         {
             if (JobPrefab.ItemRepairPriorities.TryGetValue(tag, out float weight) && weight > highestWeight)
             {
                 highestWeight = weight;
             }
         }
         if (highestWeight == -1)
         {
             // Predefined weight not found.
             highestWeight = 1;
         }
         Priority = MathHelper.Lerp(0, max, MathHelper.Clamp(devotion + (severity * distanceFactor * highestWeight * PriorityModifier), 0, 1));
     }
     return(Priority);
 }