From 4c4bd2c903471becfc0c9b419e5b0852b94da18b Mon Sep 17 00:00:00 2001 From: copygirl Date: Sun, 8 Dec 2024 00:39:15 +0100 Subject: [PATCH] Show correct number of player(s) --- copyMultiplayer.gd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/copyMultiplayer.gd b/copyMultiplayer.gd index ac18fcb..01cba63 100644 --- a/copyMultiplayer.gd +++ b/copyMultiplayer.gd @@ -77,7 +77,7 @@ func host_pressed() -> void: var peer := ENetMultiplayerPeer.new() if peer.create_server(port) == OK: multiplayer.multiplayer_peer = peer - set_status("Hosting: 0 players") + update_status() print_log("Opened server") update_enabled_state(true) else: @@ -164,9 +164,10 @@ func update_model_rotation(controller: ModelController) -> void: controller.rotation.y = from_2d.angle_to_point(to_2d) / 4 # Magic value, probably depends on FOV. func update_status() -> void: - var num_player := multiplayer.get_peers().size() + var num_players := 1 + multiplayer.get_peers().size() var side := "Hosting" if multiplayer.is_server() else "Connected" - set_status([side, ": ", num_player, " players"]) + var s := "s" if num_players != 1 else "" + set_status([side, ": ", num_players, " player", s]) @rpc("any_peer", "reliable")