diff --git a/CHANGELOG.md b/CHANGELOG.md index 28fb75b2..2fa3e217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,25 @@ Version 2.0.0 add in a remote interface. +Version 1.2.3 +------------- + +- Disabled uploading mods to the master server by default as this is mostly + just a waste of bandwidth with the mod portal being integrated into the + game now. +- Fixed researchSync breaking with heavily modded games due to the tech tree + exceeding the default 100kb limit on JSON payloads. +- Fixed the command inventoryImport sends referencing player instead of + character, and trying to count the non-existant quick bar slots. +- Fixed inventoryImport never receiving the script output after the default + mode for reading script output changed to tail mode. +- Fixed desync caused by the mods and loaded mods arrays in Hotpatch getting + out of sync when plugins update their scenario mod code. To fix existing + games you will need copy lib/scenarios/Hotpatch/hotpatch/mod-tools.lua + over the existing mod-tools.lua in the save's hotpatch folder. +- Updated the Windows install instructions. + + Version 1.2.2 ------------- diff --git a/README.md b/README.md index 09797799..549b63bb 100644 --- a/README.md +++ b/README.md @@ -189,28 +189,47 @@ reboot when you are done, then proceed to the next steps. *reboots matter* **Master** -1. download and run https://puu.sh/toFHl/01eebbb333.bat +1. Open PowerShell or Command prompt in the directory you want to install to and run the following commands. -2. Copy config.json.dist to config.json + git clone -b 1.2.x https://github.com/clusterio/factorioClusterio + cd factorioClusterio + npm install --only=production + copy config.json.dist config.json -3. Follow the instructions in the bat file -3. Some of the instructions are outdated. If you get stuck somewhere, look at the Ubuntu section. +2. Obtain Factorio by either of these two methods: -4. Run `node client manage shared mods add clusterio` + - Via the stand alone version on from their website -5. type `node master` to start the server + 1. Download the MS Windows (64-bit zip package) from https://www.factorio.com/download + + 2. Open the zip file and drag the folder called "Factorio_0.17.x" into the factorioClusterio folder + + 3. Rename the folder to "factorio" + + - Via steam installation + + 1. Locate the game files by right clicking the game in steam, selecting properties, then Local Files, then Browse local files. + + 2. Go to the parent folder of the folder that Steam opened and copy the Factorio folder into the factorioClusterio folder + + 3. Rename the folder to "factorio" + + +3. Open `config.json` with a text editor and configure as desired. + +4. Run `node master` to generate the athentication token into secret-api-token.txt + +5. Run `node master` again to start the master server. **Server Host** -1. download and run https://puu.sh/toFHl/01eebbb333.bat +1. Do step 1 and 2 of the Master section above *OR* use the same folder that was created in that section. -2. Copy config.json.dist to config.json +2. Open `config.json` with a text editor and configure as desired. You will need to set masterAuthToken to string found in secret-api-token.txt on the master server. -3. Follow the instructions given. +3. Optionally run the command `node client manage shared mods add clusterio` to add the clusterio mod (needed for item teleports.) -3.5 Some of the instructions are outdated. If you get stuck somewhere, look at the Ubuntu section. - -4. Type `node client start [instancename]` to create a new instance. +4. Run `node client start [instancename]` to create a new instance. Repeat it again to start the instance. To connect to a master server running on a remote machine, open config.json with your favourite text editor (notepad++). You can also set it up to use the official server browser. diff --git a/config.json.dist b/config.json.dist index 6fda38cd..88025449 100644 --- a/config.json.dist +++ b/config.json.dist @@ -50,7 +50,7 @@ "__comment6.5": "When the master is undersupplied, we have 3 different modes to 'fairly' distribute items. First to ask gets all, dole division using weird formula or experimental neural net tries to make stuff as fair as possible. Feel free to play around.", "disableFairItemDistribution": false, "useNeuralNetDoleDivider": true, - "uploadModsToMaster": true, + "uploadModsToMaster": false, "msBetweenCommands": 10, "allowRemoteCommandExecution": true, "enableCrossServerShout": true, diff --git a/master.js b/master.js index a154a6d9..81d02ed8 100644 --- a/master.js +++ b/master.js @@ -47,7 +47,9 @@ const fileUpload = require('express-fileupload'); var app = express(); app.use(cookieParser()); -app.use(bodyParser.json()); +app.use(bodyParser.json({ + limit: '10mb', +})); app.use(bodyParser.urlencoded({ parameterLimit: 100000, limit: '10mb', diff --git a/sharedPlugins/inventoryImports/config.js b/sharedPlugins/inventoryImports/config.js index 9b2258cf..758d2b9d 100644 --- a/sharedPlugins/inventoryImports/config.js +++ b/sharedPlugins/inventoryImports/config.js @@ -17,4 +17,5 @@ module.exports = { description: "Clusterio plugin to fill character logistic slots with master imports", // We'll send everything in this file to your stdin. Beware. scriptOutputFileSubscription: "inventoryImports.txt", + fileReadDelay: 100, } \ No newline at end of file diff --git a/sharedPlugins/inventoryImports/interfacingFunctions.js b/sharedPlugins/inventoryImports/interfacingFunctions.js index 9ea57750..c8493c67 100644 --- a/sharedPlugins/inventoryImports/interfacingFunctions.js +++ b/sharedPlugins/inventoryImports/interfacingFunctions.js @@ -136,7 +136,10 @@ function pollInventories(outputFile){ //console.log("/silent-command "+'local a=game.players["Danielv123"].get_inventory(defines.inventory.player_main).get_contents()local b=game.players["Danielv123"].get_quickbar().get_contents()local c={}for d=1,game.players["Danielv123"].force.character_logistic_slot_count do c[d]=game.players["Danielv123"].character.get_request_slot(d)end;local e="{inventory:{"for f,g in pairs(a)do e=e.."['+"'"+'"..f.."'+"'"+']:"..g..","end;for f,g in pairs(b)do e=e.."['+"'"+'"..f.."'+"'"+']:"..g..","end;e=e.."},requestSlots:{"for f,g in pairs(c)do e=e.."['+"'"+'"..g["name"].."'+"'"+']:"..g["count"]..", "end;e=e.."}}"game.write_file("'+pluginConfig.scriptOutputFileSubscription+'",e)') // console.log("/silent-command "+'local a="{"for b,c in pairs(game.players)do local d=game.players[b].get_inventory(defines.inventory.player_main).get_contents()local e=game.players[b].get_quickbar().get_contents()local f={}for g=1,game.players[b].force.character_logistic_slot_count do f[g]=game.players[b].character.get_request_slot(g)end;a=a..b..":{inventory:{"for h,i in pairs(d)do a=a.."['+"'"+'"..h.."'+"'"+']:"..i..","end;for h,i in pairs(e)do a=a.."['+"'"+'"..h.."'+"'"+']:"..i..","end;a=a.."},requestSlots:{"for h,i in pairs(f)do a=a.."['+"'"+'"..i["name"].."'+"'"+']:"..i["count"]..", "end;a=a.."}},"end;a=a.."}"game.write_file("'+pluginConfig.scriptOutputFileSubscription+'",a)') //return "/silent-command "+'local a="{"for b,c in pairs(game.players)do if c.connected then local d=game.players[b].get_inventory(defines.inventory.player_main).get_contents()local e=game.players[b].get_quickbar().get_contents()local f={}for g=1,game.players[b].force.character_logistic_slot_count do f[g]=game.players[b].character.get_request_slot(g)end;a=a..b..":{inventory:{"for h,i in pairs(d)do a=a.."['+"'"+'"..h.."'+"'"+']:"..i..","end;for h,i in pairs(e)do a=a.."['+"'"+'"..h.."'+"'"+']:"..i..","end;a=a.."},requestSlots:{"for h,i in pairs(f)do a=a.."['+"'"+'"..i["name"].."'+"'"+']:"..i["count"]..", "end;a=a.."}},"end end;a=a.."}"game.write_file("'+outputFile+'",a)' - return '/silent-command '+'local a='+"'"+'{"players":{'+"'"+'local b=false;for c,d in pairs(game.players)do if d.connected and d.character then if b then a=a..'+"'"+','+"'"+'else b=true end;local e=game.players[c].get_inventory(defines.inventory.player_main).get_contents()local f=game.players[c].get_quickbar().get_contents()local g={}local z={}for j,k in pairs(e)do if z[j] ~= nil then z[j] = z[j] + k else z[j] = k end end for j,k in pairs(f)do if z[j] ~= nil then z[j] = z[j] + k else z[j] = k end end for h=1,game.players[c].force.character_logistic_slot_count do g[h]=game.players[c].character.get_request_slot(h)end;a=a..'+"'"+'"'+"'"+'..c..'+"'"+'":{"inventory":{'+"'"+'local i=false;for j,k in pairs(z)do if i then a=a..'+"'"+','+"'"+'else i=true end;a=a..'+"'"+'"'+"'"+'..j..'+"'"+'":'+"'"+'..k end;a=a..'+"'"+'},"requestSlots":{'+"'"+'i=false;for j,k in pairs(g)do if i then a=a..'+"'"+','+"'"+'else i=true end;a=a..'+"'"+'"'+"'"+'..k['+"'"+'name'+"'"+']..'+"'"+'":'+"'"+'..k['+"'"+'count'+"'"+']end;a=a..'+"'"+'}}'+"'"+'end end;a=a.."}}"game.write_file("'+outputFile+'",a,true,0)' + //return '/silent-command '+'local a='+"'"+'{"players":{'+"'"+'local b=false;for c,d in pairs(game.players)do if d.connected and d.character then if b then a=a..'+"'"+','+"'"+'else b=true end;local e=game.players[c].get_inventory(defines.inventory.player_main).get_contents()local f=game.players[c].get_quickbar().get_contents()local g={}local z={}for j,k in pairs(e)do if z[j] ~= nil then z[j] = z[j] + k else z[j] = k end end for j,k in pairs(f)do if z[j] ~= nil then z[j] = z[j] + k else z[j] = k end end for h=1,game.players[c].force.character_logistic_slot_count do g[h]=game.players[c].character.get_request_slot(h)end;a=a..'+"'"+'"'+"'"+'..c..'+"'"+'":{"inventory":{'+"'"+'local i=false;for j,k in pairs(z)do if i then a=a..'+"'"+','+"'"+'else i=true end;a=a..'+"'"+'"'+"'"+'..j..'+"'"+'":'+"'"+'..k end;a=a..'+"'"+'},"requestSlots":{'+"'"+'i=false;for j,k in pairs(g)do if i then a=a..'+"'"+','+"'"+'else i=true end;a=a..'+"'"+'"'+"'"+'..k['+"'"+'name'+"'"+']..'+"'"+'":'+"'"+'..k['+"'"+'count'+"'"+']end;a=a..'+"'"+'}}'+"'"+'end end;a=a.."}}"game.write_file("'+outputFile+'",a,true,0)' + + // Warning: This command is not in sync with lua commands.lua + return `/silent-command local a='{"players":{'local b=false;for c,d in pairs(game.players)do if d.connected and d.character then if b then a=a..','else b=true end;local e=game.players[c].get_inventory(defines.inventory.character_main).get_contents()local g={}for h=1,game.players[c].force.character_logistic_slot_count do g[h]=game.players[c].character.get_request_slot(h)end;a=a..'"'..c..'":{"inventory":{'local i=false;for j,k in pairs(e)do if i then a=a..','else i=true end;a=a..'"'..j..'":'..k end;a=a..'},"requestSlots":{'i=false;for j,k in pairs(g)do if i then a=a..','else i=true end;a=a..'"'..k['name']..'":'..k['count']end;a=a..'}}'end end;a=a.."}}"game.write_file("${outputFile}",a,true,0)` /* needle.post(config.masterURL+'/api/editSlaveMeta', {instanceID: config.unique, password: config.clientPassword, meta: {UPS:UPS}}, function(err, resp) { // success? diff --git a/sharedPlugins/inventoryImports/lua commands.lua b/sharedPlugins/inventoryImports/lua commands.lua index 431740de..298adcff 100644 --- a/sharedPlugins/inventoryImports/lua commands.lua +++ b/sharedPlugins/inventoryImports/lua commands.lua @@ -1,3 +1,4 @@ +-- WARNING: The commands in this file is not in sync with interfacingFunctions.js -- Lua cheatsheet /c game.write_file("test.txt",serpent.block(game.players["Danielv123"].get_quickbar().get_contents()))