mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-25 00:23:12 +09:00
Add feature flags to first party plugins
This commit is contained in:
12 files changed
+27
-34
No files matched your search
@@ -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,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ export const plugin: lib.PluginDeclaration = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
features: [
|
||||||
|
"SavePatching",
|
||||||
|
"ScriptCommands",
|
||||||
|
],
|
||||||
|
|
||||||
messages: [
|
messages: [
|
||||||
messages.AcquireRequest,
|
messages.AcquireRequest,
|
||||||
messages.ReleaseRequest,
|
messages.ReleaseRequest,
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ export const plugin: lib.PluginDeclaration = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
features: [
|
||||||
|
"SavePatching",
|
||||||
|
],
|
||||||
|
|
||||||
messages: [
|
messages: [
|
||||||
messages.FetchPlayerCodeRequest,
|
messages.FetchPlayerCodeRequest,
|
||||||
messages.SetVerifyCodeRequest,
|
messages.SetVerifyCodeRequest,
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,4 +22,9 @@ export const plugin: lib.PluginDeclaration = {
|
|||||||
initialValue: 1,
|
initialValue: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
features: [
|
||||||
|
"SavePatching",
|
||||||
|
"ScriptCommands",
|
||||||
|
],
|
||||||
};
|
};
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ export const plugin: lib.PluginDeclaration = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
features: [
|
||||||
|
"ScriptCommands",
|
||||||
|
],
|
||||||
|
|
||||||
messages: [
|
messages: [
|
||||||
messages.PlaceEvent,
|
messages.PlaceEvent,
|
||||||
messages.RemoveRequest,
|
messages.RemoveRequest,
|
||||||
|
|||||||
@@ -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:");
|
||||||
|
|||||||
Reference in new issue
Block a user