This commit is contained in:
Crispy 2025-07-03 01:23:46 +02:00
parent 491112768c
commit 68ec37f994
66 changed files with 6591 additions and 10096 deletions

View file

@ -21,7 +21,14 @@ im = require("inventorymanager")
function fell(index)
im.select("techreborn:rubber_sapling")
pf.lookat(trees[index or math.random(#trees)])
pf.lookat(trees[index],
function()
has, data = turtle.inspect()
if has and data and data.name == "techreborn:rubber_leaves" then
turtle.dig()
end
end
)
has, data = turtle.inspect()
--print(has,data)
if
@ -43,9 +50,17 @@ function fell(index)
turtle.place()
end
repeat
for i = 1,#trees do
fell(i)
end
sleep(300)
until (
(turtle.getFuelLevel() < 500)
or
(im.count("techeborn:rubber_sapling") < 2*#trees)
)
pf.to(pf.home+vector.new(0,10,0))
pf.returnHome()

View file

@ -67,9 +67,11 @@ function greedystep(target)
return true
end
greedystep = require("pathfinding2").greedystep
function to(target)
function to(target, func)
func = func or function() end
print(tostring(target))
while greedystep(target) do
func()
end
end
function returnhome()
@ -89,11 +91,12 @@ function returnhome()
_G.facing = facing
_G.position = position
end
function lookat(target)
function lookat(target, func)
print("lookat"..target:tostring())
while (position+facing).x ~= target.x
or (position+facing).z ~= target.z do
greedystep(target)
if func then func() end
end
print("temp")
temp = target.y-position.y