feat: update some visual and fixing the bug
This commit is contained in:
+4
-4
@@ -720,6 +720,10 @@ func _auto_start_from_lobby():
|
||||
|
||||
func _start_game():
|
||||
if multiplayer.is_server():
|
||||
# NOW assign spawn positions for EVERYONE (Host, Client, Bots)
|
||||
# We do this BEFORE the stabilization delay so players are moved away from (0,0) immediately.
|
||||
_assign_random_spawn_positions()
|
||||
|
||||
# Wait for Nakama websocket to actually be open, up to 5 seconds
|
||||
# SKIP THIS FOR LAN MODE
|
||||
if not LobbyManager.is_lan_mode:
|
||||
@@ -735,10 +739,6 @@ func _start_game():
|
||||
# before the countdown starts.
|
||||
await get_tree().create_timer(1.5).timeout
|
||||
|
||||
# NOW assign spawn positions for EVERYONE (Host, Client, Bots)
|
||||
# This safely sends RPCs over the completed socket connection
|
||||
_assign_random_spawn_positions()
|
||||
|
||||
# PRE-GAME COUNTDOWN (3s)
|
||||
# Spawn static obstacles before countdown starts (Stop n Go only)
|
||||
if obstacle_manager and LobbyManager.game_mode == "Stop n Go":
|
||||
|
||||
@@ -1096,6 +1096,9 @@ func _process(delta):
|
||||
if LobbyManager.get_randomize_spawn() and spawn_point_selected and not visible:
|
||||
visible = true
|
||||
|
||||
if not multiplayer.has_multiplayer_peer():
|
||||
return
|
||||
|
||||
if is_multiplayer_authority():
|
||||
# Visual debugging - show display name with connection status
|
||||
$Name.text = display_name if not display_name.is_empty() else str(name)
|
||||
@@ -1184,6 +1187,9 @@ var last_sent_position: Vector3
|
||||
|
||||
func _physics_process(delta):
|
||||
# Sync position periodically (Heartbeat / Smoothing)
|
||||
if not multiplayer.has_multiplayer_peer():
|
||||
return
|
||||
|
||||
if is_multiplayer_authority():
|
||||
# OPTIMIZATION: Only send smoothing updates if we ARE NOT currently mid-tween
|
||||
# The start/end of paths are already synced via start_movement_along_path.
|
||||
|
||||
Reference in New Issue
Block a user