From 3c847b4f87f198379f6a5437c3e7c9c99ed35c24 Mon Sep 17 00:00:00 2001 From: osmarks Date: Mon, 13 Aug 2018 09:11:58 +0100 Subject: [PATCH] Add reindex --- client.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client.lua b/client.lua index 14c1e88..a728d02 100644 --- a/client.lua +++ b/client.lua @@ -26,10 +26,11 @@ withdraw [quantity] [name] - withdraw [quantity] items with display names close withdraw [items] - as above but withdraws all available matching items dump [slot] - dump stack in slot back to storage dump - dump whole inventory to storage -craft - runs turtle.craft]] +craft - runs turtle.craft +reindex - force storage server to reindex its contents]] local function dump(slot) - w.query_by_type("storage", { + return w.query_by_type("storage", { type = "insert", from_slot = slot, from_inventory = conf.network_name @@ -74,15 +75,18 @@ local commands = { local slot = tonumber(slot) if not slot then for i = 1, 16 do - dump(i) + unwrap(dump(i), "dumping inventory") end else - dump(slot) + unwrap(dump(slot), "dumping slot " .. tostring(slot)) end end, craft = function() local result = turtle.craft() if not result then return "Invalid or no recipe." end + end, + reindex = function() + unwrap(w.query_by_type("storage", { type = "reindex" }), "requesting reindexing") end }