about summary refs log tree commit diff stats
path: root/client/Archipelago/settings_screen.gd
diff options
context:
space:
mode:
Diffstat (limited to 'client/Archipelago/settings_screen.gd')
-rw-r--r--client/Archipelago/settings_screen.gd48
1 files changed, 48 insertions, 0 deletions
diff --git a/client/Archipelago/settings_screen.gd b/client/Archipelago/settings_screen.gd index ff6f9df..b7bfacf 100644 --- a/client/Archipelago/settings_screen.gd +++ b/client/Archipelago/settings_screen.gd
@@ -44,8 +44,10 @@ func _ready():
44 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/pauseMenu.gd")) 44 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/pauseMenu.gd"))
45 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/player.gd")) 45 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/player.gd"))
46 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/saver.gd")) 46 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/saver.gd"))
47 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/teleport.gd"))
47 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/teleportListener.gd")) 48 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/teleportListener.gd"))
48 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/visibilityListener.gd")) 49 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/visibilityListener.gd"))
50 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/worldport.gd"))
49 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/worldportListener.gd")) 51 installScriptExtension(ResourceLoader.load("user://maps/Archipelago/worldportListener.gd"))
50 52
51 var proto_script = load("user://maps/Archipelago/generated/proto.gd") 53 var proto_script = load("user://maps/Archipelago/generated/proto.gd")
@@ -67,6 +69,12 @@ func _ready():
67 textclient_instance.name = "Textclient" 69 textclient_instance.name = "Textclient"
68 global.add_child(textclient_instance) 70 global.add_child(textclient_instance)
69 71
72 var compass_overlay_script = load("user://maps/Archipelago/compass_overlay.gd")
73 var compass_overlay_instance = compass_overlay_script.new()
74 compass_overlay_instance.name = "Compass"
75 compass_overlay_instance.SCRIPT_compass = load("user://maps/Archipelago/compass.gd")
76 global.add_child(compass_overlay_instance)
77
70 var ap = global.get_node("Archipelago") 78 var ap = global.get_node("Archipelago")
71 var gamedata = global.get_node("Gamedata") 79 var gamedata = global.get_node("Gamedata")
72 ap.connect("ap_connected", connectionSuccessful) 80 ap.connect("ap_connected", connectionSuccessful)
@@ -99,6 +107,10 @@ func _ready():
99 $Panel/player_box.add_theme_font_size_override("font_size", 36) 107 $Panel/player_box.add_theme_font_size_override("font_size", 36)
100 $Panel/password_box.add_theme_font_size_override("font_size", 36) 108 $Panel/password_box.add_theme_font_size_override("font_size", 36)
101 109
110 # Set up version mismatch dialog.
111 $Panel/VersionMismatch.connect("confirmed", startGame)
112 $Panel/VersionMismatch.get_cancel_button().pressed.connect(versionMismatchDeclined)
113
102 114
103# Adapted from https://gitlab.com/Delta-V-Modding/Mods/-/blob/main/game/ModLoader.gd 115# Adapted from https://gitlab.com/Delta-V-Modding/Mods/-/blob/main/game/ModLoader.gd
104func installScriptExtension(childScript: Resource): 116func installScriptExtension(childScript: Resource):
@@ -128,6 +140,33 @@ func connectionStatus(message):
128 140
129func connectionSuccessful(): 141func connectionSuccessful():
130 var ap = global.get_node("Archipelago") 142 var ap = global.get_node("Archipelago")
143 var gamedata = global.get_node("Gamedata")
144
145 # Check for major version mismatch.
146 if ap.apworld_version[0] != gamedata.objects.get_version():
147 $Panel/AcceptDialog.exclusive = false
148
149 var popup = self.get_node("Panel/VersionMismatch")
150 popup.title = "Version Mismatch!"
151 popup.dialog_text = (
152 "This slot was generated using v%d.%d of the Lingo 2 apworld,\nwhich has a different major version than this client (v%d.%d).\nIt is highly recommended to play using the correct version of the client.\nYou may experience bugs or logic issues if you continue."
153 % [
154 ap.apworld_version[0],
155 ap.apworld_version[1],
156 gamedata.objects.get_version(),
157 ap.MOD_VERSION
158 ]
159 )
160 popup.exclusive = true
161 popup.popup_centered()
162
163 return
164
165 startGame()
166
167
168func startGame():
169 var ap = global.get_node("Archipelago")
131 170
132 # Save connection details 171 # Save connection details
133 var connection_details = [ap.ap_server, ap.ap_user, ap.ap_pass] 172 var connection_details = [ap.ap_server, ap.ap_user, ap.ap_pass]
@@ -166,6 +205,8 @@ func connectionSuccessful():
166 clearResourceCache("res://objects/nodes/panel.tscn") 205 clearResourceCache("res://objects/nodes/panel.tscn")
167 clearResourceCache("res://objects/nodes/player.tscn") 206 clearResourceCache("res://objects/nodes/player.tscn")
168 clearResourceCache("res://objects/nodes/saver.tscn") 207 clearResourceCache("res://objects/nodes/saver.tscn")
208 clearResourceCache("res://objects/nodes/teleport.tscn")
209 clearResourceCache("res://objects/nodes/worldport.tscn")
169 clearResourceCache("res://objects/scenes/menus/pause_menu.tscn") 210 clearResourceCache("res://objects/scenes/menus/pause_menu.tscn")
170 211
171 var paintings_dir = DirAccess.open("res://objects/meshes/paintings") 212 var paintings_dir = DirAccess.open("res://objects/meshes/paintings")
@@ -190,6 +231,13 @@ func connectionUnsuccessful(error_message):
190 popup.get_ok_button().visible = true 231 popup.get_ok_button().visible = true
191 popup.popup_centered() 232 popup.popup_centered()
192 233
234 $Panel/connect_button.disabled = false
235
236
237func versionMismatchDeclined():
238 $Panel/AcceptDialog.hide()
239 $Panel/connect_button.disabled = false
240
193 241
194func historySelected(index): 242func historySelected(index):
195 var ap = global.get_node("Archipelago") 243 var ap = global.get_node("Archipelago")