Lower the Lua UDP floor to Factorio 2.1.10

Danielv123 pointed out the recv_udp crash was fixed in 2.1.10, not
2.1.12: recv_udp used an input action for synchronisation which the
headless server could not send without a player index.  Verified on
downloaded headless builds, 2.1.9 crashes and 2.1.10 works.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Fable 5.1 committed 2026-10-15 16:38:34 +00:00
1 parent 1f37905be0
commit 8bfc42c44c
8 files changed
+14 -14

No files matched your search

+1 -1
View File
@@ -610,7 +610,7 @@ Defaults to true.
Enable UDP messaging between the host and the Factorio server by passing `--enable-lua-udp` to Factorio.
This lets plugins send UDP packets to the server and receive data sent with `clusterio_api.send_udp` in-game.
Requires Factorio 2.1.12 or later, earlier versions crash when a packet is received while the server is paused.
Requires Factorio 2.1.10 or later, earlier versions crash when a packet is received on a headless server.
Defaults to false.
+1 -1
View File
@@ -255,7 +255,7 @@ Parameters:
Send data to Clusterio over the given channel using UDP instead of stdout.
Clusterio plugins receive it as `udp-channel_name` events, see the [Communicating over UDP section](writing-plugins.md#communicating-over-udp) in the Writing Plugins document.
Requires `factorio.enable_lua_udp` to be enabled on the instance and Factorio 2.1.12 or later, otherwise the data is silently dropped.
Requires `factorio.enable_lua_udp` to be enabled on the instance and Factorio 2.1.10 or later, otherwise the data is silently dropped.
The port to send to is passed to the module with a script command on startup, so `factorio.enable_script_commands` must be enabled as well.
**Note**: Delivery is not guaranteed and payloads should be kept well below 32 kB.
+1 -1
View File
@@ -485,7 +485,7 @@ For RCON, commands longer than 50 characters may end up being executed after sho
### Communicating over UDP
Instances can optionally exchange UDP packets with the Factorio server for low latency fire-and-forget communication, using the `--enable-lua-udp` option of Factorio.
This needs Factorio 2.1.12 or later, earlier versions crash when a packet is received while the server is paused.
This needs Factorio 2.1.10 or later, earlier versions crash when a packet is received on a headless server.
This is disabled by default and enabled by setting `factorio.enable_lua_udp` on the instance.
Sending data out of Factorio also needs `factorio.enable_script_commands`, as the port to send to is passed to the module with a script command on startup.
Plugins requiring it should declare the `LuaUdp` feature.
+3 -3
View File
@@ -865,10 +865,10 @@ export class FactorioServer extends events.EventEmitter<FactorioServerEvents> {
this._udpSocket = socket;
}
// Factorio before 2.1.12 crashes when a packet is received while paused
// Factorio before 2.1.10 crashes when a packet is received on a headless server
_checkLuaUdpVersion() {
if (this.enableLuaUdp && lib.integerFullVersion(this._version!) < lib.integerFullVersion("2.1.12")) {
throw new Error("Lua UDP requires Factorio 2.1.12 or later");
if (this.enableLuaUdp && lib.integerFullVersion(this._version!) < lib.integerFullVersion("2.1.10")) {
throw new Error("Lua UDP requires Factorio 2.1.10 or later");
}
}
+1 -1
View File
@@ -611,7 +611,7 @@ export class InstanceConfig extends classes.Config<InstanceConfigFields> {
"factorio.enable_lua_udp": {
description:
"Enable UDP messaging between the Factorio server and the host. " +
"Required by plugins using UDP. Requires Factorio 2.1.12 or later.",
"Required by plugins using UDP. Requires Factorio 2.1.10 or later.",
restartRequired: true, // Because of the cli option "--enable-lua-udp"
type: "boolean",
initialValue: false,
+3 -3
View File
@@ -365,12 +365,12 @@ describe("host/server", function() {
return { lines, restore: () => { server._logger = logger; } };
}
it("should refuse to start on Factorio before 2.1.12", async function() {
it("should refuse to start on Factorio before 2.1.10", async function() {
const version = server._version;
server._version = "2.1.11";
server._version = "2.1.9";
server.enableLuaUdp = true;
try {
const error = new Error("Lua UDP requires Factorio 2.1.12 or later");
const error = new Error("Lua UDP requires Factorio 2.1.10 or later");
await assert.rejects(server.start("save.zip"), error);
await assert.rejects(server.startScenario("test"), error);
assert.equal(server._state, "init");
+2 -2
View File
@@ -21,9 +21,9 @@ const requireApi = [
"or package.loaded['__level__/modules/clusterio/api.lua']", // 2.0.0
].join(" ");
// Lua UDP needs Factorio 2.1.12, see docs/configuration.md
// Lua UDP needs Factorio 2.1.10, see docs/configuration.md
function hasLuaUdp() {
return lib.integerFullVersion(getFactorioVersion()) >= lib.integerFullVersion("2.1.12");
return lib.integerFullVersion(getFactorioVersion()) >= lib.integerFullVersion("2.1.10");
}
function getUser(name) {
+2 -2
View File
@@ -125,8 +125,8 @@ describe("Integration of host/src/server", function() {
let mapPath = server.writePath("saves", "test.zip");
await assert.doesNotReject(fs.access(mapPath), "save is missing");
// Lua UDP needs Factorio 2.1.12, see docs/configuration.md
server.enableLuaUdp = lib.integerFullVersion(server.version) >= lib.integerFullVersion("2.1.12");
// Lua UDP needs Factorio 2.1.10, see docs/configuration.md
server.enableLuaUdp = lib.integerFullVersion(server.version) >= lib.integerFullVersion("2.1.10");
await server.start("test.zip");
});
});