Remove duplicated clusterTools code

Remove getCommand, getInstanceName, getSafeLua, and
checkHotpatchInstallation definitions from plugins and use the
implementation in lib/clusterTools for these functions instead.
This commit is contained in:
Hornwitser committed 2019-09-18 13:54:22 +02:00
1 parent ec223e9d9e
commit c5cae30d83
3 files changed
+6 -128

No files matched your search

+1 -10
View File
@@ -8,7 +8,7 @@ module.exports = class remoteCommands {
this.config = mergedConfig;
(async () => {
let hotpatchInstallStatus = await this.checkHotpatchInstallation();
let hotpatchInstallStatus = await clusterTools.checkHotpatchInstallation(messageInterface);
messageInterface("Hotpach installation status: "+hotpatchInstallStatus);
if(hotpatchInstallStatus){
await this.loadScenariosFromFolder("scenarios") // located in project root folder (with sharedMods, sharedPlugins etc)
@@ -66,15 +66,6 @@ module.exports = class remoteCommands {
}
}
}
async checkHotpatchInstallation(){
let yn = await this.messageInterface("/silent-command if remote.interfaces['hotpatch'] then rcon.print('true') else rcon.print('false') end");
yn = yn.replace(/(\r\n\t|\n|\r\t)/gm, "");
if(yn == "true"){
return true;
} else if(yn == "false"){
return false;
}
}
}
// this function is bad in terms of scope since it relies on a global for return values, should be refactored.