Files
Danielv123 00823262d5 Create lobbies on demand and only list servers on the player's version
When a player connects with a Factorio version and set of built in mods
no lobby runs, the lobby plugin now creates one on a connected host that
has the version installed or can download it, with a mod pack matching
the player's built in mods. This lets a cluster accept players on
several Factorio versions on the same port without any setup. It can be
turned off with lobby.auto_create.

To pick the mod pack the proxy now waits for the whole connection
confirm before routing and passes the mods listed in it to the
playerProxyRoute hook. Hosts answer the new HostFactorioVersionsRequest
with the versions they have installed.

The server list in lobbies only shows instances on the Factorio version
of the lobby, with a checkbox to also show the others greyed out.
2026-10-29 20:54:11 +01:00

110 lines
3.3 KiB
TypeScript

import type * as lib from "@clusterio/lib";
import * as messages from "./messages.js";
declare module "@clusterio/lib" {
export interface ControllerConfigFields {
"lobby.auto_create": boolean;
"lobby.server_browser_listing": boolean;
"lobby.server_browser_name": string | null;
"lobby.server_browser_description": string;
"lobby.server_browser_tags": string;
"lobby.server_browser_max_players": number;
}
export interface InstanceConfigFields {
"lobby.is_lobby": boolean;
"lobby.listed": boolean;
"lobby.server_browser_listing": boolean;
}
}
export const plugin: lib.PluginDeclaration = {
name: "lobby",
title: "Lobby",
description:
"Lobby servers players pick the instance to join from, and listing of the cluster in the Factorio " +
"server browser. Works together with the player proxy on the controller.",
controllerEntrypoint: "dist/node/controller.js",
instanceEntrypoint: "dist/node/instance.js",
controllerConfigFields: {
"lobby.auto_create": {
title: "Create Lobbies",
description:
"Create a lobby when a player connects to the player proxy with a Factorio version and built in " +
"mods no lobby runs, on a connected host that has that version installed or can download it.",
type: "boolean",
initialValue: true,
},
"lobby.server_browser_listing": {
title: "Server Browser Listing",
description:
"List the cluster as one game in the Factorio server browser for each Factorio version a lobby " +
"instance runs. Uses controller.factorio_username and controller.factorio_token.",
type: "boolean",
initialValue: false,
},
"lobby.server_browser_name": {
title: "Server Browser Name",
description: "Name of the cluster in the server browser, uses controller.name if null.",
type: "string",
optional: true,
},
"lobby.server_browser_description": {
title: "Server Browser Description",
description: "Description of the cluster in the server browser.",
type: "string",
initialValue: "",
},
"lobby.server_browser_tags": {
title: "Server Browser Tags",
description: "Comma separated tags for the server browser listings.",
type: "string",
initialValue: "clusterio",
},
"lobby.server_browser_max_players": {
title: "Server Browser Max Players",
description: "Max players shown in the server browser listings, 0 for no limit.",
type: "number",
initialValue: 0,
},
},
instanceConfigFields: {
"lobby.is_lobby": {
title: "Is Lobby",
description:
"Players connecting to the player proxy are sent to a lobby instance running their Factorio " +
"version, where they pick which instance to join.",
type: "boolean",
initialValue: false,
},
"lobby.listed": {
title: "Listed",
description: "Show this instance in the server list of lobbies.",
type: "boolean",
initialValue: true,
},
"lobby.server_browser_listing": {
title: "Server Browser Listing",
description:
"List this instance as its own game in the Factorio server browser, also while it's stopped. " +
"Requires instance.player_proxy_port to be set, players joining it while it's stopped wait in a " +
"lobby until it has started.",
type: "boolean",
initialValue: false,
},
},
features: [
"SavePatching",
"ScriptCommands",
],
messages: [
messages.ServerListRequest,
messages.TransferRequest,
messages.TransferStatusEvent,
],
};