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.
This commit is contained in:
Danielv123 committed 2026-10-29 20:54:11 +01:00
1 parent 3ae486143d
commit a5bd43637e
23 files changed
+391 -121

No files matched your search

+8 -2
View File
@@ -300,7 +300,7 @@ describe("lobby plugin", function () {
it("should build server browser listings", async function () {
controller.config.set("lobby.server_browser_listing", true);
controller.config.set("lobby.public_address", "203.0.113.5:40000");
controller.config.set("controller.player_proxy_public_address", "203.0.113.5:40000");
controller.instances.getMutable(4).config.set("lobby.server_browser_listing", true);
proxy.serverVersions.set(1, v2_1_19);
proxy.serverVersions.set(2, v2_0_72);
@@ -353,11 +353,17 @@ describe("lobby plugin", function () {
it("should configure the module and send the server list on start", async function () {
await instance.hooks.start.invoke();
const commands = instance.server.rconCommands;
assert.equal(commands[0], "/sc lobby.configure(true, 7357)");
assert.equal(commands[0], "/sc lobby.configure(true, 7357, false)");
assert(commands[1].startsWith("/sc lobby.set_servers(\""), commands[1]);
assert(commands[1].includes("Instance \\\\\\\"3\\\\\\\""), commands[1]);
});
it("should enable the web login button when player_auth is loaded", async function () {
instance.loadedPlugins.add({ name: "player_auth" });
await instance.hooks.start.invoke();
assert.equal(instance.server.rconCommands[0], "/sc lobby.configure(true, 7357, true)");
});
it("should move players once their transfer is ready", async function () {
instance.server.emit("ipc-lobby:connect", { player: "Player", instance_id: 3 });
await lib.wait(10);