mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
fix(multiplayer): gate allocated matches on full roster
This commit is contained in:
@@ -83,6 +83,10 @@ func _ready() -> void:
|
||||
get_tree().quit(1)
|
||||
return
|
||||
_control = ServerControlScript.new()
|
||||
# An allocated process owns exactly the roster issued for this match.
|
||||
# Never let the general-purpose direct-server default (one player) start
|
||||
# an allocated match with only a partial assignment admitted.
|
||||
config.values["min-players"] = required_min_players(true, roster_tokens.size(), int(config.get_value("min-players")))
|
||||
_control.name = "ServerControl"
|
||||
_control.drain_requested.connect(_on_drain_requested)
|
||||
get_tree().root.add_child.call_deferred(_control)
|
||||
@@ -180,3 +184,9 @@ func _on_drain_requested() -> void:
|
||||
_drain_requested = true
|
||||
MatchNet.admissions_open = false
|
||||
ServerLog.info("server_draining", {"reason": "control_request"})
|
||||
|
||||
|
||||
static func required_min_players(allocated: bool, roster_size: int, configured: int) -> int:
|
||||
if allocated and roster_size > 0:
|
||||
return roster_size
|
||||
return configured
|
||||
|
||||
Reference in New Issue
Block a user