From 62cb0e238779928579c0be706dc8fc885d140362 Mon Sep 17 00:00:00 2001
From: "dereeves@nps.edu" <dereeves@nps.edu>
Date: Mon, 19 Jul 2021 14:08:23 -0700
Subject: [PATCH] * ha! found an easy way to stop the setup/tear down loop at
 attack locations

---
 scripts/HTN/Trees/Red/ConvoyUnit.xml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/HTN/Trees/Red/ConvoyUnit.xml b/scripts/HTN/Trees/Red/ConvoyUnit.xml
index 6d2a93f..fb5920f 100644
--- a/scripts/HTN/Trees/Red/ConvoyUnit.xml
+++ b/scripts/HTN/Trees/Red/ConvoyUnit.xml
@@ -192,7 +192,6 @@ if len(borg.redConvoysWaiting[state.getCurrentUnit().getName()])==0:
 
         # calculate how long on station they should be
         borg.redNumSetups[state.getCurrentUnitName()]=borg.params_redNumSetups
-        printMessage("SETTING TOS "+str(state.getCurrentUnitName()), True)
 
         SendEntityEvent(cmdName, "GoalTracker_ConvoySetup", [])
         borg.delay=1.0
@@ -284,7 +283,9 @@ if borg.redUnitStatus[state.getCurrentUnitName()]==setupNum:
     else:
         cmdName = state.getCurrentCommander().getAssignedName()
 
-    SendEntityEventDelay(cmdName, "GoalTracker_ConvoyPackUp", [], rn)
+    # only pack up if it's not an attack run or we still have destinations left to move to
+    if not borg.isAttackRun or len(borg.redConvoyDest[state.getCurrentUnit().getName()]) &gt; 0:
+        SendEntityEventDelay(cmdName, "GoalTracker_ConvoyPackUp", [], rn)
 
     for member in state.getCurrentUnit().getMembers():
         if "RADAR" in member.getProfile().getName():
-- 
GitLab