Files
factorio-clusterio/plugins/lobby/index.ts
T
Danielv123 a5bd43637e Enable the player proxy by default and give lobbies an empty save
The player proxy now listens on 34197 by default. New hosts default to
the port range 34200-34299 so they don't hand that port to instances,
and the controller logs an error and runs without the proxy if the port
is taken, as hosts with the old range only skip it when the controller
already holds it.

Lobby instances start the save lobby.zip, created on first start as a
one tile map with no autoplace and with the freeplay scenario replaced by
an empty one. This uses the new chooseSave instance hook, which lets
plugins pick or create the save to start, and setSaveScenario from
@clusterio/host, which sets the scenario the save patcher keeps loading.
Map gen settings can't use a width and height of 0 for this, as Factorio
takes 0 to mean an unlimited map.

The address players reach the proxy on moves from lobby.public_address
to controller.player_proxy_public_address. When it's set the player_auth
login page lists it once for the instances behind the proxy instead of
their own addresses, and lobbies with player_auth loaded get a button
that opens the web interface login dialog.
2026-10-29 20:54:11 +01:00

101 lines
3.0 KiB
TypeScript

import type * as lib from "@clusterio/lib";
import * as messages from "./messages.js";
declare module "@clusterio/lib" {
export interface ControllerConfigFields {
"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.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,
],
};