From a7c26b74bbdafc93f8a2441f692647a7e55a47ed Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 20 Apr 2023 23:14:53 -0400 Subject: Returning to main menu now disconnects --- Archipelago/client.gd | 14 +++++++++----- Archipelago/pause_menu.gd | 8 ++++++++ Archipelago/settings_screen.gd | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Archipelago/pause_menu.gd diff --git a/Archipelago/client.gd b/Archipelago/client.gd index bb6d0a2..f805577 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -98,10 +98,15 @@ func _ready(): _client.connect("data_received", self, "_on_data") -func _errored(): - global._print("AP connection failed") +func _reset_state(): _should_process = false _authenticated = false + _map_loaded = false + + +func _errored(): + global._print("AP connection failed") + _reset_state() emit_signal( "could_not_connect", @@ -109,10 +114,9 @@ func _errored(): ) -func _closed(): +func _closed(_was_clean = true): global._print("Connection closed") - _should_process = false - _authenticated = false + _reset_state() if not _initiated_disconnect: emit_signal("could_not_connect", "Disconnected from Archipelago") diff --git a/Archipelago/pause_menu.gd b/Archipelago/pause_menu.gd new file mode 100644 index 0000000..40994d9 --- /dev/null +++ b/Archipelago/pause_menu.gd @@ -0,0 +1,8 @@ +extends "res://scripts/pause_menu.gd" + + +func _main_menu(): + var apclient = global.get_node("Archipelago") + apclient.disconnect_from_ap() + + ._main_menu() diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index b74617b..6216dd7 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd @@ -24,6 +24,7 @@ func _ready(): installScriptExtension("user://maps/Archipelago/painting_eye.gd") installScriptExtension("user://maps/Archipelago/panelLevelSwitch.gd") installScriptExtension("user://maps/Archipelago/panelEnd.gd") + installScriptExtension("user://maps/Archipelago/pause_menu.gd") global.get_node("Archipelago").connect("client_connected", self, "connectionSuccessful") global.get_node("Archipelago").connect("could_not_connect", self, "connectionUnsuccessful") -- cgit 1.4.1