This commit is contained in:
Crispy 2025-05-23 02:31:02 +02:00
parent 12ffbdc45d
commit 13ddce15ae
15 changed files with 8967 additions and 61 deletions

View file

@ -2,7 +2,6 @@ require("inventory")
require("pathfinding")
function mill(extra_items)
-- 0.4 second/item
go_to(vector.new(-4,0,0),"south")
item_count = 0
if turtle.getItemCount() ~= 0 then
@ -15,16 +14,17 @@ function mill(extra_items)
insertForward(1, item.count)
end
print(item_count,"items")
sleep(0.5)
sleep(0.4 * item_count)
for i = 1, 10 do
while peripheral.call("front", "getItemDetail", 1) do
sleep(0.1)
end
for i = 2, 10 do
takeForward(i)
end
end
function deploy(extra_items, nbt)
-- extra_items should only be one item
go_to(vector.new(2,0,0), "south")
insertForwardDepot(1)
insertDepot(1)
goUp()
goUp()
selectItem(extra_items[1].name, nbt)
@ -33,7 +33,7 @@ function deploy(extra_items, nbt)
goDown()
goDown()
takeForwardDepot()
takeDepot()
end
function deploy_tool(extra_items)
deploy(extra_items, true)
@ -62,9 +62,9 @@ function furnace(extra_items)
end
function press(_)
go_to(vector.new(-1,0,0), "south")
insertForwardDepot(1)
insertDepot(1)
sleep(1)
takeForwardDepot()
takeDepot()
end
function compact(extra_items) end
function mix(extra_items)
@ -83,17 +83,24 @@ function mix(extra_items)
takeForward(10)
end
function craft(extra_items)
slot = 5
-- for i = 1, 16 do
-- if turtle.getItemCount(i) ~= 0 then
-- turtle.select(i)
-- turtle.drop()
-- end
-- end
local slot = 0
print(len(extra_items), "extra items")
for _, item in pairs(extra_items) do
slot = slot + 1
if slot == 9 then
slot = 10
elseif slot == 13 then
slot = 14
if slot == 4 then
slot = 5
elseif slot == 8 then
slot = 9
end
if item.name ~= "nil" then
selectItem(item.name)
turtle.transferTo(slot, 1)
turtle.select(slot)
takeItems(item.name, item.count)
end
end
turtle.craft()