diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-04-12 16:22:38 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-04-12 16:22:38 -0400 |
commit | 437438ad6aed07a2c1d149a72759f7f2a3277ea6 (patch) | |
tree | 82534db3d69ad8c50e9f47fff52134cd945213f4 /Archipelago/client.gd | |
parent | 563382d459ce18b6df4e5cf9161bc47d942d9276 (diff) | |
download | lingo-archipelago-437438ad6aed07a2c1d149a72759f7f2a3277ea6.tar.gz lingo-archipelago-437438ad6aed07a2c1d149a72759f7f2a3277ea6.tar.bz2 lingo-archipelago-437438ad6aed07a2c1d149a72759f7f2a3277ea6.zip |
Created global client object
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r-- | Archipelago/client.gd | 44 |
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 @@ | |||
1 | extends Node | ||
2 | |||
3 | var ap_server = "" | ||
4 | var ap_user = "" | ||
5 | var ap_pass = "" | ||
6 | |||
7 | |||
8 | func _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 | |||
26 | func _ready(): | ||
27 | pass | ||
28 | |||
29 | |||
30 | func 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() | ||