From d8c5d0548fc3e70ceb15dff938a097026f033e87 Mon Sep 17 00:00:00 2001 From: John Breaux Date: Mon, 6 Dec 2021 12:57:06 -0600 Subject: [PATCH] Net: Fix off-by-one in number of players allowed to connect (was 3, now 2; Godot does not include the 'server'.) --- godot_ship/script/network/Net.gd | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/godot_ship/script/network/Net.gd b/godot_ship/script/network/Net.gd index e59c1d5..41babfb 100644 --- a/godot_ship/script/network/Net.gd +++ b/godot_ship/script/network/Net.gd @@ -62,8 +62,8 @@ func send(id, mail, mail_type = REPLY): # Host # start_host: Host the game # port: TCP port -# max_players: Largest number of players allowed to connect at a time -func start_host(port = DEFAULT_PORT, max_players = 2): +# max_players: Largest number of players allowed to connect at a time (the host does not count) +func start_host(port = DEFAULT_PORT, max_players = 1): get_hostname() peer_info[1] = local_info # Notify that peer list has updated @@ -150,16 +150,10 @@ func _ready(): func _peer_connected(id): # Send peer info to remote peer rpc_id(id, "register_peer", local_info) - if hosting and peer_info.size() >= 2: - pass - pass func _peer_disconnected(id): # Unregister the peer locally unregister_peer(id) - if hosting and peer_info.size() < 2: - pass - pass func _host_connected():