resolves #60 sharedMods doesn't affect instance mods

Might have broken backwards compat???
This commit is contained in:
Danielv123 committed 2017-11-15 12:55:49 +01:00
1 parent 682856c0a5
commit 6ecdde8cbc
4 files changed
+4964 -8

No files matched your search

+1 -1
View File
@@ -75,7 +75,7 @@ Server host (Slave) = client.js + factorio server
Game Client = The people connecting to the server Game Client = The people connecting to the server
All Server Hosts (Slaves) AND Game Clients need to be running the clusterio mod located at [github](https://github.com/Danielv123/factorioClusterioMod) Install it by dropping it into the mods folder. All Server Hosts (Slaves) AND Game Clients need to be running the clusterio mod located at [github](https://github.com/Danielv123/factorioClusterioMod) Install it by dropping it into either the sharedMods folder or instances/[instanceName]/instanceMods folder.
There are no requirements for other mods, they can be ran in any configuration allowed by the base game. There are no requirements for other mods, they can be ran in any configuration allowed by the base game.
+16 -5
View File
@@ -11,7 +11,7 @@ const hashFiles = require('hash-files');
const _ = require('underscore'); const _ = require('underscore');
const deepmerge = require("deepmerge"); const deepmerge = require("deepmerge");
const getMac = require('getmac').getMac; const getMac = require('getmac').getMac;
const rmdirSync = require('rmdir-sync');
// internal libraries // internal libraries
const objectOps = require("./lib/objectOps.js"); const objectOps = require("./lib/objectOps.js");
const fileOps = require("./lib/fileOps.js"); const fileOps = require("./lib/fileOps.js");
@@ -135,12 +135,11 @@ if (!command || command == "help" || command == "--help") {
console.log('node client.js manage '+(instance || '[instance, "shared"]') +' '+ (tool || '["mods", "config"]') + ' ...'); console.log('node client.js manage '+(instance || '[instance, "shared"]') +' '+ (tool || '["mods", "config"]') + ' ...');
} }
} }
const modManagerUsage1 = 'node client.js manage ';
const modManagerUsage2 = ' mods ["list", "update"]';
const tool = process.argv[4] || ""; const tool = process.argv[4] || "";
const action = process.argv[5] || ""; const action = process.argv[5] || "";
if(instance){ if(instance){
if(tool == "mods"){ if(tool == "mods"){
// allow managing mods
if(action == "list"){ if(action == "list"){
modManager.listMods(instance); modManager.listMods(instance);
} else if(action == "search"){ } else if(action == "search"){
@@ -151,6 +150,7 @@ if (!command || command == "help" || command == "--help") {
usage(instance, tool); usage(instance, tool);
} }
} else if(tool == "config"){ } else if(tool == "config"){
// allow managing the config
if(action == "list" || action == "show" || action == "display"){ if(action == "list" || action == "show" || action == "display"){
configManager.displayConfig(instance); configManager.displayConfig(instance);
} else if(action == "edit"){ } else if(action == "edit"){
@@ -214,6 +214,7 @@ if (!command || command == "help" || command == "--help") {
fs.writeFileSync(instancedirectory + "/script-output/orders.txt", ""); fs.writeFileSync(instancedirectory + "/script-output/orders.txt", "");
fs.writeFileSync(instancedirectory + "/script-output/txbuffer.txt", ""); fs.writeFileSync(instancedirectory + "/script-output/txbuffer.txt", "");
fs.mkdirSync(instancedirectory + "/mods/"); fs.mkdirSync(instancedirectory + "/mods/");
fs.mkdirSync(instancedirectory + "/instanceMods/");
// fs.symlinkSync('../../../sharedMods', instancedirectory + "/mods", 'junction') // This is broken because it can only take a file as first argument, not a folder // fs.symlinkSync('../../../sharedMods', instancedirectory + "/mods", 'junction') // This is broken because it can only take a file as first argument, not a folder
fs.writeFileSync(instancedirectory + "/config.ini", "[path]\r\n\ fs.writeFileSync(instancedirectory + "/config.ini", "[path]\r\n\
read-data=__PATH__executable__/../../data\r\n\ read-data=__PATH__executable__/../../data\r\n\
@@ -226,7 +227,7 @@ write-data=__PATH__executable__/../../../instances/" + instance + "\r\n\
"clientPort": process.env.RCONPORT | Math.floor(Math.random() * 65535), "clientPort": process.env.RCONPORT | Math.floor(Math.random() * 65535),
"clientPassword": Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 8), "clientPassword": Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 8),
} }
console.log("Clusterio | Moving shared mods..."); console.log("Clusterio | Created instance with settings:")
console.log(instconf); console.log(instconf);
// create instance config // create instance config
@@ -300,8 +301,18 @@ write-data=__PATH__executable__/../../../instances/" + instance + "\r\n\
} }
// move mods from ./sharedMods to the instances mod directory // move mods from ./sharedMods to the instances mod directory
console.log("Clusterio | Moving shared mods..."); try {
fs.mkdirSync(instancedirectory + "/instanceMods/");
} catch(e){}
try{rmdirSync(instancedirectory + "/mods");}catch(e){}
try {
// mods directory that will be emptied (deleted) when closing the server to facilitate seperation of instanceMods and sharedMods
fs.mkdirSync(instancedirectory + "/mods/");
} catch(e){}
console.log("Clusterio | Moving shared mods from sharedMods/ to instance/mods...");
fs.copySync('sharedMods', instancedirectory + "/mods"); fs.copySync('sharedMods', instancedirectory + "/mods");
console.log("Clusterio | Moving instance specific mods from instance/instanceMods to instance/mods...");
fs.copySync(instancedirectory + "/instanceMods", instancedirectory + "/mods");
process.on('SIGINT', function () { process.on('SIGINT', function () {
console.log("Caught interrupt signal"); console.log("Caught interrupt signal");
+4946 -2
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -48,6 +48,7 @@
"portfinder": "^1.0.9", "portfinder": "^1.0.9",
"request": "^2.83.0", "request": "^2.83.0",
"right-pad": "^1.0.1", "right-pad": "^1.0.1",
"rmdir-sync": "^1.0.1",
"semver": "^5.4.1", "semver": "^5.4.1",
"simple-rcon": "^0.3.1", "simple-rcon": "^0.3.1",
"sync-request": "^4.0.1", "sync-request": "^4.0.1",