Show correct number of player(s)

main
copygirl 1 month ago
parent 98d4f94126
commit 4c4bd2c903
  1. 7
      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")

Loading…
Cancel
Save