Merge remote-tracking branch 'refs/remotes/Danielv123/master'

This commit is contained in:
TheAIBot committed 2016-08-13 22:21:53 +02:00
commit 1f58458302
5 files changed
+19 -16

No files matched your search

+2 -2
View File
@@ -2,10 +2,10 @@
INPUT_CHEST_NAME = "put-chest"
INPUT_CHEST_PICTURE_PATH = nil
INPUT_CHEST_ICON_PATH = nil
INPUT_CHEST_FILE = "intput-items.txt"
INPUT_CHEST_FILE = "output.txt"
--the chest that the player get things from
OUTPUT_CHEST_NAME = "get-chest"
OUTPUT_CHEST_PICTURE_PATH = nil
OUTPUT_CHEST_ICON_PATH = nil
OUTPUT_CHEST_FILE = "output-items.txt"
OUTPUT_CHEST_FILE = "orders.txt"
+1 -1
View File
@@ -76,7 +76,7 @@ function HandleInputChests()
local items = v.get_inventory(defines.inventory.chest).get_contents()
--write everything to the file
for itemName, itemCount in pairs(items) do
linesToWriteToFile[#linesToWriteToFile + 1] = itemName..", "..itemCount.."\n"
linesToWriteToFile[#linesToWriteToFile + 1] = itemName.. " " ..itemCount.."\n"
end
-- clear the inventory
v.get_inventory(defines.inventory.chest).clear()
+2 -2
View File
@@ -56,8 +56,8 @@ fs.watch("Factorio 0.13.9/script-output/orders.txt", "utf8", function(eventType,
// send our entity and count to the master for him to keep track of
needle.post('localhost:8080/remove', {name:g[0], count:g[1]}, function(err, resp, body){
console.log(body);
if(body == "success") {
conn.send("/c remote.call('clusterio', 'import', '" + g[0] + "', " + g[1] + ")")
if(body){
//conn.send("/c remote.call('clusterio', 'import', '" + g[0] + "', " + g[1] + ")")
}
});
}
+9 -7
View File
@@ -1,4 +1,12 @@
start nodemon client.js
start nodemon master.js
cd "Factorio 0.13.9 - Copy/bin/x64"
start factorio.exe
cd ..
cd ..
cd ..
cd "Factorio 0.13.9"
@RD /S /Q "temp"
cd "bin/x64"
@@ -8,10 +16,4 @@ cd ..
cd ..
@mcrcon.exe -t -H 81.167.2.56 -P 12345 -p 123
pause
cd "Factorio 0.13.9 - Copy/bin/x64"
start factorio.exe
cd ..
cd ..
cd ..
pause
+5 -4
View File
@@ -56,7 +56,7 @@ db.items.removeitem = function(object) {
app.post("/place", function(req, res) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
console.log(req.body);
console.log("added: " + req.body);
// save items we get
db.items.additem(req.body)
// Attempt confirming
@@ -64,12 +64,13 @@ app.post("/place", function(req, res) {
});
// endpoint to remove items from DB when client orders items
app.post("/place", function(req, res) {
app.post("/remove", function(req, res) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
console.log(req.body);
console.log("removed: " + req.body);
// save items we get
if(db.items.removeitem(req.body);) {
temp = db.items.removeitem(req.body);
if(temp) {
// if true, the action was successfull
res.send("success");
} else {