## Copyright (C) 2024 Patrick_Pluto ## ## This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. ## ## 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 General Public License for more details. ## ## You should have received a copy of the GNU General Public License along with this program. If not, see . extends Control func _ready(): if Server.is_server: $player_customization/ip.hide() $player_customization/ip.text = "localhost" $player_customization/ip.editable = false $start/start.show() $start/start.disabled = false $player_list/list.text = " " func _process(delta): if Server.is_server: Server.sync_playerlist.rpc($player_list/list.text) func _on_start_pressed(): Server.start_game.rpc(Server.players) func _input(event): if Input.is_action_just_pressed("escape"): get_tree().change_scene_to_file("res://menus/main_menu.tscn") func _on_join_pressed(): if $player_customization/name.text != "" and $player_customization/ip.text != "": if !Server.is_server: Server.join_game($player_customization/ip.text) $player_customization/join.hide() $player_customization/join.disabled = true $player_customization/name.editable = false $player_customization/ip.editable = false while $player_list/list.text == "": await get_tree().create_timer(0.001).timeout Server.send_playerinfo.rpc($player_customization/name.text, multiplayer.get_unique_id())