about summary refs log tree commit diff stats
path: root/Archipelago/client.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r--Archipelago/client.gd44
1 files changed, 44 insertions, 0 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd new file mode 100644 index 0000000..1d2affd --- /dev/null +++ b/Archipelago/client.gd
@@ -0,0 +1,44 @@
1extends Node
2
3var ap_server = ""
4var ap_user = ""
5var ap_pass = ""
6
7
8func _init():
9 global._print("Instantiated APClient")
10
11 # Read AP settings from file, if there are any
12 var file = File.new()
13 if file.file_exists("user://settings/archipelago"):
14 file.open("user://settings/archipelago", File.READ)
15 var data = file.get_var(true)
16 file.close()
17
18 if data.size() > 0:
19 ap_server = data[0]
20 if data.size() > 1:
21 ap_user = data[1]
22 if data.size() > 2:
23 ap_pass = data[2]
24
25
26func _ready():
27 pass
28
29
30func saveSettings():
31 # Save the AP settings to disk.
32 var dir = Directory.new()
33 var path = "user://settings"
34 if dir.dir_exists(path):
35 pass
36 else:
37 dir.make_dir(path)
38
39 var file = File.new()
40 file.open("user://settings/archipelago", File.WRITE)
41
42 var data = [ap_server, ap_user, ap_pass]
43 file.store_var(data, true)
44 file.close()