summaryrefslogtreecommitdiff
path: root/Network
diff options
context:
space:
mode:
Diffstat (limited to 'Network')
-rw-r--r--Network/Network.gd13
1 files changed, 7 insertions, 6 deletions
diff --git a/Network/Network.gd b/Network/Network.gd
index ff076a4..1222b92 100644
--- a/Network/Network.gd
+++ b/Network/Network.gd
@@ -40,10 +40,10 @@ func _ready():
@rpc("any_peer") func register_player(player_name):
- var id = get_tree().get_remote_sender_id()
+ var id = multiplayer.get_remote_sender_id()
self.players[id] = {
name = player_name,
- ip = self.peer.get_peer_address(id),
+ ip = self.peer.get_peer(id).get_remote_address(),
}
emit_signal("player_list_changed")
@@ -73,7 +73,7 @@ func leave_game():
@rpc("any_peer") func _leave_game():
- var id = get_tree().get_remote_sender_id()
+ var id = multiplayer.get_remote_sender_id()
self.peer.disconnect_peer(id)
@@ -86,15 +86,16 @@ func _on_Global_game_started():
var idx = 1
for id in self.players:
self.players[id].idx = idx
- rpc_id(id, "_preconfigure_game", idx)
+ rpc_id(id, "_preconfigure_game", idx, Global.Level_Map)
idx += 1
# start game for everyone
rpc("_start_game")
-@rpc("any_peer") func _preconfigure_game(idx):
+@rpc("any_peer") func _preconfigure_game(idx, level_map):
self.player.idx = idx
+ Global.Level_Map = level_map
@rpc("any_peer", "call_local") func _start_game():
@@ -132,7 +133,7 @@ func _connection_succeeded():
func _connection_failed():
- get_tree().set_multiplayer_peer(null) # remove peer
+ multiplayer.multiplayer_peer = null # remove peer
emit_signal("connection_failed")