3 using System.Collections.Generic;
5 using Microsoft.Xna.Framework;
17 private List<Pump> pumpList;
20 : base(character, objectiveManager, priorityModifier, option) { }
24 if (Option ==
null) {
return; }
37 if (character.Submarine !=
null && pump.
Item.
Submarine !=
null)
39 if (!character.Submarine.IsConnectedTo(pump.
Item.
Submarine)) {
return false; }
43 if (IsReady(pump)) {
return false; }
46 protected override IEnumerable<Pump>
GetList()
50 if (character ==
null || character.Submarine ==
null) {
return Array.Empty<
Pump>(); }
52 pumpList =
new List<Pump>();
55 var pump = item.GetComponent<
Pump>();
56 if (pump ==
null || pump.Item.Submarine ==
null || pump.Item.CurrentHull ==
null) {
continue; }
57 if (pump.Item.Submarine.TeamID != character.TeamID) {
continue; }
58 if (pump.Item.HasTag(Tags.Ballast)) {
continue; }
67 if (
Targets.None()) {
return 0; }
68 if (Option ==
"stoppumping")
70 return Targets.Max(t => MathHelper.Lerp(0, 100, Math.Abs(t.FlowPercentage / 100)));
74 return Targets.Max(t => MathHelper.Lerp(100, 0, Math.Abs(-t.FlowPercentage / 100)));
78 private bool IsReady(
Pump pump)
80 if (Option ==
"stoppumping")
93 completionCondition = () => IsReady(pump)
An objective that creates specific kinds of subobjectives for specific types of targets,...
override void OnObjectiveCompleted(AIObjective objective, Pump target)
override bool KeepDivingGearOn
override bool AllowWhileHandcuffed
override void FindTargets()
override AIObjective ObjectiveConstructor(Pump pump)
override Identifier Identifier
override IEnumerable< Pump > GetList()
List of all possible items of the specified type. Used for filtering the removed objectives.
override float GetTargetPriority()
Returns a priority value based on the current targets (e.g. high prio when there's lots of severe fir...
AIObjectivePumpWater(Character character, AIObjectiveManager objectiveManager, Identifier option, float priorityModifier=1)
override bool AllowAutomaticItemUnequipping
override bool IsValidTarget(Pump pump)
static readonly List< Character > CharacterList
List< FireSource > FireSources
static bool IsActive(Character c)
static bool IsFriendly(Character me, Character other, bool onlySameTeam=false)
bool IsInteractable(Character character)
Returns interactibility based on whether the character is on a player team
bool IgnoreByAI(Character character)
bool? IsClaimedByBallastFlora
float ConditionPercentage
List< Item > GetItems(bool alsoFromConnectedSubs)