Convert items to Wyvern items
This commit is contained in:
parent
518e0a5df6
commit
ee8dc13fb8
@ -36,6 +36,10 @@ local function cache(item, chest, slot)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function to_wyvern_item(plethora_item)
|
||||||
|
return { NBT = plethora_item.nbtHash, ID = plethora_item.name, damage = plethora_item, display_name = plethora_item.displayName, count = plethora_item.count }
|
||||||
|
end
|
||||||
|
|
||||||
local index = {}
|
local index = {}
|
||||||
-- Update the index for the given peripheral
|
-- Update the index for the given peripheral
|
||||||
local function update_index_for(name)
|
local function update_index_for(name)
|
||||||
@ -43,6 +47,7 @@ local function update_index_for(name)
|
|||||||
local data = inv.list()
|
local data = inv.list()
|
||||||
|
|
||||||
for slot, item in pairs(data) do
|
for slot, item in pairs(data) do
|
||||||
|
data[slot] = to_wyvern_item(data[slot])
|
||||||
data[slot].display_name = cache(item, inv, slot)
|
data[slot].display_name = cache(item, inv, slot)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -151,7 +156,7 @@ local function server(command)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return { moved = items_moved_to_destination or items_moved_from_storage, item = first_available.item }
|
return { moved = items_moved_to_destination or items_moved_from_storage, item = to_wyvern_item(first_available.item) }
|
||||||
elseif command.type == "insert" then
|
elseif command.type == "insert" then
|
||||||
local inventory_with_space = find_space()
|
local inventory_with_space = find_space()
|
||||||
if not inventory_with_space then return w.errors.make(w.errors.NOSPACE) end -- if there's not space, say so in error
|
if not inventory_with_space then return w.errors.make(w.errors.NOSPACE) end -- if there's not space, say so in error
|
||||||
|
Loading…
Reference in New Issue
Block a user