-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravel.py
executable file
·42 lines (32 loc) · 950 Bytes
/
travel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
import krpc
import click
import time
@click.command()
def run():
conn = krpc.connect()
vessel = conn.space_center.active_vessel
contracts = conn.space_center.contract_manager.active_contracts
travel = {}
for contract in contracts:
if contract.completed:
continue
if not contract.title.startswith('Ferry'):
continue
for param in contract.parameters:
if param.completed:
continue
if not param.title in travel:
travel[param.title] = []
for sub in param.children:
if sub.completed:
continue
travel[param.title].append(sub.title)
for t in sorted(travel.keys()):
if not len(travel[t]):
continue
print(t)
for s in sorted(travel[t]):
print("\t",s)
if __name__ == '__main__':
run()