diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj
index 8965cd2a0..0df081dfa 100644
--- a/Subsurface/Barotrauma.csproj
+++ b/Subsurface/Barotrauma.csproj
@@ -63,6 +63,7 @@
+
diff --git a/Subsurface/Barotrauma.csproj.user b/Subsurface/Barotrauma.csproj.user
index df35fcf91..1782abafa 100644
--- a/Subsurface/Barotrauma.csproj.user
+++ b/Subsurface/Barotrauma.csproj.user
@@ -9,7 +9,7 @@
en-US
false
- ProjectFiles
+ ShowAllFiles
diff --git a/Subsurface/Content/Orders.xml b/Subsurface/Content/Orders.xml
index 43dbcdab4..d3a4961df 100644
--- a/Subsurface/Content/Orders.xml
+++ b/Subsurface/Content/Orders.xml
@@ -19,5 +19,9 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/Subsurface/Content/UI/orderSymbols.png b/Subsurface/Content/UI/orderSymbols.png
index 2860a2a77..60b8a7267 100644
Binary files a/Subsurface/Content/UI/orderSymbols.png and b/Subsurface/Content/UI/orderSymbols.png differ
diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFixLeaks.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFixLeaks.cs
new file mode 100644
index 000000000..4e9f5404e
--- /dev/null
+++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFixLeaks.cs
@@ -0,0 +1,76 @@
+using Microsoft.Xna.Framework;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Barotrauma
+{
+ class AIObjectiveFixLeaks : AIObjective
+ {
+ const float UpdateGapListInterval = 10.0f;
+
+ private float updateGapListTimer;
+
+ private List objectiveList;
+
+ public AIObjectiveFixLeaks(Character character)
+ : base (character, "")
+ {
+ objectiveList = new List();
+ }
+
+ public override bool IsCompleted()
+ {
+ return false;
+ }
+
+ protected override void Act(float deltaTime)
+ {
+ updateGapListTimer -= deltaTime;
+
+ if (updateGapListTimer<=0.0f)
+ {
+ UpdateGapList();
+
+ updateGapListTimer = UpdateGapListInterval;
+ }
+
+ if (objectiveList.Any())
+ {
+ objectiveList[objectiveList.Count-1].TryComplete(deltaTime);
+
+ if (!objectiveList[objectiveList.Count-1].CanBeCompleted || objectiveList[objectiveList.Count-1].IsCompleted())
+ {
+ objectiveList.RemoveAt(objectiveList.Count - 1);
+ }
+ }
+ }
+
+ private void UpdateGapList()
+ {
+ objectiveList.Clear();
+
+ foreach (Gap gap in Gap.GapList)
+ {
+ if (gap.IsRoomToRoom || gap.ConnectedDoor != null || gap.Open < 0.1f) continue;
+
+ float dist = Vector2.DistanceSquared(character.WorldPosition, gap.WorldPosition);
+
+ int index = 0;
+ while (indexdist)
+ {
+ index++;
+ }
+
+ objectiveList.Insert(index, new AIObjectiveFixLeak(gap, character));
+ }
+ }
+
+ public override bool IsDuplicate(AIObjective otherObjective)
+ {
+ return otherObjective is AIObjectiveFixLeaks;
+ }
+ }
+}
diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs
index e71474c25..a374efec6 100644
--- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs
+++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs
@@ -54,13 +54,6 @@ namespace Barotrauma
//sort objectives according to priority
objectives.Sort((x, y) => y.GetPriority(character).CompareTo(x.GetPriority(character)));
-
- foreach (Gap gap in Gap.GapList)
- {
- if (gap.IsRoomToRoom || gap.ConnectedDoor != null || gap.Open<0.01f) continue;
-
- AddObjective(new AIObjectiveFixLeak(gap, character));
- }
}
public void DoCurrentObjective(float deltaTime)
@@ -87,6 +80,10 @@ namespace Barotrauma
case "wait":
currentObjective = new AIObjectiveGoTo(character, character, true);
break;
+ case "fixleaks":
+ case "fix leaks":
+ currentObjective = new AIObjectiveFixLeaks(character);
+ break;
default:
if (order.TargetItem == null) return;
diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo
index e531daad1..6a847a724 100644
Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ