Update analyzer.py, commander.py and six other files
This commit is contained in:
@@ -28,7 +28,10 @@ class MissionParam:
|
||||
elif self.cls == list:
|
||||
return [i.strip() for i in val.split(',')]
|
||||
elif issubclass(self.cls, Base):
|
||||
data = store.get(self.cls, val)
|
||||
if type(val) == str:
|
||||
data = store.get(self.cls, val)
|
||||
else:
|
||||
data = val
|
||||
if data is None:
|
||||
raise ValueError('object not found')
|
||||
return data.symbol
|
||||
@@ -179,9 +182,8 @@ class BaseMission(Mission):
|
||||
traject = self.st('traject')
|
||||
if traject is None or traject == []:
|
||||
return 'done'
|
||||
dest = self.store.get(Waypoint, traject[-1])
|
||||
loc = self.ship.location()
|
||||
print(dest, loc)
|
||||
dest = traject[-1]
|
||||
loc = self.ship.location
|
||||
if dest == loc:
|
||||
self.sts('traject', None)
|
||||
return 'done'
|
||||
@@ -200,10 +202,10 @@ class BaseMission(Mission):
|
||||
def step_calculate_traject(self, dest):
|
||||
if type(dest) == str:
|
||||
dest = self.store.get(Waypoint, dest)
|
||||
loc = self.ship.location()
|
||||
loc_sys = self.store.get(System, loc.system())
|
||||
loc = self.ship.location
|
||||
loc_sys = loc.system
|
||||
loc_jg = self.analyzer.get_jumpgate(loc_sys)
|
||||
dest_sys = self.store.get(System, dest.system())
|
||||
dest_sys = dest.system
|
||||
dest_jg = self.analyzer.get_jumpgate(dest_sys)
|
||||
if dest_sys == loc_sys:
|
||||
result = [dest.symbol]
|
||||
@@ -212,10 +214,10 @@ class BaseMission(Mission):
|
||||
path = self.analyzer.find_path(loc_sys, dest_sys)
|
||||
result = []
|
||||
if loc.symbol != loc_jg.symbol:
|
||||
result.append(loc_jg.symbol)
|
||||
result.append(loc_jg)
|
||||
result += [s.symbol for s in path[1:]]
|
||||
if dest_jg.symbol != dest.symbol:
|
||||
result.append(dest.symbol)
|
||||
result.append(dest)
|
||||
self.sts('traject', result)
|
||||
print(result)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user