mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 23:33:12 +09:00
Merge pull request #996 from bbassie/feature/instance-udp
Add UDP communication support for instances
This commit is contained in:
19 files changed
+708
-25
No files matched your search
@@ -482,6 +482,8 @@ export interface InstanceConfigFields {
|
||||
"factorio.host_assigned_game_port": number | null;
|
||||
"factorio.rcon_port": number | null;
|
||||
"factorio.rcon_password": string | null;
|
||||
"factorio.enable_lua_udp": boolean;
|
||||
"factorio.lua_udp_port": number | null;
|
||||
"factorio.player_online_autosave_slots": number;
|
||||
"factorio.mod_pack_id": number | null;
|
||||
"factorio.enable_save_patching": boolean;
|
||||
@@ -606,6 +608,21 @@ export class InstanceConfig extends classes.Config<InstanceConfigFields> {
|
||||
type: "string",
|
||||
optional: true,
|
||||
},
|
||||
"factorio.enable_lua_udp": {
|
||||
description:
|
||||
"Enable UDP messaging between the Factorio server and the host. " +
|
||||
"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,
|
||||
},
|
||||
"factorio.lua_udp_port": {
|
||||
description: "UDP port for the Factorio server to receive Lua UDP messages on, uses a random port if null",
|
||||
restartRequired: true,
|
||||
type: "number",
|
||||
optional: true,
|
||||
validator: validators.optional(validators.greaterThanEqualZero),
|
||||
},
|
||||
"factorio.player_online_autosave_slots": {
|
||||
description:
|
||||
"Rename autosaves where players have been online since the previous autosave into a separate " +
|
||||
@@ -795,7 +812,12 @@ export function addPluginFieldDefinitions(
|
||||
fieldDef.dependsOn.push("factorio.enable_script_commands");
|
||||
}
|
||||
|
||||
if (scriptCommands || savePatching) {
|
||||
const luaUdp = pluginInfo.features.includes("LuaUdp");
|
||||
if (luaUdp) {
|
||||
fieldDef.dependsOn.push("factorio.enable_lua_udp");
|
||||
}
|
||||
|
||||
if (scriptCommands || savePatching || luaUdp) {
|
||||
fieldDef.validator = (enabled, config) => {
|
||||
if (!enabled) {
|
||||
return;
|
||||
@@ -806,6 +828,9 @@ export function addPluginFieldDefinitions(
|
||||
if (scriptCommands && !config.get("factorio.enable_script_commands")) {
|
||||
throw new Error(`Plugin ${pluginInfo.name} requires script commands`);
|
||||
}
|
||||
if (luaUdp && !config.get("factorio.enable_lua_udp")) {
|
||||
throw new Error(`Plugin ${pluginInfo.name} requires Lua UDP`);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ export const PluginFeatureFlags = [
|
||||
"SavePatching",
|
||||
/** The plugin requires access to script commands over rcon */
|
||||
"ScriptCommands",
|
||||
/** The plugin requires UDP messaging with the Factorio server */
|
||||
"LuaUdp",
|
||||
] as const;
|
||||
|
||||
/** Used to define the plugin export in plugins */
|
||||
|
||||
Reference in new issue
Block a user