mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 23:03:42 +00:00
feat: add allocated server compatibility config
This commit is contained in:
@@ -64,6 +64,15 @@ static func specs() -> Array[Spec]:
|
||||
out.append(Spec.new("fill-bots", Kind.BOOL, false, "match", "Give a disconnected player's ship to a bot instead of leaving it inert"))
|
||||
out.append(Spec.new("slot-reservation-seconds", Kind.FLOAT, 30.0, "match", "How long a departed player's slot is held for their return"))
|
||||
out.append(Spec.new("config", Kind.STRING, "", "general", "Path to a config file supplying defaults for any flag above"))
|
||||
# Allocated-mode fields are opt-in. Empty defaults intentionally preserve
|
||||
# the direct-IP/community-server path and its existing CLI/config surface.
|
||||
out.append(Spec.new("allocated-mode", Kind.BOOL, false, "allocation", "Enable match-scoped allocation admission and lifecycle"))
|
||||
out.append(Spec.new("match-id", Kind.STRING, "", "allocation", "Opaque allocated match identifier"))
|
||||
out.append(Spec.new("server-id", Kind.STRING, "", "allocation", "Opaque allocated server identifier"))
|
||||
out.append(Spec.new("playlist-version", Kind.STRING, "", "allocation", "Matchmaking playlist contract version"))
|
||||
out.append(Spec.new("server-image-digest", Kind.STRING, "", "allocation", "Expected immutable server image digest (sha256:...)"))
|
||||
out.append(Spec.new("transport", Kind.STRING, "", "allocation", "Assigned transport: steam_sdr or enet"))
|
||||
out.append(Spec.new("region", Kind.STRING, "", "allocation", "Assigned region: EU or NA"))
|
||||
return out
|
||||
|
||||
|
||||
@@ -249,6 +258,19 @@ func _validate() -> void:
|
||||
var rotation := String(values["arena-rotation"])
|
||||
if not rotation in ["sequential", "random"]:
|
||||
errors.append("--arena-rotation must be sequential or random, got '%s'" % rotation)
|
||||
if bool(values["allocated-mode"]):
|
||||
for key in ["match-id", "server-id", "playlist-version", "server-image-digest", "transport", "region"]:
|
||||
if String(values[key]).is_empty():
|
||||
errors.append("--allocated-mode requires --%s" % key)
|
||||
var digest := String(values["server-image-digest"])
|
||||
if not digest.begins_with("sha256:") or digest.length() != 71:
|
||||
errors.append("--server-image-digest must be sha256:<64 hex characters>")
|
||||
var transport := String(values["transport"])
|
||||
if not transport in ["steam_sdr", "enet"]:
|
||||
errors.append("--transport must be steam_sdr or enet, got '%s'" % transport)
|
||||
var region := String(values["region"])
|
||||
if not region in ["EU", "NA"]:
|
||||
errors.append("--region must be EU or NA, got '%s'" % region)
|
||||
|
||||
|
||||
static func _kind_name(kind: int) -> String:
|
||||
|
||||
Reference in New Issue
Block a user