4 using System.Collections.Generic;
5 using System.Collections.Immutable;
12 public override string DebugTag => $
"{Identifier}";
21 private bool subObjectivesCreated;
22 private readonly
Item targetItem;
23 private readonly ImmutableArray<Identifier> requiredItems;
24 private readonly ImmutableArray<Identifier> optionalItems;
34 if (getSingleItemObjective !=
null) {
return getSingleItemObjective; }
35 if (getAllItemsObjective ==
null || getAllItemsObjective.
IsCompleted)
37 return getMultipleItemsObjective;
39 return getAllItemsObjective;
44 this.targetItem = targetItem;
50 this.optionalItems = optionalItems.ToImmutableArray();
51 if (requiredItems !=
null)
53 this.requiredItems = requiredItems.ToImmutableArray();
67 var subObjective = GetSubObjective();
75 protected override void Act(
float deltaTime)
77 if (!subObjectivesCreated)
81 getMultipleItemsObjective = CreateObjectives(optionalItems, requireAll:
false);
82 if (requiredItems !=
null && requiredItems.Any())
84 getAllItemsObjective = CreateObjectives(requiredItems, requireAll:
true);
89 if (!TryAddSubObjective(ref objectiveReference, () =>
97 RequireAllItems = requireAll
100 if (itemTags.Contains(Tags.HeavyDivingGear))
104 if (tag == Tags.HeavyDivingGear)
120 onAbandon: () =>
Abandon =
true))
124 return objectiveReference;
129 Func<AIObjectiveGetItem> getItemConstructor;
130 if (targetItem !=
null)
139 IEnumerable<Identifier> allItems = optionalItems;
140 if (requiredItems !=
null && requiredItems.Any())
142 allItems = requiredItems;
151 if (!TryAddSubObjective(ref getSingleItemObjective, getItemConstructor,
159 onAbandon: () =>
Abandon =
true))
164 subObjectivesCreated =
true;
171 subObjectivesCreated =
false;
172 getMultipleItemsObjective =
null;
173 getSingleItemObjective =
null;
174 getAllItemsObjective =
null;
static bool IsSuitablePressureProtection(Item item, Identifier tag, Character character)
float Priority
Final priority value after all calculations.
readonly Character character
readonly AIObjectiveManager objectiveManager
float GetOrderPriority(AIObjective objective)
override bool PrioritizeIfSubObjectivesActive
AIObjectivePrepare(Character character, AIObjectiveManager objectiveManager, IEnumerable< Identifier > optionalItems, IEnumerable< Identifier > requiredItems=null, float priorityModifier=1)
override float GetPriority()
override void Act(float deltaTime)
override bool KeepDivingGearOn
override bool KeepDivingGearOnAlsoWhenInactive
override Identifier Identifier
AIObjectivePrepare(Character character, AIObjectiveManager objectiveManager, Item targetItem, float priorityModifier=1)
bool EvaluateCombatPriority
override bool CheckObjectiveState()
Should return whether the objective is completed or not.
override bool AllowWhileHandcuffed