fix(multiplayer): gate allocated matches on full roster

This commit is contained in:
Josh Creek
2026-09-01 16:03:43 +01:00
parent 498f219ab9
commit bdb3c8f4a7
3 changed files with 19 additions and 0 deletions
+10
View File
@@ -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