瀏覽代碼

ColoScript: Inventory Check

 If you do not have the max holds the ship has, (Having 1 other resource
in the holds) it will abort... also changed Aborts all too exit directly
out not just end but still have the proxy enabled.
david 5 年之前
父節點
當前提交
bed18007cd
共有 1 個文件被更改,包括 19 次插入3 次删除
  1. 19 3
      flexible.py

+ 19 - 3
flexible.py

@@ -2588,7 +2588,8 @@ class ColoScript(object):
                 self.loops = 1
             self.maxloops = self.loops
             self.state = 3
-            self.send2game("D") # A neutral command, that won't hose up sending Express Mode? (Yes)
+            self.send2game("I") # A neutral command, that won't hose up sending Express Mode? (Yes)
+            # In fact this should allow us to see how many holds are avalible/empty
             # Jump to state 3 = Move to Terra
 
     def game_prompt(self, prompt: str):
@@ -2714,7 +2715,7 @@ class ColoScript(object):
                 else:
                     self.send2game("S\r\r1\rQ")
                     self.send2player("\r" + Boxes.alert("Completed ({0})".format(self.maxloops)))
-                    self.deactivate()
+                    self.deactivate(True)
                     # Ok we are done
             
 
@@ -2727,7 +2728,22 @@ class ColoScript(object):
                 log.debug("TURNS LEFT: {0}".format(self.turns))
                 if int(self.turns) < 200:
                     self.send2player("\r" + Boxes.alert("Low Turns! ({0})".format(self.turns)))
-                    self.deactivate()
+                    self.deactivate(True)
+        # IF at any state we see how many holds avalible let's get that
+        if 'Total Holds' in line:
+            work = line[16:].replace('-', '').replace('=', ' ').split()
+            self.total_holds = int(work[0])
+            count = 0
+            for w in work:
+                if(w != 'Empty'):
+                    count += 1
+                elif(w == 'Empty'):
+                    count += 1
+                    self.holds = int(work[count])
+                    log.debug("EMPTY HOLDS = {0}".format(self.holds))
+                    if(self.holds < self.total_holds):
+                        self.send2player("\r" + Boxes.alert("You need {1} holds empty! ({0} Empty)".format(self.holds, self.total_holds)))
+                        self.deactivate(True)
         # Now back to our scheduled program
         if self.state == 1:
             if 'Personal Planet Scan' in line or 'Corporate Planet Scan' in line: