# Undercooked - a game about cooking # Copyright 2024 metamuffin # Copyright 2024 tpart # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, version 3 of the License only. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # extends Control @onready var transition = $SceneTransition @onready var quick_connect = $side/margin/options/quick_connect @onready var quit_button = $side/margin/options/quit @onready var connect_uri = $side/margin/options/connect/uri func _ready(): quick_connect.grab_focus() if OS.has_feature("web"): quit_button.hide() connect_uri.text = Global.settings["last_server_url"] func _on_quit_pressed(): transition.quit() func _on_credits_pressed(): transition.transition_to("res://menu/credits_menu.tscn") func _on_connect_pressed(): var url = $side/margin/options/connect/uri.text Global.settings["last_server_url"] = url Global.save_profile() connect_to(url) func _on_quick_connect_pressed(): if OS.has_feature("JavaScript"): connect_to(JavaScriptBridge.eval(""" window.location.protocol.endsWith("s:") ? `wss://${window.location.host}/` : `ws://${window.location.hostname}:27032/` """)) else: connect_to("wss://undercooked.metamuffin.org/") func connect_to(url): print("Connecting to %s" % url) Global.server_url = url transition.transition_to("res://game.tscn") func _on_change_character_pressed(): transition.transition_to("res://menu/character_menu.tscn") func _on_settings_pressed(): transition.transition_to("res://menu/settings_menu.tscn")