Add reindex
This commit is contained in:
parent
8172858d48
commit
3c847b4f87
12
client.lua
12
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
|
withdraw [items] - as above but withdraws all available matching items
|
||||||
dump [slot] - dump stack in slot back to storage
|
dump [slot] - dump stack in slot back to storage
|
||||||
dump - dump whole inventory 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)
|
local function dump(slot)
|
||||||
w.query_by_type("storage", {
|
return w.query_by_type("storage", {
|
||||||
type = "insert",
|
type = "insert",
|
||||||
from_slot = slot,
|
from_slot = slot,
|
||||||
from_inventory = conf.network_name
|
from_inventory = conf.network_name
|
||||||
@ -74,15 +75,18 @@ local commands = {
|
|||||||
local slot = tonumber(slot)
|
local slot = tonumber(slot)
|
||||||
if not slot then
|
if not slot then
|
||||||
for i = 1, 16 do
|
for i = 1, 16 do
|
||||||
dump(i)
|
unwrap(dump(i), "dumping inventory")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
dump(slot)
|
unwrap(dump(slot), "dumping slot " .. tostring(slot))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
craft = function()
|
craft = function()
|
||||||
local result = turtle.craft()
|
local result = turtle.craft()
|
||||||
if not result then return "Invalid or no recipe." end
|
if not result then return "Invalid or no recipe." end
|
||||||
|
end,
|
||||||
|
reindex = function()
|
||||||
|
unwrap(w.query_by_type("storage", { type = "reindex" }), "requesting reindexing")
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user