33 lines
775 B
GDScript
33 lines
775 B
GDScript
extends Control
|
|
|
|
var LobbyMenu = preload("res://scenes/menus/LobbyMenu.tscn")
|
|
|
|
|
|
func _ready():
|
|
find_node("bots").set_pressed(config.get_value("game","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() |