Add feature flags to first party plugins

This commit is contained in:
Cooldude2606 committed 2026-03-24 17:44:30 +00:00
1 parent 790c2834f2
commit 622d372776
12 files changed
+27 -34

No files matched your search

+4
View File
@@ -9,6 +9,10 @@ export const plugin: lib.PluginDeclaration = {
instanceEntrypoint: "dist/node/instance",
ctlEntrypoint: "dist/node/control",
features: [
"ScriptCommands",
],
messages: [
ChatEvent,
],
-4
View File
@@ -16,10 +16,6 @@ export class InstancePlugin extends BaseInstancePlugin {
messageQueue: string[] = [];
async init() {
if (!this.instance.config.get("factorio.enable_script_commands")) {
throw new Error("global_chat plugin requires script commands.");
}
this.instance.handle(ChatEvent, this.handleChatEvent.bind(this));
}
+5
View File
@@ -45,6 +45,11 @@ export const plugin: lib.PluginDeclaration = {
},
},
features: [
"SavePatching",
"ScriptCommands",
],
messages: [
messages.AcquireRequest,
messages.ReleaseRequest,
-6
View File
@@ -31,12 +31,6 @@ export class InstancePlugin extends BaseInstancePlugin {
disconnecting!: boolean;
async init() {
if (!this.instance.config.get("factorio.enable_save_patching")) {
throw new Error("inventory_sync plugin requires save patching.");
}
if (!this.instance.config.get("factorio.enable_script_commands")) {
throw new Error("inventory_sync plugin requires script commands.");
}
this.playersToRelease = new Set();
this.disconnecting = false;
+4
View File
@@ -33,6 +33,10 @@ export const plugin: lib.PluginDeclaration = {
},
},
features: [
"SavePatching",
],
messages: [
messages.FetchPlayerCodeRequest,
messages.SetVerifyCodeRequest,
-4
View File
@@ -13,10 +13,6 @@ type IpcPlayerAuth = {
export class InstancePlugin extends BaseInstancePlugin {
async init() {
if (!this.instance.config.get("factorio.enable_save_patching")) {
throw new Error("player_auth plugin requires save patching.");
}
this.instance.server.on(
"ipc-player_auth",
(ipcPlayerAuth: IpcPlayerAuth) => this.handleEvent(ipcPlayerAuth).catch(
+5
View File
@@ -9,6 +9,11 @@ export const plugin: lib.PluginDeclaration = {
instanceEntrypoint: "dist/node/instance",
controllerEntrypoint: "dist/node/controller",
features: [
"SavePatching",
"ScriptCommands",
],
messages: [
messages.ContributionEvent,
messages.ProgressEvent,
-7
View File
@@ -27,13 +27,6 @@ export class InstancePlugin extends BaseInstancePlugin {
}
async init() {
if (!this.instance.config.get("factorio.enable_save_patching")) {
throw new Error("research_sync plugin requires save patching.");
}
if (!this.instance.config.get("factorio.enable_script_commands")) {
throw new Error("research_sync plugin requires script commands.");
}
this.instance.server.on("ipc-research_sync:contribution", (tech: IpcContribution) => {
this.researchContribution(tech).catch(err => this.unexpectedError(err));
});
+5
View File
@@ -22,4 +22,9 @@ export const plugin: lib.PluginDeclaration = {
initialValue: 1,
},
},
features: [
"SavePatching",
"ScriptCommands",
],
};
-9
View File
@@ -104,15 +104,6 @@ function setForceFlowStatistic(
export class InstancePlugin extends BaseInstancePlugin {
async init() {
if (!this.instance.config.get("factorio.enable_save_patching")) {
throw new Error("statistics_exporter plugin requires save patching.");
}
if (!this.instance.config.get("factorio.enable_script_commands")) {
throw new Error("statistics_exporter plugin requires script commands.");
}
}
async gatherMetrics() {
let string = await this.sendRcon("/sc statistics_exporter.export()");
let stats: IpcStats;
+4
View File
@@ -49,6 +49,10 @@ export const plugin: lib.PluginDeclaration = {
},
},
features: [
"ScriptCommands",
],
messages: [
messages.PlaceEvent,
messages.RemoveRequest,
-4
View File
@@ -22,10 +22,6 @@ export class InstancePlugin extends BaseInstancePlugin {
}
async init() {
if (!this.instance.config.get("factorio.enable_script_commands")) {
throw new Error("subspace_storage plugin requires script commands.");
}
this.pendingTasks = new Set();
this.instance.server.on("ipc-subspace_storage:output", (output: IpcItems) => {
this.logger.info("Received output items:");