This commit is contained in:
2025-12-04 23:14:12 +08:00
parent dce55c2fe6
commit 5000f3e269
4 changed files with 145 additions and 33 deletions
+15 -4
View File
@@ -34,6 +34,7 @@ var can_finish: bool:
# Modifier for Turn based
var has_performed_action: bool = false
var _is_processing_action: bool = false
var selected_gridmap_position = Vector2i(-1, -1)
var selected_playerboard_slot = -1
var targeted_playerboard_slot = -1
@@ -346,9 +347,13 @@ func ping_existence():
# They can check if they have this node
pass
var last_sent_position: Vector3
func _physics_process(delta):
if is_multiplayer_authority():
rpc("remote_set_position", global_position)
if global_position.distance_squared_to(last_sent_position) > 0.001:
rpc("remote_set_position", global_position)
last_sent_position = global_position
# Add continuous finish line check
if race_manager and current_position in race_manager.finish_locations and can_finish and not is_player_moving:
@@ -823,12 +828,12 @@ func auto_put_item() -> bool:
# Force ActionState : None
# -----------------------------------------------------------------
@rpc("authority", "reliable")
@rpc("any_peer", "call_local", "reliable")
func force_action_state_none():
# This is called by the server on the client to reset the UI
var main = get_tree().get_root().get_node_or_null("Main")
if main:
main.set_action_state(main.ActionState.NONE)
if main and main.ui_manager:
main.ui_manager.current_action_state = main.ui_manager.ActionState.NONE
action_manager.clear_highlights()
action_manager.clear_playerboard_highlights()
@@ -1024,6 +1029,12 @@ func sync_grid_item(x: int, y: int, z: int, item: int):
@rpc("any_peer", "call_local")
func sync_goals(new_goals: Array):
goals = new_goals.duplicate() # Make sure to duplicate the array
# Update the AllPlayerGoals UI
var main = get_tree().get_root().get_node_or_null("Main")
if main and main.has_method("_update_goals_ui_for_player"):
var player_id = get_multiplayer_authority()
main._update_goals_ui_for_player(player_id, new_goals)
@rpc("any_peer", "call_local")
func sync_second_lap_goals(new_goals: Array):