|
@@ -1059,11 +1059,19 @@ class ScriptExplore(object):
|
|
|
self.nl + txt + self.r + self.nl
|
|
|
)
|
|
|
|
|
|
+ def resetStuff(self):
|
|
|
+ self.didScan = False
|
|
|
+ self.dense = []
|
|
|
+ self.clear = []
|
|
|
+ self.highwarp = 0
|
|
|
+ self.highsector = 0
|
|
|
+ log.msg("ScriptExplore.resetStuff()")
|
|
|
+
|
|
|
def game_prompt(self, prompt: str):
|
|
|
log.msg("{0} : {1}".format(self.state, prompt))
|
|
|
if self.state == 3:
|
|
|
log.msg("dense is {0} sectors big".format(len(self.dense)))
|
|
|
- self.state = 4
|
|
|
+ self.state += 1
|
|
|
self.send2game("SH")
|
|
|
|
|
|
def game_line(self, line: str):
|
|
@@ -1078,8 +1086,9 @@ class ScriptExplore(object):
|
|
|
self.didScan = True
|
|
|
|
|
|
if "Relative Density Scan" in line:
|
|
|
- self.state = 2
|
|
|
- elif self.state == 2:
|
|
|
+ self.state += 1
|
|
|
+
|
|
|
+ if self.state == 2:
|
|
|
if line.startswith("Sector"):
|
|
|
work = line.replace(':', '').replace(')', '').replace('%', '').replace('==>', '')
|
|
|
work = re.split(r"\s+", work)
|
|
@@ -1104,7 +1113,7 @@ class ScriptExplore(object):
|
|
|
|
|
|
|
|
|
elif line == "":
|
|
|
- self.state = 3
|
|
|
+ self.state += 1
|
|
|
elif self.state == 4:
|
|
|
|
|
|
|
|
@@ -1124,8 +1133,6 @@ class ScriptExplore(object):
|
|
|
|
|
|
if self.stacksector:
|
|
|
self.highsector = self.stacksector.pop()
|
|
|
-
|
|
|
-
|
|
|
self.deactivate()
|
|
|
elif self.dense:
|
|
|
t = []
|
|
@@ -1137,9 +1144,7 @@ class ScriptExplore(object):
|
|
|
self.send2player("Find a new area for me to look at!")
|
|
|
|
|
|
if self.stacksector:
|
|
|
- self.highsector = self.stacksector.pop()
|
|
|
-
|
|
|
-
|
|
|
+ self.highsector = self.stacksector.pop()
|
|
|
self.deactivate()
|
|
|
|
|
|
|
|
@@ -1156,7 +1161,7 @@ class ScriptExplore(object):
|
|
|
|
|
|
if self.clear:
|
|
|
log.msg("Clear Sectors: {0}".format(len(self.clear)))
|
|
|
- self.state = 5
|
|
|
+ self.state += 1
|
|
|
elif self.state == 5:
|
|
|
|
|
|
|
|
@@ -1180,14 +1185,14 @@ class ScriptExplore(object):
|
|
|
|
|
|
if self.highwarp != 0 or self.highsector != 0:
|
|
|
log.msg("Sector: {0:5d} Warps: {1}".format(self.highsector, self.highwarp))
|
|
|
- self.state = 6
|
|
|
+ self.state += 1
|
|
|
else:
|
|
|
log.msg("Oh Nose! We didn't find any Sector with higher Warps than any of the others!")
|
|
|
self.deactivate()
|
|
|
elif self.state == 6:
|
|
|
-
|
|
|
- for d in self.dense:
|
|
|
- self.stacksector.add(d['sector'])
|
|
|
+
|
|
|
+ for c in self.clear:
|
|
|
+ self.stacksector.add(c)
|
|
|
|
|
|
|
|
|
self.stacksector.discard(self.highsector)
|
|
@@ -1196,11 +1201,7 @@ class ScriptExplore(object):
|
|
|
self.send2game("m{0}\n\r".format(self.highsector))
|
|
|
|
|
|
|
|
|
- self.didScan = False
|
|
|
- self.dense = []
|
|
|
- self.clear = []
|
|
|
- self.highwarp = 0
|
|
|
- self.highsector = 0
|
|
|
+ self.resetStuff()
|
|
|
self.state = 1
|
|
|
|
|
|
|