fix alot of shit for webrtc to work
This commit is contained in:
@@ -379,11 +379,10 @@ func _process_pickup_on_server(player: Node):
|
||||
var game_world = get_tree().get_first_node_in_group("game_world")
|
||||
if game_world and game_world.has_method("_sync_loot_remove"):
|
||||
print("Loot: Server syncing removal of loot id=", loot_id, " at ", global_position)
|
||||
game_world._sync_loot_remove.rpc(loot_id, global_position)
|
||||
game_world._rpc_to_ready_peers("_sync_loot_remove", [loot_id, global_position])
|
||||
else:
|
||||
# Fallback: try direct RPC (may fail if node path doesn't match)
|
||||
print("Loot: Server syncing removal via direct RPC (fallback)")
|
||||
rpc("_sync_remove")
|
||||
# If GameWorld isn't ready, skip removal sync to avoid node path RPC errors
|
||||
print("Loot: GameWorld not ready, skipping removal sync for loot id=", loot_id)
|
||||
|
||||
match loot_type:
|
||||
LootType.COIN:
|
||||
@@ -395,9 +394,11 @@ func _process_pickup_on_server(player: Node):
|
||||
# Show floating text with item graphic and text
|
||||
var coin_texture = load("res://assets/gfx/pickups/gold_coin.png")
|
||||
_show_floating_text(player, "+" + str(coin_value) + " COIN", Color(1.0, 0.84, 0.0), 0.5, 0.5, coin_texture, 6, 1, 0)
|
||||
# Sync floating text to client
|
||||
# Sync floating text to client via GameWorld to avoid loot node path RPCs
|
||||
if multiplayer.has_multiplayer_peer() and player.get_multiplayer_authority() != 1:
|
||||
_sync_show_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+" + str(coin_value) + " COIN", Color(1.0, 0.84, 0.0), coin_value, 0, player.get_multiplayer_authority())
|
||||
var game_world = get_tree().get_first_node_in_group("game_world")
|
||||
if game_world and game_world.has_method("_sync_loot_floating_text"):
|
||||
game_world._sync_loot_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+" + str(coin_value) + " COIN", Color(1.0, 0.84, 0.0), 0, player.get_multiplayer_authority())
|
||||
|
||||
self.visible = false
|
||||
|
||||
@@ -416,9 +417,11 @@ func _process_pickup_on_server(player: Node):
|
||||
# Show floating text with item graphic and heal amount
|
||||
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
|
||||
_show_floating_text(player, "+" + str(int(actual_heal)) + " HP", Color.GREEN, 0.5, 0.5, items_texture, 20, 14, (8 * 20) + 10)
|
||||
# Sync floating text to client
|
||||
# Sync floating text to client via GameWorld to avoid loot node path RPCs
|
||||
if multiplayer.has_multiplayer_peer() and player.get_multiplayer_authority() != 1:
|
||||
_sync_show_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+" + str(int(actual_heal)) + " HP", Color.GREEN, int(actual_heal), (8 * 20) + 10, player.get_multiplayer_authority())
|
||||
var game_world = get_tree().get_first_node_in_group("game_world")
|
||||
if game_world and game_world.has_method("_sync_loot_floating_text"):
|
||||
game_world._sync_loot_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+" + str(int(actual_heal)) + " HP", Color.GREEN, (8 * 20) + 10, player.get_multiplayer_authority())
|
||||
|
||||
self.visible = false
|
||||
|
||||
@@ -437,9 +440,11 @@ func _process_pickup_on_server(player: Node):
|
||||
# Show floating text with item graphic and heal amount
|
||||
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
|
||||
_show_floating_text(player, "+" + str(int(actual_heal)) + " HP", Color.GREEN, 0.5, 0.5, items_texture, 20, 14, (8 * 20) + 11)
|
||||
# Sync floating text to client
|
||||
# Sync floating text to client via GameWorld to avoid loot node path RPCs
|
||||
if multiplayer.has_multiplayer_peer() and player.get_multiplayer_authority() != 1:
|
||||
_sync_show_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+" + str(int(actual_heal)) + " HP", Color.GREEN, int(actual_heal), (8 * 20) + 11, player.get_multiplayer_authority())
|
||||
var game_world = get_tree().get_first_node_in_group("game_world")
|
||||
if game_world and game_world.has_method("_sync_loot_floating_text"):
|
||||
game_world._sync_loot_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+" + str(int(actual_heal)) + " HP", Color.GREEN, (8 * 20) + 11, player.get_multiplayer_authority())
|
||||
|
||||
self.visible = false
|
||||
|
||||
@@ -458,9 +463,11 @@ func _process_pickup_on_server(player: Node):
|
||||
# Show floating text with item graphic and heal amount
|
||||
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
|
||||
_show_floating_text(player, "+" + str(int(actual_heal)) + " HP", Color.GREEN, 0.5, 0.5, items_texture, 20, 14, (8 * 20) + 12)
|
||||
# Sync floating text to client
|
||||
# Sync floating text to client via GameWorld to avoid loot node path RPCs
|
||||
if multiplayer.has_multiplayer_peer() and player.get_multiplayer_authority() != 1:
|
||||
_sync_show_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+" + str(int(actual_heal)) + " HP", Color.GREEN, int(actual_heal), (8 * 20) + 12, player.get_multiplayer_authority())
|
||||
var game_world = get_tree().get_first_node_in_group("game_world")
|
||||
if game_world and game_world.has_method("_sync_loot_floating_text"):
|
||||
game_world._sync_loot_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+" + str(int(actual_heal)) + " HP", Color.GREEN, (8 * 20) + 12, player.get_multiplayer_authority())
|
||||
|
||||
self.visible = false
|
||||
|
||||
@@ -477,9 +484,11 @@ func _process_pickup_on_server(player: Node):
|
||||
# Show floating text with item graphic and text
|
||||
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
|
||||
_show_floating_text(player, "+1 KEY", Color.YELLOW, 0.5, 0.5, items_texture, 20, 14, (13 * 20) + 10)
|
||||
# Sync floating text to client
|
||||
# Sync floating text to client via GameWorld to avoid loot node path RPCs
|
||||
if multiplayer.has_multiplayer_peer() and player.get_multiplayer_authority() != 1:
|
||||
_sync_show_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+1 KEY", Color.YELLOW, 0, (13 * 20) + 10, player.get_multiplayer_authority())
|
||||
var game_world = get_tree().get_first_node_in_group("game_world")
|
||||
if game_world and game_world.has_method("_sync_loot_floating_text"):
|
||||
game_world._sync_loot_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, "+1 KEY", Color.YELLOW, (13 * 20) + 10, player.get_multiplayer_authority())
|
||||
|
||||
self.visible = false
|
||||
|
||||
@@ -522,9 +531,11 @@ func _process_pickup_on_server(player: Node):
|
||||
|
||||
_show_floating_text(player, display_text, text_color, 0.5, 0.5, items_texture, item.spriteFrames.x, item.spriteFrames.y, item.spriteFrame)
|
||||
|
||||
# Sync floating text to client
|
||||
# Sync floating text to client via GameWorld to avoid loot node path RPCs
|
||||
if multiplayer.has_multiplayer_peer() and player.get_multiplayer_authority() != 1:
|
||||
_sync_show_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, display_text, text_color, 0, item.spriteFrame, player.get_multiplayer_authority())
|
||||
var game_world = get_tree().get_first_node_in_group("game_world")
|
||||
if game_world and game_world.has_method("_sync_loot_floating_text"):
|
||||
game_world._sync_loot_floating_text.rpc_id(player.get_multiplayer_authority(), loot_type, display_text, text_color, item.spriteFrame, player.get_multiplayer_authority())
|
||||
|
||||
self.visible = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user