mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 07:33:12 +09:00
Removed junk, added comments
This commit is contained in:
1 parent
d73bfbc1eb
commit
ccf54bec18
2 files changed
+5
-24
No files matched your search
@@ -73,26 +73,6 @@ for(i=0; i<pluginDirectories.length; i++) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerPluginEvent(event, plugins, data) {
|
|
||||||
// string, array, object
|
|
||||||
// data = {messageInterface}
|
|
||||||
if(!data || typeof data != "object") {
|
|
||||||
data = {};
|
|
||||||
console.log("WARN: client.js triggerPluginEvent argument 3 has to be object, defaulting to " + JSON.stringify(data));
|
|
||||||
}
|
|
||||||
if(typeof event == "string" && typeof plugins == "object") {
|
|
||||||
for(i=0;i<plugins.length;i++){
|
|
||||||
if(plugins[i][event] && typeof plugins[i][event] == "function"){
|
|
||||||
function log(t) {
|
|
||||||
console.log("clusterio | "+ pluginDirectories[i] + " | " + t);
|
|
||||||
}
|
|
||||||
console.log("clusterio | Triggering event " + event + " on " + plugins[i]);
|
|
||||||
plugins[i][event](data.messageInterface, log, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs.existsSync("./instances/")) {
|
if (!fs.existsSync("./instances/")) {
|
||||||
fs.mkdirSync("instances");
|
fs.mkdirSync("instances");
|
||||||
}
|
}
|
||||||
@@ -278,8 +258,6 @@ write-data=__PATH__executable__/../../../instances/" + instance + "\r\n\
|
|||||||
|
|
||||||
client.on('authenticated', function () {
|
client.on('authenticated', function () {
|
||||||
console.log('Clusterio | Authenticated!');
|
console.log('Clusterio | Authenticated!');
|
||||||
// tell all plugins we have RCON and they can start using it
|
|
||||||
triggerPluginEvent("onRcon", plugins, client.exec);
|
|
||||||
instanceManagement(); // start using rcons
|
instanceManagement(); // start using rcons
|
||||||
}).on('connected', function () {
|
}).on('connected', function () {
|
||||||
console.log('Clusterio | Connected!');
|
console.log('Clusterio | Connected!');
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
Example config file for example Clusterio plugin
|
Example config file for example Clusterio plugin
|
||||||
Binary will be spawned using child_process.fork and get input from stdin and text from stdout will be ran as
|
Binary will be spawned using child_process.spawn and get input from stdin and text from stdout will be ran as
|
||||||
commands in the factorio server.
|
commands in the factorio server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "clusterioPluginExample.exe",
|
// Name of package. For display somewhere I guess.
|
||||||
|
name: "clusterioPluginExample",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
|
// Binary entrypoint for plugin. Don't let it crash. Stdout is sent to game as server chat (run /c commands from here for interface)
|
||||||
|
// Make sure its cross platform somehow.
|
||||||
binary: "clusterioPluginExample",
|
binary: "clusterioPluginExample",
|
||||||
description: "Example plugin for Clusterio to show easy interface integration with factorio servers.",
|
description: "Example plugin for Clusterio to show easy interface integration with factorio servers.",
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user