about summary refs log tree commit diff stats
path: root/Archipelago
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-04-17 12:30:18 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-04-17 12:30:18 -0400
commitce831897b89974f38fd6f0583e5feac178643a14 (patch)
tree205fac55f33de613efc2d4c15dd9e9ecc15febe4 /Archipelago
parentdbc0e454596ba7e1a8378685c35e37dccd19c964 (diff)
downloadlingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.tar.gz
lingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.tar.bz2
lingo-archipelago-ce831897b89974f38fd6f0583e5feac178643a14.zip
Add connection history
Diffstat (limited to 'Archipelago')
-rw-r--r--Archipelago/client.gd6
-rw-r--r--Archipelago/settings_screen.gd31
2 files changed, 36 insertions, 1 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index f15afe6..489fdb9 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -15,6 +15,7 @@ var ap_pass = ""
15var confusify_world = false 15var confusify_world = false
16var enable_multiplayer = false 16var enable_multiplayer = false
17var track_player = false 17var track_player = false
18var connection_history = []
18 19
19const my_version = "2.1.1" 20const my_version = "2.1.1"
20const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"} 21const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"}
@@ -161,6 +162,8 @@ func _init():
161 enable_multiplayer = data[5] 162 enable_multiplayer = data[5]
162 if data.size() > 6: 163 if data.size() > 6:
163 track_player = data[6] 164 track_player = data[6]
165 if data.size() > 7:
166 connection_history = data[7]
164 167
165 processDatapackages() 168 processDatapackages()
166 169
@@ -485,7 +488,8 @@ func saveSettings():
485 _datapackages, 488 _datapackages,
486 confusify_world, 489 confusify_world,
487 enable_multiplayer, 490 enable_multiplayer,
488 track_player 491 track_player,
492 connection_history
489 ] 493 ]
490 file.store_var(data, true) 494 file.store_var(data, true)
491 file.close() 495 file.close()
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index de64214..453e3bf 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd
@@ -67,6 +67,19 @@ func _ready():
67 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer 67 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer
68 self.get_node("Panel/position_box").pressed = apclient.track_player 68 self.get_node("Panel/position_box").pressed = apclient.track_player
69 69
70 var history_box = get_node("Panel/connection_history")
71 if apclient.connection_history.empty():
72 history_box.disabled = true
73 else:
74 history_box.disabled = false
75
76 var i = 0
77 for details in apclient.connection_history:
78 history_box.get_popup().add_item("%s (%s)" % [details[1], details[0]], i)
79 i += 1
80
81 history_box.get_popup().connect("id_pressed", self, "historySelected")
82
70 # Show client version. 83 # Show client version.
71 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version 84 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version
72 85
@@ -109,6 +122,15 @@ func connectionStatus(message):
109func connectionSuccessful(): 122func connectionSuccessful():
110 var apclient = global.get_node("Archipelago") 123 var apclient = global.get_node("Archipelago")
111 124
125 # Save connection details
126 var connection_details = [apclient.ap_server, apclient.ap_user, apclient.ap_pass]
127 if apclient.connection_history.has(connection_details):
128 apclient.connection_history.erase(connection_details)
129 apclient.connection_history.push_front(connection_details)
130 if apclient.connection_history.size() > 10:
131 apclient.connection_history.resize(10)
132 apclient.saveSettings()
133
112 # Switch to LL1 134 # Switch to LL1
113 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) 135 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
114 global.save_file = apclient.getSaveFileName() 136 global.save_file = apclient.getSaveFileName()
@@ -130,3 +152,12 @@ func connectionUnsuccessful(error_message):
130 popup.popup_exclusive = true 152 popup.popup_exclusive = true
131 popup.get_ok().visible = true 153 popup.get_ok().visible = true
132 popup.popup_centered() 154 popup.popup_centered()
155
156
157func historySelected(index):
158 var apclient = global.get_node("Archipelago")
159 var details = apclient.connection_history[index]
160
161 self.get_node("Panel/server_box").text = details[0]
162 self.get_node("Panel/player_box").text = details[1]
163 self.get_node("Panel/password_box").text = details[2]