Stop reindexing constantly
This commit is contained in:
parent
27fe9b37b2
commit
2dbcadb155
|
@ -90,9 +90,9 @@ end
|
|||
local function find_by_ID_meta_NBT(ID, meta, NBT_hash)
|
||||
return find(function(item)
|
||||
return
|
||||
(not meta or item.meta == meta) and -- if metadata provided, ensure match
|
||||
(not ID or item.ID == ID) and -- if internal name provided, ensure match
|
||||
(not NBT_hash or item.NBT_hash == NBT_hash) -- if NBT hash provided, ensure match
|
||||
(not meta or item.meta == meta) and -- if metadata provided, ensure match
|
||||
(not ID or item.ID == ID) and -- if internal name provided, ensure match
|
||||
(not NBT_hash or item.NBT_hash == NBT_hash) -- if NBT hash provided, ensure match
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -146,7 +146,9 @@ local function server(command)
|
|||
|
||||
table.insert(stacks, stack_to_pull)
|
||||
items_moved_from_storage = items_moved_from_storage + fetch_by_location(stack_to_pull.location, command.quantity)
|
||||
os.queueEvent("reindex", stack_to_pull.location.inventory) -- I'm too lazy to manually update the item properly, and indexing is fast enough, so just do this
|
||||
index[location.inventory][location.slot].count = index[location.inventory][location.slot].count - items_moved_from_storage
|
||||
if index[location.inventory][location.slot].count == 0 then index[location.inventory][location.slot] = nil
|
||||
elseif index[location.inventory][location.slot].count < 0 then error "Index inconsistency error." end
|
||||
until items_moved_from_storage >= quantity_to_fetch_remaining
|
||||
|
||||
if command.destination_inventory then
|
||||
|
|
Loading…
Reference in New Issue