Kaynağa Gözat

Modifications to flybywire

Petra Lamborn 5 yıl önce
ebeveyn
işleme
4a340de6b3
2 değiştirilmiş dosya ile 18 ekleme ve 4 silme
  1. 1
    0
      .gitignore
  2. 17
    4
      flybywire.py

+ 1
- 0
.gitignore Dosyayı Görüntüle

@@ -2,3 +2,4 @@
2 2
 *.csv
3 3
 *.html
4 4
 *.pdf
5
+__pycache__

+ 17
- 4
flybywire.py Dosyayı Görüntüle

@@ -1,9 +1,22 @@
1 1
 import krpc
2 2
 
3
-connected = False
3
+class wire:
4
+    """Functions over the top of the krpc api
5
+    """
4 6
 
7
+    def __init__(self, name = "Fly by wire", address = krpc.DEFAULT_ADDRESS, rpc = krpc.DEFAULT_RPC_PORT,
8
+                 stream = krpc.DEFAULT_STREAM_PORT):
9
+        self._address = address
10
+        self._rpc_port = rpc
11
+        self._stream_port = stream
12
+        self._name = name
13
+        self._conn = krpc.connect(self.name, self._address, self._rpc_port,
14
+                                  self._stream_port)
15
+
16
+    def name(self):
17
+        return self._name
18
+
19
+    def close():
20
+        self._conn.close()
5 21
 
6 22
 
7
-def init(remote = "localhost"):
8
-    global conn = krpc.connect("Fly by Wire", remote)
9
-    global vessel = conn.