feat: Implement cycle timer toggle, refactor continuous input, and improve movement synchronization.

This commit is contained in:
2026-01-07 05:41:38 +08:00
parent 251b677a2e
commit 6aede0a382
11 changed files with 210 additions and 58 deletions
+26
View File
@@ -30,6 +30,10 @@ var match_duration: int = 180 # Default 3 minutes
# Randomize spawn locations (configurable in lobby by host)
var randomize_spawn: bool = true # Default enabled
# Timer setting
var enable_cycle_timer: bool = true # Default enabled
signal enable_cycle_timer_changed(enabled: bool)
# Character and area selection
var available_characters: Array[String] = ["Bob", "Gatot", "Masbro", "Oldpop"]
var available_areas: Array[String] = ["Desert", "Forest", "City", "Factory"]
@@ -180,6 +184,25 @@ func sync_randomize_spawn(enabled: bool) -> void:
func get_randomize_spawn() -> bool:
return randomize_spawn
# =============================================================================
# Timer Setting
# =============================================================================
func set_enable_cycle_timer(enabled: bool) -> void:
"""Host sets enable cycle timer. Syncs to all clients."""
enable_cycle_timer = enabled
if is_host:
rpc("sync_enable_cycle_timer", enabled)
@rpc("authority", "call_local", "reliable")
func sync_enable_cycle_timer(enabled: bool) -> void:
"""Sync enable cycle timer from host to clients."""
enable_cycle_timer = enabled
emit_signal("enable_cycle_timer_changed", enabled)
func get_enable_cycle_timer() -> bool:
return enable_cycle_timer
# =============================================================================
# Character Selection
# =============================================================================
@@ -272,6 +295,8 @@ func start_game() -> void:
# Sync match duration to all clients before starting
rpc("sync_match_duration", match_duration)
# Sync timer setting
rpc("sync_enable_cycle_timer", enable_cycle_timer)
# Notify all clients to start
rpc("_on_game_starting")
@@ -394,3 +419,4 @@ func reset() -> void:
match_duration = 180 # Reset to default 3 minutes
selected_area = "Desert"
local_character_index = 0
enable_cycle_timer = true