Public repository for MUR pre alpha
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.
 
 
 
 
 

41 lines
1.2 KiB

extends Control
var LobbyMenu = preload("res://scenes/menus/LobbyMenu.tscn")
func _ready():
find_node("bots").set_pressed(config.get_value("game","bots", true))
find_node("bot_difficulty").set_value(config.get_value("game","bot_difficulty", gamestate.DEFAULT_BOT_DIFFICULTY))
find_node("bot_difficulty").set_editable(find_node("bots").is_pressed())
find_node("bot_difficulty").set_tooltip(tr("BOT_DIFFICULTY"))
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 bot_difficulty = find_node("bot_difficulty").get_value()
var err = server.host_game(int(port), bots, bot_difficulty)
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()
func _on_bots_toggled(button_pressed):
find_node("bot_difficulty").set_editable(button_pressed)