summary refs log tree commit diff stats
path: root/client/Archipelago
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-08-29 13:45:29 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-08-29 13:45:29 -0400
commit660c5eda45dfca9ff5739d131224f2dbcc258289 (patch)
treeb2bcfdd14b04b85a9bf2a3e5d6abee377e20a2e2 /client/Archipelago
parentac557a1c1ca41291e61cccdaf22549ed54c898b8 (diff)
downloadlingo2-archipelago-660c5eda45dfca9ff5739d131224f2dbcc258289.tar.gz
lingo2-archipelago-660c5eda45dfca9ff5739d131224f2dbcc258289.tar.bz2
lingo2-archipelago-660c5eda45dfca9ff5739d131224f2dbcc258289.zip
[Client] Save connection settings to disk
Diffstat (limited to 'client/Archipelago')
-rw-r--r--client/Archipelago/client.gd2
-rw-r--r--client/Archipelago/manager.gd37
2 files changed, 37 insertions, 2 deletions
diff --git a/client/Archipelago/client.gd b/client/Archipelago/client.gd index d394b6c..4c34e91 100644 --- a/client/Archipelago/client.gd +++ b/client/Archipelago/client.gd
@@ -45,7 +45,7 @@ signal message_received(message)
45func _init(): 45func _init():
46 global._print("Instantiated APClient") 46 global._print("Instantiated APClient")
47 47
48 # Read AP settings from file, if there are any 48 # Read AP datapackages from file, if there are any
49 if FileAccess.file_exists("user://ap_datapackages"): 49 if FileAccess.file_exists("user://ap_datapackages"):
50 var file = FileAccess.open("user://ap_datapackages", FileAccess.READ) 50 var file = FileAccess.open("user://ap_datapackages", FileAccess.READ)
51 var data = file.get_var(true) 51 var data = file.get_var(true)
diff --git a/client/Archipelago/manager.gd b/client/Archipelago/manager.gd index e1c32b9..6b34bdf 100644 --- a/client/Archipelago/manager.gd +++ b/client/Archipelago/manager.gd
@@ -22,6 +22,30 @@ signal connect_status
22signal ap_connected 22signal ap_connected
23 23
24 24
25func _init():
26 # Read AP settings from file, if there are any
27 if FileAccess.file_exists("user://ap_settings"):
28 var file = FileAccess.open("user://ap_settings", FileAccess.READ)
29 var data = file.get_var(true)
30 file.close()
31
32 if typeof(data) != TYPE_ARRAY:
33 global._print("AP settings file is corrupted")
34 data = []
35
36 if data.size() > 0:
37 ap_server = data[0]
38
39 if data.size() > 1:
40 ap_user = data[1]
41
42 if data.size() > 2:
43 ap_pass = data[2]
44
45 if data.size() > 3:
46 connection_history = data[3]
47
48
25func _ready(): 49func _ready():
26 client = SCRIPT_client.new() 50 client = SCRIPT_client.new()
27 client.SCRIPT_uuid = SCRIPT_uuid 51 client.SCRIPT_uuid = SCRIPT_uuid
@@ -35,7 +59,18 @@ func _ready():
35 59
36 60
37func saveSettings(): 61func saveSettings():
38 pass 62 # Save the AP settings to disk.
63 var path = "user://ap_settings"
64 var file = FileAccess.open(path, FileAccess.WRITE)
65
66 var data = [
67 ap_server,
68 ap_user,
69 ap_pass,
70 connection_history,
71 ]
72 file.store_var(data, true)
73 file.close()
39 74
40 75
41func saveLocaldata(): 76func saveLocaldata():