You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
782 B
33 lines
782 B
extends Control
|
|
|
|
var LobbyMenu = preload("res://scenes/menus/LobbyMenu.tscn")
|
|
|
|
|
|
func _ready():
|
|
find_node("bots").set_pressed(local_storage.read_value("bots", true))
|
|
|
|
|
|
func _draw():
|
|
find_node("host").grab_focus()
|
|
|
|
|
|
func _on_host_pressed():
|
|
var port = find_node("port").get_value()
|
|
var bots = find_node("bots").is_pressed()
|
|
var err = server.host_game(int(port), bots)
|
|
|
|
if err == OK:
|
|
var lobby_menu = LobbyMenu.instance()
|
|
get_tree().get_root().add_child(lobby_menu)
|
|
|
|
gamestate.set_player(get_tree().get_network_unique_id())
|
|
|
|
queue_free()
|
|
else:
|
|
_on_back_pressed()
|
|
get_tree().get_root().get_node("multiplayer_menu").show_error_dialog(tr("ERROR_SERVER_CREATION"))
|
|
|
|
|
|
func _on_back_pressed():
|
|
queue_free()
|
|
get_tree().get_root().get_node("multiplayer_menu").show()
|