# 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 quick_connect = $side/margin/options/quick_connect @onready var quit_button = $side/margin/options/quit func _ready(): quick_connect.grab_focus() if OS.has_feature("web"): quit_button.hide() func _on_quit_pressed(): get_tree().quit() func _on_credits_pressed(): $SceneTransition.transition_to("res://scenes/credits_menu.tscn") func _on_connect_pressed(): connect_to($side/options/connect/uri.text) 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) Multiplayer.url = url $SceneTransition.transition_to("res://scenes/game.tscn")