fix debug information being from the wrong player

This commit is contained in:
Jan 2020-06-19 00:11:03 +02:00
parent 402ad8c927
commit 0bf8c83f1e
2 changed files with 6 additions and 6 deletions

View file

@ -34,7 +34,6 @@ func close_menu():
func open_quick_join_menu():
$MenuContainer/MainMenu.hide()
$MenuContainer/QuickJoinMenu.show()
func close_quick_join_menu():
$MenuContainer/MainMenu.show()
@ -45,11 +44,11 @@ func join_home():
initialize_client()
func join_unfa():
SERVER_IP = "172.28.162.191"
SERVER_IP = "172.25.162.191"
initialize_client()
func join_jan():
SERVER_IP = "172.28.166.24"
SERVER_IP = "172.25.166.24"
initialize_client()
func debug_connection_status():
@ -67,9 +66,9 @@ func initialize_server():
peer.create_server(SERVER_PORT, MAX_PLAYERS)
get_tree().connect("network_peer_connected", self, "on_peer_connected")
get_tree().connect("network_peer_disconnected", self, "on_peer_disconnected")
add_player(1, false)
get_tree().network_peer = peer
close_menu()
add_player(1, false)
func initialize_client():
var peer = NetworkedMultiplayerENet.new()
@ -102,6 +101,8 @@ sync func check_players(player_names):
if player_name == str(get_tree().get_network_unique_id()):
player.camera.current = true
player.set_network_master(get_tree().get_network_unique_id())
print(get_tree().get_network_unique_id())
func add_player(id, check=true):
var player = player_scene.instance()

View file

@ -103,7 +103,6 @@ func shoot():
var hit = result.collider
print(hit)
if hit.has_method("on_hit"):
print("askdjhgfv")
hit.rpc("on_hit")
func _input(event):
@ -152,7 +151,7 @@ func _ready():
rset_config("translation", MultiplayerAPI.RPC_MODE_SYNC)
# only show the debug label on local machine
if name != "1": # String(get_tree().get_network_unique_id()):
if name != String(get_tree().get_network_unique_id()):
debug.hide()
print(get_tree().get_network_unique_id())
print(name)