Two-tier inactivity: mutual idle blocks force-concede at 10 min
Tier 1 (5 min, unchanged): - Active player: game.inactive_warning — "you may be forfeited" - Waiting player: game.opponent_inactive — "Accept Forfeit / Wait" Tier 2 (10 min — mutual idle): - If the game is still stalled after 10 min the waiting player also hasn't claimed forfeit, so both are treated as mutually idle - Sends game.both_idle_warning to BOTH players - Client closes any open tier-1 dialogs and shows "Wait" only — no concede or force-concede available - Prevents the tactic of both players going idle to pressure the other into conceding Monitor service now prunes notified sets on each poll so sessions that become active again can be re-notified if they stall again. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -225,6 +225,7 @@ func _ready() -> void:
|
||||
Game.session_abandoned.connect(_on_session_abandoned)
|
||||
Game.opponent_inactive.connect(_on_opponent_inactive)
|
||||
Game.inactive_warning.connect(_on_inactive_warning)
|
||||
Game.both_idle_warning.connect(_on_both_idle_warning)
|
||||
|
||||
if Game.is_spectating:
|
||||
_is_spectating = true
|
||||
@@ -253,6 +254,8 @@ func _exit_tree() -> void:
|
||||
Game.opponent_inactive.disconnect(_on_opponent_inactive)
|
||||
if Game.inactive_warning.is_connected(_on_inactive_warning):
|
||||
Game.inactive_warning.disconnect(_on_inactive_warning)
|
||||
if Game.both_idle_warning.is_connected(_on_both_idle_warning):
|
||||
Game.both_idle_warning.disconnect(_on_both_idle_warning)
|
||||
# Remove chat overlay added to the viewport root.
|
||||
var root := get_tree().get_root()
|
||||
for child in root.get_children():
|
||||
@@ -2814,6 +2817,26 @@ func _on_inactive_warning(_sid: String) -> void:
|
||||
dialog.confirmed.connect(func() -> void: dialog.queue_free())
|
||||
dialog.popup_centered()
|
||||
|
||||
|
||||
## Pushed when both players have been idle for 10 minutes.
|
||||
## Closes any open inactive dialog and shows a Wait-only prompt to both players.
|
||||
func _on_both_idle_warning(_sid: String) -> void:
|
||||
# Close any lingering inactive dialogs from tier-1.
|
||||
for child in get_children():
|
||||
if child is ConfirmationDialog or child is AcceptDialog:
|
||||
child.queue_free()
|
||||
|
||||
var dialog := AcceptDialog.new()
|
||||
dialog.title = "Both Players Idle"
|
||||
dialog.dialog_text = (
|
||||
"Both players have been idle for 10 minutes.\n"
|
||||
+ "Please return to continue the game."
|
||||
)
|
||||
dialog.ok_button_text = "Wait"
|
||||
add_child(dialog)
|
||||
dialog.confirmed.connect(func() -> void: dialog.queue_free())
|
||||
dialog.popup_centered()
|
||||
|
||||
# ── State → scene ─────────────────────────────────────────────────────────────
|
||||
|
||||
func _on_state_updated(state: Dictionary) -> void:
|
||||
|
||||
Reference in New Issue
Block a user