Bläddra i källkod

Added a question to ScriptExplore

'How many sectors would you lick to explode?'
david 5 år sedan
förälder
incheckning
842e2f602b
1 ändrade filer med 24 tillägg och 3 borttagningar
  1. 24 3
      flexible.py

+ 24 - 3
flexible.py

@@ -997,6 +997,8 @@ class ScriptExplore(object):
         self.clear = []         # Warps that we know are clear.
         self.highsector = 0     # Selected Sector to move to next!
         self.highwarp = 0       # Selected Sector's Warp Count!
+        self.times = 0
+        self.maxtimes = 0
 
         # Activate
         self.prompt = game.buffer
@@ -1008,10 +1010,25 @@ class ScriptExplore(object):
         self.defer = None
         self.send2player("Explorer v1.00")
 
-        self.state = 1
+        # How many times we going to go today?
+        ask = PlayerInput(self.game)
+        
+        def settimes(*_):
+            times = ask.keep['times'].strip()
+            log.msg("settimes got '{0}'".format(times))
+            if times == None:
+                self.deactivate()
+            else:
+                self.times = times
+                self.maxtimes = times
+                self.send2game("D")
+                self.state = 1
+            
+        d = ask.prompt("How many sectors would you like to explore?", 5, name="times", digits=True)
+        #d.addCallback(ask.output)
+        #d.addCallback(lambda ignore: self.settimes(ask.keep))
+        d.addCallback(settimes)
 
-        # Begin to Gather cur_sector, and cur_warps
-        self.send2game("D")
     
     def whenDone(self):
         self.defer = defer.Deferred()
@@ -1152,6 +1169,10 @@ class ScriptExplore(object):
             self.state = 1
             
             # We are in a infinite Loop! Warning! Yes we can and will eat all the turns! :P
+            self.times -= 1
+            if self.times <= 0:
+                self.send2player("Completed {0}".format(self.maxtimes))
+                self.deactivate()