blob: 1ac80408a4e44476ddf14901b1dc11288a211662 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# 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 <https://www.gnu.org/licenses/>.
#
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://menu/credits_menu.tscn")
func _on_connect_pressed():
connect_to($side/margin/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://game.tscn")
func _on_change_character_pressed():
$SceneTransition.transition_to("res://menu/character_menu.tscn")
|