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