Remove UPSdisplay plugin

Remove the redundant UPSdisplay plugin.  UPS statistics is gathered by
the statistics_exporter plugin.
This commit is contained in:
Hornwitser committed 2019-12-20 21:26:29 +01:00
1 parent 26eefb0476
commit 1873f9bda8
5 files changed
+2 -62

No files matched your search

-1
View File
@@ -48,7 +48,6 @@ saves
!sharedPlugins/
sharedPlugins/*
!sharedPlugins/inventoryImports/
!sharedPlugins/UPSdisplay/
!sharedPlugins/researchSync/
!sharedPlugins/clusterioMod/
+2
View File
@@ -71,6 +71,8 @@ Version 2.0.0
- Removed info and shout command from globalChat plugin
- Removed mirrorAllChat and enableCrossServerShout configuration options for
globalChat plugin.
- Removed UPSdisplay plugin. UPS statistics is exported by the statistics
exporter plugin.
### Breaking Changes
-12
View File
@@ -1,12 +0,0 @@
/*
Example config file for example Clusterio plugin
*/
module.exports = {
// Name of package. For display somewhere I guess.
name: "UPSdisplay",
version: "2.0.0",
description: "Internal clusterio plugin to get the worlds UPS and display it on master",
// We'll send everything in this file to your stdin. Beware.
scriptOutputFileSubscription: "UPSdisplay.txt",
}
-45
View File
@@ -1,45 +0,0 @@
const needle = require("needle");
class UPSdisplay {
constructor(slaveConfig, msgInterface, extras){
this.config = slaveConfig;
this.messageInterface = msgInterface;
this.socket = extras.socket;
this.slave = extras.slave;
this.historicalTicks = [];
setInterval(() => {
this.messageInterface("/silent-command rcon.print(game.tick)", data => {
this.tick = Number(data);
this.historicalTicks[this.historicalTicks.length] = {tick:Number(data), timestamp:Date.now()};
if(this.historicalTicks.length > 30){
this.historicalTicks.shift(); // delete last element in array (position 0);
}
});
},1000);
setInterval(() => {
if(this.historicalTicks && this.historicalTicks[0]){
let timePeriod = this.historicalTicks[this.historicalTicks.length-1].timestamp - this.historicalTicks[0].timestamp;
let ticksInPeriod = this.historicalTicks[this.historicalTicks.length-1].tick - this.historicalTicks[0].tick;
let UPS = Math.round(ticksInPeriod / (timePeriod/1000));
// console.log("UPS: " + UPS);
try{
needle.post(
this.config.masterURL+'/api/editSlaveMeta',
{instanceID: this.config.unique, password: this.config.clientPassword, meta: {UPS:UPS, tick:this.tick}},
{headers: {'x-access-token': this.config.masterAuthToken}},
function(err, resp) {
// success?
}
);
} catch (err){
console.log(err);
}
}
}, 5000);
this.messageInterface("/silent-command game.print('UPSdisplay enabled')");
}
}
module.exports = UPSdisplay;
-4
View File
@@ -1,4 +0,0 @@
// These are libraries that does not have any units test, they are
// required here in order to track coverage for them.
require('../index');