about summary refs log tree commit diff stats
path: root/Archipelago/settings_screen.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/settings_screen.gd')
-rw-r--r--Archipelago/settings_screen.gd45
1 files changed, 44 insertions, 1 deletions
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index 1be32d9..bf2c78f 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd
@@ -2,6 +2,12 @@ extends Spatial
2 2
3 3
4func _ready(): 4func _ready():
5 # Some helpful logging.
6 if Steam.isSubscribed():
7 global._print("Provisioning successful! Build ID: %d" % Steam.getAppBuildId())
8 else:
9 global._print("Provisioning failed.")
10
5 # Undo the load screen removing our cursor 11 # Undo the load screen removing our cursor
6 get_tree().get_root().set_disable_input(false) 12 get_tree().get_root().set_disable_input(false)
7 Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) 13 Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
@@ -62,6 +68,20 @@ func _ready():
62 self.get_node("Panel/password_box").text = apclient.ap_pass 68 self.get_node("Panel/password_box").text = apclient.ap_pass
63 self.get_node("Panel/confusing_box").pressed = apclient.confusify_world 69 self.get_node("Panel/confusing_box").pressed = apclient.confusify_world
64 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer 70 self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer
71 self.get_node("Panel/position_box").pressed = apclient.track_player
72
73 var history_box = get_node("Panel/connection_history")
74 if apclient.connection_history.empty():
75 history_box.disabled = true
76 else:
77 history_box.disabled = false
78
79 var i = 0
80 for details in apclient.connection_history:
81 history_box.get_popup().add_item("%s (%s)" % [details[1], details[0]], i)
82 i += 1
83
84 history_box.get_popup().connect("id_pressed", self, "historySelected")
65 85
66 # Show client version. 86 # Show client version.
67 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version 87 self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version
@@ -105,10 +125,24 @@ func connectionStatus(message):
105func connectionSuccessful(): 125func connectionSuccessful():
106 var apclient = global.get_node("Archipelago") 126 var apclient = global.get_node("Archipelago")
107 127
128 # Save connection details
129 var connection_details = [apclient.ap_server, apclient.ap_user, apclient.ap_pass]
130 if apclient.connection_history.has(connection_details):
131 apclient.connection_history.erase(connection_details)
132 apclient.connection_history.push_front(connection_details)
133 if apclient.connection_history.size() > 10:
134 apclient.connection_history.resize(10)
135 apclient.saveSettings()
136
108 # Switch to LL1 137 # Switch to LL1
109 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) 138 Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
110 global.map = "level1"
111 global.save_file = apclient.getSaveFileName() 139 global.save_file = apclient.getSaveFileName()
140
141 if Directory.new().file_exists("user://level1/%s.save" % global.save_file):
142 global.map = "level1"
143 else:
144 global.map = "level1_stable"
145
112 var _discard = get_tree().change_scene("res://scenes/load_screen.tscn") 146 var _discard = get_tree().change_scene("res://scenes/load_screen.tscn")
113 147
114 148
@@ -121,3 +155,12 @@ func connectionUnsuccessful(error_message):
121 popup.popup_exclusive = true 155 popup.popup_exclusive = true
122 popup.get_ok().visible = true 156 popup.get_ok().visible = true
123 popup.popup_centered() 157 popup.popup_centered()
158
159
160func historySelected(index):
161 var apclient = global.get_node("Archipelago")
162 var details = apclient.connection_history[index]
163
164 self.get_node("Panel/server_box").text = details[0]
165 self.get_node("Panel/player_box").text = details[1]
166 self.get_node("Panel/password_box").text = details[2]