mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
fix(multiplayer): reconcile authoritative initial connections
This commit is contained in:
@@ -48,6 +48,7 @@ var allocated_mode := false
|
||||
var allocated_playlist := ""
|
||||
var allocated_roster_size := 0
|
||||
var allocated_arena_path := ""
|
||||
var allocated_admission_armed := true
|
||||
|
||||
var matches_completed := 0
|
||||
var _countdown_started_ms := -1
|
||||
@@ -74,6 +75,8 @@ func _process(_delta: float) -> void:
|
||||
|
||||
|
||||
func _poll_allocated_match_start(now: int) -> void:
|
||||
if not allocated_admission_armed:
|
||||
return
|
||||
if _allocated_connect_started_ms < 0:
|
||||
_allocated_connect_started_ms = now
|
||||
var connected := MatchNet.roster.size()
|
||||
@@ -95,14 +98,27 @@ func _poll_allocated_match_start(now: int) -> void:
|
||||
_poll_match_start(now)
|
||||
|
||||
|
||||
func arm_allocated_admission() -> void:
|
||||
allocated_admission_armed = true
|
||||
_allocated_connect_started_ms = -1
|
||||
|
||||
|
||||
static func allocated_initial_connect_action(playlist: String, elapsed_ms: int, connected: int, expected: int, has_team_zero: bool, has_team_one: bool) -> String:
|
||||
if elapsed_ms < 0 or connected < 0 or expected < 1:
|
||||
return ALLOCATED_CANCEL
|
||||
if connected >= expected:
|
||||
return ALLOCATED_READY
|
||||
if playlist == "ranked":
|
||||
if expected != 6:
|
||||
return ALLOCATED_CANCEL
|
||||
if connected >= expected:
|
||||
return ALLOCATED_READY
|
||||
return ALLOCATED_CANCEL if elapsed_ms >= 30000 else ALLOCATED_WAIT
|
||||
if playlist == "casual":
|
||||
if expected < 2 or expected > 6:
|
||||
return ALLOCATED_CANCEL
|
||||
if connected >= expected:
|
||||
if expected == 6:
|
||||
return ALLOCATED_READY
|
||||
return ALLOCATED_START_WITH_BOTS if has_team_zero and has_team_one else ALLOCATED_CANCEL
|
||||
if elapsed_ms < 60000:
|
||||
return ALLOCATED_WAIT
|
||||
return ALLOCATED_START_WITH_BOTS if connected >= 2 and has_team_zero and has_team_one else ALLOCATED_CANCEL
|
||||
|
||||
Reference in New Issue
Block a user