about summary refs log tree commit diff stats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/Archipelago/manager.gd34
1 files changed, 33 insertions, 1 deletions
diff --git a/client/Archipelago/manager.gd b/client/Archipelago/manager.gd index d950cd6..e1c32b9 100644 --- a/client/Archipelago/manager.gd +++ b/client/Archipelago/manager.gd
@@ -13,6 +13,7 @@ var connection_history = []
13 13
14var client 14var client
15 15
16var _localdata_file = ""
16var _received_indexes = [] 17var _received_indexes = []
17var _last_new_item = -1 18var _last_new_item = -1
18 19
@@ -37,6 +38,22 @@ func saveSettings():
37 pass 38 pass
38 39
39 40
41func saveLocaldata():
42 # Save the MW/slot specific settings to disk.
43 var dir = DirAccess.open("user://")
44 var folder = "archipelago_data"
45 if not dir.dir_exists(folder):
46 dir.make_dir(folder)
47
48 var file = FileAccess.open(_localdata_file, FileAccess.WRITE)
49
50 var data = [
51 _last_new_item,
52 ]
53 file.store_var(data, true)
54 file.close()
55
56
40func connectToServer(): 57func connectToServer():
41 _received_indexes = [] 58 _received_indexes = []
42 _last_new_item = -1 59 _last_new_item = -1
@@ -99,7 +116,7 @@ func _process_item(item, index, from, flags):
99 # Show a message about the item if it's new. 116 # Show a message about the item if it's new.
100 if index != null and index > _last_new_item: 117 if index != null and index > _last_new_item:
101 _last_new_item = index 118 _last_new_item = index
102 #saveLocaldata() 119 saveLocaldata()
103 120
104 var player_name = "Unknown" 121 var player_name = "Unknown"
105 if client._player_name_by_slot.has(from): 122 if client._player_name_by_slot.has(from):
@@ -172,6 +189,21 @@ func _client_connect_status(message):
172 189
173 190
174func _client_connected(): 191func _client_connected():
192 _localdata_file = "user://archipelago_data/%s_%d" % [client._seed, client._slot]
193 _last_new_item = -1
194
195 if FileAccess.file_exists(_localdata_file):
196 var ap_file = FileAccess.open(_localdata_file, FileAccess.READ)
197 var localdata = ap_file.get_var(true)
198 ap_file.close()
199
200 if typeof(localdata) != TYPE_ARRAY:
201 print("AP localdata file is corrupted")
202 localdata = []
203
204 if localdata.size() > 0:
205 _last_new_item = localdata[0]
206
175 emit_signal("ap_connected") 207 emit_signal("ap_connected")
176 208
177 209
66 167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193