Removes Milo trying to access damage on items (`nil` because of The Flattening). We might also need to reimplement showing durability in the item's display name - I got a little too carried away with removing mentions of "damage". Also renames nbtHash to nbt to be consistent with new CC:T naming. I tried not to touch anything related to MiloRemote for now, and there are probably still many bugs remaining that need to be ironed out. Most of the basic functionality works now, though.
42 lines
822 B
Lua
42 lines
822 B
Lua
--[[ Emulate a CC:T inventory on the turtle
|
|
]]
|
|
|
|
local TurtleInv = {}
|
|
|
|
local turtle = _G.turtle
|
|
|
|
local inventorySize = 16
|
|
|
|
local localName = "milo_local_name_unset"
|
|
|
|
function TurtleInv.setLocalName(name)
|
|
localName = name
|
|
end
|
|
|
|
function TurtleInv.size()
|
|
return inventorySize
|
|
end
|
|
|
|
function TurtleInv.list()
|
|
local list = {}
|
|
for slot = 1, inventorySize do
|
|
list[slot] = turtle.getItemDetail(slot)
|
|
end
|
|
return list
|
|
end
|
|
|
|
function TurtleInv.getItemDetail(slot)
|
|
return turtle.getItemDetail(slot, true)
|
|
end
|
|
|
|
function TurtleInv.pullItems(fromName, fromSlot, limit, toSlot)
|
|
return peripheral.call(fromName, "pushItems", localName, fromSlot, limit, toSlot)
|
|
end
|
|
|
|
function TurtleInv.pushItems(toName, fromSlot, limit, toSlot)
|
|
return peripheral.call(toName, "pullItems", localName, fromSlot, limit, toSlot)
|
|
end
|
|
|
|
|
|
return TurtleInv
|