Hopefully fix the client issue
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://b5xb0fsfpn7r3" path="res://levels/lobby-scene/lobby-terrain.blend" id="3_f73ky"]
|
[ext_resource type="PackedScene" uid="uid://b5xb0fsfpn7r3" path="res://levels/lobby-scene/lobby-terrain.blend" id="3_f73ky"]
|
||||||
[ext_resource type="PackedScene" uid="uid://csmfxg011xisf" path="res://player/Player.tscn" id="4_0aw1h"]
|
[ext_resource type="PackedScene" uid="uid://csmfxg011xisf" path="res://player/Player.tscn" id="4_0aw1h"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dgi81jdv7gs76" path="res://levels/lobby-scene/tent.blend" id="4_qjimh"]
|
[ext_resource type="PackedScene" uid="uid://dgi81jdv7gs76" path="res://levels/lobby-scene/tent.blend" id="4_qjimh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://wcsd1tb0quj3" path="res://levels/lobby-scene/campfire.tscn" id="5_qjimh"]
|
[ext_resource type="PackedScene" path="res://levels/lobby-scene/campfire.tscn" id="5_qjimh"]
|
||||||
|
|
||||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_f73ky"]
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_f73ky"]
|
||||||
|
|
||||||
|
|||||||
@@ -82,12 +82,6 @@ func setup_multiplayer_peer(is_host: bool = false) -> void:
|
|||||||
return
|
return
|
||||||
print("Created host")
|
print("Created host")
|
||||||
else:
|
else:
|
||||||
pass
|
|
||||||
|
|
||||||
multiplayer.multiplayer_peer = peer
|
|
||||||
|
|
||||||
|
|
||||||
func setup_multiplayer_peer_client() -> void:
|
|
||||||
if lobby_id == 0:
|
if lobby_id == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -96,9 +90,9 @@ func setup_multiplayer_peer_client() -> void:
|
|||||||
if err != OK:
|
if err != OK:
|
||||||
print("Failed to create client, error: %s" % err)
|
print("Failed to create client, error: %s" % err)
|
||||||
return
|
return
|
||||||
multiplayer.multiplayer_peer = peer
|
|
||||||
print("Client created, connecting to host: %s" % host_id)
|
print("Client created, connecting to host: %s" % host_id)
|
||||||
|
|
||||||
|
multiplayer.multiplayer_peer = peer
|
||||||
|
|
||||||
|
|
||||||
func create_lobby():
|
func create_lobby():
|
||||||
@@ -113,7 +107,7 @@ func _on_lobby_created(connect: int, this_lobby_id: int):
|
|||||||
print("Created lobby with id `%s`" % lobby_id)
|
print("Created lobby with id `%s`" % lobby_id)
|
||||||
|
|
||||||
Steam.setLobbyJoinable(lobby_id, true)
|
Steam.setLobbyJoinable(lobby_id, true)
|
||||||
Steam.setLobbyData(lobby_id, "name", "%'s Lobby" % steam_username)
|
Steam.setLobbyData(lobby_id, "name", steam_username + "'s Lobby")
|
||||||
Steam.setLobbyData(lobby_id, "mode", "Splunk")
|
Steam.setLobbyData(lobby_id, "mode", "Splunk")
|
||||||
|
|
||||||
Steam.allowP2PPacketRelay(true)
|
Steam.allowP2PPacketRelay(true)
|
||||||
@@ -135,7 +129,8 @@ func _on_lobby_joined(this_lobby_id: int, permissions: int, locked: bool, respon
|
|||||||
get_lobby_members()
|
get_lobby_members()
|
||||||
|
|
||||||
if not multiplayer.is_server():
|
if not multiplayer.is_server():
|
||||||
setup_multiplayer_peer_client()
|
setup_multiplayer_peer()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func get_lobby_members() -> void:
|
func get_lobby_members() -> void:
|
||||||
@@ -152,8 +147,16 @@ func get_lobby_members() -> void:
|
|||||||
print("Lobby member: %s (%s)" % [member_name, member_id])
|
print("Lobby member: %s (%s)" % [member_name, member_id])
|
||||||
|
|
||||||
|
|
||||||
func _on_lobby_data_update(success: int) -> void:
|
func _on_lobby_data_update(lobby: int, user: int, success: int) -> void:
|
||||||
pass
|
if success:
|
||||||
|
# Check if the lobby data itself was updated (not a specific member)
|
||||||
|
if lobby == user:
|
||||||
|
print("Lobby data for lobby %s has been updated." % lobby)
|
||||||
|
var lobby_name = Steam.getLobbyData(lobby, "name")
|
||||||
|
print("New lobby name: %s" % lobby_name)
|
||||||
|
else:
|
||||||
|
# A specific lobby member's data was updated
|
||||||
|
print("Data for member %s in lobby %s has been updated." % [user, lobby])
|
||||||
|
|
||||||
|
|
||||||
func _on_persona_change(steam_id_changed: int, flag: int) -> void:
|
func _on_persona_change(steam_id_changed: int, flag: int) -> void:
|
||||||
|
|||||||
Reference in New Issue
Block a user