summaryrefslogtreecommitdiff
path: root/Network
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2023-12-25 20:43:51 +0100
committerDaniel Weipert <git@mail.dweipert.de>2023-12-25 20:43:51 +0100
commit2a5d745c68f11131fb1b27ec42a30ecd6dc5da1d (patch)
tree0c6377bbe992236e397f590f4418fe1337593c69 /Network
parent809024f80576c191fd1154e4d7950fbedb05baff (diff)
fix networkingv2.1.2
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")