mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-12 14:03:45 +00:00
fix(multiplayer): bound workload credential lifetime
This commit is contained in:
@@ -320,6 +320,8 @@ static var server_bot_fill_override := false
|
||||
var _max_spectators := -1
|
||||
var _last_emitted_countdown := -1
|
||||
var _in_overtime := false
|
||||
var _max_overtime_seconds := 900.0
|
||||
var _overtime_deadline_tick := -1
|
||||
var _match_over := false
|
||||
var _planned_server_shutdown := false
|
||||
var _awaiting_result_submission := false
|
||||
@@ -349,6 +351,7 @@ func _ready() -> void:
|
||||
# FULL_TIME/OVERTIME/RESULTS, so allow an override. Server-side only —
|
||||
# a client cannot shorten anyone's match.
|
||||
match_length_seconds = maxf(1.0, float(config.get_value("match-length")))
|
||||
_max_overtime_seconds = maxf(1.0, float(config.get_value("max-overtime-seconds")))
|
||||
var smoke_after := float(config.get_value("smoke-force-goal-after"))
|
||||
if smoke_after >= 0.0:
|
||||
_smoke_force_goal_tick = -2 # arm when PLAYING begins; -1 remains disabled
|
||||
@@ -685,6 +688,8 @@ func _apply_match_state(new_state: int, at_tick: int) -> void:
|
||||
# Kickoff is over: bodies move again, and the clock resumes.
|
||||
_pending_freeze_tick = -1
|
||||
_set_bodies_frozen(false)
|
||||
if new_state == MatchState.State.OVERTIME:
|
||||
_overtime_deadline_tick = at_tick + int(_max_overtime_seconds * SimConstants.TICK_HZ)
|
||||
# The clock only advances during live play (§6.2 step 9). Derived here
|
||||
# rather than tracked separately so it cannot disagree with the state.
|
||||
var was_running := _clock_running
|
||||
@@ -1055,12 +1060,12 @@ func _update_clock() -> void:
|
||||
|
||||
# --- §6.2 step 10: full time, overtime, results (task 5.5) -----------------
|
||||
|
||||
func _enter_results(winning_team: int) -> void:
|
||||
func _enter_results(winning_team: int, integrity_state := "CERTIFIED") -> void:
|
||||
_match_over = true
|
||||
_clock_running = false
|
||||
_set_bodies_frozen(true)
|
||||
match_ended.emit(winning_team, score.duplicate())
|
||||
if multiplayer.is_server() and MatchNet.submit_authoritative_result(score):
|
||||
if multiplayer.is_server() and MatchNet.submit_authoritative_result(score, integrity_state):
|
||||
_awaiting_result_submission = true
|
||||
ServerLog.info("match_ended", {"score_0": score.get(0, 0), "score_1": score.get(1, 0), "overtime": _in_overtime})
|
||||
_set_match_state(MatchState.State.RESULTS)
|
||||
@@ -1103,6 +1108,12 @@ func _update_match_state() -> void:
|
||||
else:
|
||||
_enter_results(_winning_team())
|
||||
return
|
||||
if match_state == MatchState.State.OVERTIME and _overtime_deadline_tick >= 0 and now >= _overtime_deadline_tick:
|
||||
# Golden goal remains clockless to players, but an operational bound is
|
||||
# necessary: a stalled draw must finish while its allocated credential is
|
||||
# valid. REVIEW completes lifecycle delivery without rating either side.
|
||||
_enter_results(-1, "REVIEW")
|
||||
return
|
||||
if _state_deadline_tick < 0 or now < _state_deadline_tick:
|
||||
return
|
||||
match match_state:
|
||||
|
||||
Reference in New Issue
Block a user