(83868bb0e) Refactor AIObjectiveExtinguishFires to use the AIObjectiveLoop class. Significant refactoring of the other looping objectives. Reduce the duplicate code.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:13:40 +03:00
parent 7fb7c13198
commit 8be0b0676e
21 changed files with 212 additions and 192 deletions
@@ -38,7 +38,7 @@ namespace Barotrauma
protected override bool Filter(Item item)
{
bool ignore = ignoreList.Contains(item) || item.IsFullCondition;
bool ignore = item.IsFullCondition;
if (!ignore)
{
if (item.Submarine == null) { ignore = true; }
@@ -64,11 +64,11 @@ namespace Barotrauma
}
}
}
return ignore;
return !ignore;
}
protected override float TargetEvaluation() => targets.Max(t => 100 - t.ConditionPercentage);
protected override IEnumerable<Item> GetList() => Item.ItemList;
protected override AIObjective ObjectiveConstructor(Item item) => new AIObjectiveRepairItem(character, item);
protected override AIObjective ObjectiveConstructor(Item item) => new AIObjectiveRepairItem(character, item, PriorityModifier);
}
}