diff options
Diffstat (limited to 'UI/Lobby.gd')
-rw-r--r-- | UI/Lobby.gd | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/UI/Lobby.gd b/UI/Lobby.gd index 4fea0bc..68d843c 100644 --- a/UI/Lobby.gd +++ b/UI/Lobby.gd @@ -1,6 +1,13 @@ extends Control +func _ready(): + if OS.has_environment("USER"): + %Name.text = OS.get_environment("USER") + elif OS.has_environment("USERNAME"): + %Name.text = OS.get_environment("USERNAME") + + func get_ip(): var ip := "127.0.0.1" if %IP.text: @@ -17,10 +24,12 @@ func get_port(): return port func _on_host_pressed() -> void: + Client.player.name = %Name.text Network.host_game(get_port()) get_tree().change_scene_to_file("res://Stages/world.tscn") func _on_join_pressed() -> void: + Client.player.name = %Name.text Network.join_game(get_ip(), get_port()) get_tree().change_scene_to_file("res://Stages/world.tscn") |