feat: update
This commit is contained in:
@@ -725,16 +725,40 @@ func set_game_mode(mode: String) -> void:
|
||||
rpc("sync_game_mode", mode)
|
||||
|
||||
_update_available_areas(mode)
|
||||
|
||||
# Only force switch the area if the selected area is NOT valid for this mode
|
||||
if selected_area not in available_areas:
|
||||
set_area(available_areas[0])
|
||||
else:
|
||||
# Important: even if the area is technically in the list, if they just clicked Free Mode
|
||||
# we should default them to Free Mode Area if they were on Stop n Go Area before.
|
||||
if mode == "Free Mode" and "Free Mode Area" in available_areas:
|
||||
set_area("Free Mode Area")
|
||||
elif mode == "Stop n Go" and "Stop n Go Area" in available_areas:
|
||||
set_area("Stop n Go Area")
|
||||
elif mode == "Tekton Doors" and "Tekton Doors Area" in available_areas:
|
||||
set_area("Tekton Doors Area")
|
||||
elif mode == "Gauntlet" and "Candy Pump Arena" in available_areas:
|
||||
set_area("Candy Pump Arena")
|
||||
|
||||
@rpc("authority", "call_local", "reliable")
|
||||
func sync_game_mode(mode: String) -> void:
|
||||
"""Sync game mode selection from host to clients."""
|
||||
game_mode = mode
|
||||
_update_available_areas(mode)
|
||||
if selected_area not in available_areas:
|
||||
|
||||
# Try to smart-match the client's local area to the mode as well so their UI matches
|
||||
if mode == "Free Mode" and "Free Mode Area" in available_areas:
|
||||
selected_area = "Free Mode Area"
|
||||
elif mode == "Stop n Go" and "Stop n Go Area" in available_areas:
|
||||
selected_area = "Stop n Go Area"
|
||||
elif mode == "Tekton Doors" and "Tekton Doors Area" in available_areas:
|
||||
selected_area = "Tekton Doors Area"
|
||||
elif mode == "Gauntlet" and "Candy Pump Arena" in available_areas:
|
||||
selected_area = "Candy Pump Arena"
|
||||
elif selected_area not in available_areas:
|
||||
selected_area = available_areas[0]
|
||||
|
||||
emit_signal("game_mode_changed", mode)
|
||||
|
||||
func start_game(force: bool = false) -> void:
|
||||
|
||||
Reference in New Issue
Block a user