mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 16:23:12 +09:00
Merge remote-tracking branch 'refs/remotes/Danielv123/master'
This commit is contained in:
commit
1f58458302
5 files changed
+18
-15
No files matched your search
@@ -2,10 +2,10 @@
|
|||||||
INPUT_CHEST_NAME = "put-chest"
|
INPUT_CHEST_NAME = "put-chest"
|
||||||
INPUT_CHEST_PICTURE_PATH = nil
|
INPUT_CHEST_PICTURE_PATH = nil
|
||||||
INPUT_CHEST_ICON_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
|
--the chest that the player get things from
|
||||||
OUTPUT_CHEST_NAME = "get-chest"
|
OUTPUT_CHEST_NAME = "get-chest"
|
||||||
OUTPUT_CHEST_PICTURE_PATH = nil
|
OUTPUT_CHEST_PICTURE_PATH = nil
|
||||||
OUTPUT_CHEST_ICON_PATH = nil
|
OUTPUT_CHEST_ICON_PATH = nil
|
||||||
OUTPUT_CHEST_FILE = "output-items.txt"
|
OUTPUT_CHEST_FILE = "orders.txt"
|
||||||
@@ -76,7 +76,7 @@ function HandleInputChests()
|
|||||||
local items = v.get_inventory(defines.inventory.chest).get_contents()
|
local items = v.get_inventory(defines.inventory.chest).get_contents()
|
||||||
--write everything to the file
|
--write everything to the file
|
||||||
for itemName, itemCount in pairs(items) do
|
for itemName, itemCount in pairs(items) do
|
||||||
linesToWriteToFile[#linesToWriteToFile + 1] = itemName..", "..itemCount.."\n"
|
linesToWriteToFile[#linesToWriteToFile + 1] = itemName.. " " ..itemCount.."\n"
|
||||||
end
|
end
|
||||||
-- clear the inventory
|
-- clear the inventory
|
||||||
v.get_inventory(defines.inventory.chest).clear()
|
v.get_inventory(defines.inventory.chest).clear()
|
||||||
|
|||||||
@@ -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
|
// 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){
|
needle.post('localhost:8080/remove', {name:g[0], count:g[1]}, function(err, resp, body){
|
||||||
console.log(body);
|
console.log(body);
|
||||||
if(body == "success") {
|
if(body){
|
||||||
conn.send("/c remote.call('clusterio', 'import', '" + g[0] + "', " + g[1] + ")")
|
//conn.send("/c remote.call('clusterio', 'import', '" + g[0] + "', " + g[1] + ")")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
start nodemon client.js
|
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"
|
cd "Factorio 0.13.9"
|
||||||
@RD /S /Q "temp"
|
@RD /S /Q "temp"
|
||||||
cd "bin/x64"
|
cd "bin/x64"
|
||||||
@@ -9,9 +17,3 @@ cd ..
|
|||||||
@mcrcon.exe -t -H 81.167.2.56 -P 12345 -p 123
|
@mcrcon.exe -t -H 81.167.2.56 -P 12345 -p 123
|
||||||
|
|
||||||
pause
|
pause
|
||||||
|
|
||||||
cd "Factorio 0.13.9 - Copy/bin/x64"
|
|
||||||
start factorio.exe
|
|
||||||
cd ..
|
|
||||||
cd ..
|
|
||||||
cd ..
|
|
||||||
@@ -56,7 +56,7 @@ db.items.removeitem = function(object) {
|
|||||||
app.post("/place", function(req, res) {
|
app.post("/place", function(req, res) {
|
||||||
res.header("Access-Control-Allow-Origin", "*");
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
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
|
// save items we get
|
||||||
db.items.additem(req.body)
|
db.items.additem(req.body)
|
||||||
// Attempt confirming
|
// Attempt confirming
|
||||||
@@ -64,12 +64,13 @@ app.post("/place", function(req, res) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// endpoint to remove items from DB when client orders items
|
// 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-Origin", "*");
|
||||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
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
|
// save items we get
|
||||||
if(db.items.removeitem(req.body);) {
|
temp = db.items.removeitem(req.body);
|
||||||
|
if(temp) {
|
||||||
// if true, the action was successfull
|
// if true, the action was successfull
|
||||||
res.send("success");
|
res.send("success");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user