Client LuaCsForBarotrauma
ShipIssueWorkerFixLeaks.cs
1 using Microsoft.Xna.Framework;
2 using System.Collections.Generic;
3 using System.Linq;
4 
5 namespace Barotrauma
6 {
8  {
9  readonly List<float> hullSeverities = new List<float>();
11  public override void CalculateGlobalIssue()
12  {
13  hullSeverities.Clear();
14 
15  foreach (Gap gap in Gap.GapList)
16  {
18  {
19  hullSeverities.Add(AIObjectiveFixLeaks.GetLeakSeverity(gap));
20  }
21  }
22 
23  float averagePercentage = 0f;
24  if (hullSeverities.Any())
25  {
26  hullSeverities.Sort();
27  averagePercentage = hullSeverities.TakeLast(3).Average(); // get the 3 most damaged items on the ship and get their average
28  }
29  GlobalImportance = averagePercentage;
30  }
31  }
32 
34  {
35  public override bool StopDuringEmergency => false;
36  public ShipIssueWorkerFixLeaks(ShipCommandManager shipCommandManager, Order order, ShipGlobalIssueFixLeaks shipGlobalIssueFixLeaks) : base(shipCommandManager, order, shipGlobalIssueFixLeaks) { }
37  }
38 }
static float GetLeakSeverity(Gap leak)
override bool IsValidTarget(Gap gap)
ShipGlobalIssueFixLeaks(ShipCommandManager shipCommandManager)
ShipCommandManager shipCommandManager
ShipIssueWorkerFixLeaks(ShipCommandManager shipCommandManager, Order order, ShipGlobalIssueFixLeaks shipGlobalIssueFixLeaks)
readonly ShipCommandManager shipCommandManager