Merge branch 'main' of ssh://git.gieszer.link:2222/unfa/liblast

remotes/1705377932733043820/tmp_refs/heads/unbroken
unfa 2021-09-11 21:32:05 +02:00
commit 413b0f7a11
1 changed files with 2 additions and 8 deletions

View File

@ -211,7 +211,7 @@ func update_hud():
else:
hud.get_node("ScoreRank").text += str(rank) + "\nGAP: " + str(-lead)
@rpc func player_list_update(info, pid = get_tree().get_rpc_sender_id()):
@rpc(any) func player_list_update(info, pid = get_tree().get_rpc_sender_id()):
var new_info = PlayerInfo.new()
new_info.deserialize(info)
print("Recieved player info: ", info)
@ -231,13 +231,7 @@ func update_hud():
# if i != pid:
chat.rpc_id(i, &'chat_notification', "Player [b]" + new_info.name + "[/b] joined")
if get_tree().multiplayer.get_network_unique_id() == 1: # if we're server, we should store this
pid = get_tree().get_rpc_sender_id() #disallow clients setting player_info for other players than themselves
player_list.set(pid, new_info)
rpc(&'player_list_update', info, pid) # broadcast the new entry to clients
else: #we are client, so we're getting data relayed from the server
player_list.set(pid, new_info) # server relays other PID's data
player_list.set(pid, new_info) # server relays other PID's data
# update locla HUD
update_hud()