fix(network): prevent null multiplayer peer crashes offline/teardown and fix Nakama RPC session validation

This commit is contained in:
2026-07-10 17:36:26 +08:00
parent 2b4c9d9dcb
commit b30709de3d
84 changed files with 5291 additions and 982 deletions
+3 -3
View File
@@ -22,7 +22,7 @@ func after_action_completed():
return
player._is_processing_action = true
if player.is_multiplayer_authority():
if player.can_rpc() and multiplayer.has_multiplayer_peer():
player.update_finish_availability()
# Clear the highlights after placing the tiles. (Quickfix for Clientside)
@@ -30,12 +30,12 @@ func after_action_completed():
# Only update UI if this is the LOCAL HUMAN PLAYER
# Guard against stale callbacks after peer teardown (host quitting solo match)
if not multiplayer.has_multiplayer_peer():
if not multiplayer or not multiplayer.has_multiplayer_peer():
player._is_processing_action = false
return
if multiplayer.get_unique_id() == player.get_multiplayer_authority():
# Sync playerboard (Bots DO need to sync their board logic, just not update local UI)
if player.is_multiplayer_authority() and player.has_method("can_rpc") and player.can_rpc():
if player.can_rpc() and multiplayer.has_multiplayer_peer():
var main = player.get_tree().get_root().get_node_or_null("Main")
if main:
main.rpc("sync_playerboard", player.name.to_int(), player.playerboard)