Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --collect items from chop_modded.lua
- os.loadAPI("grey_api/move.lua")
- os.loadAPI("grey_api/util.lua")
- local collect_location = {0,-6,0,0}
- local log_location = {0,0,0,0}
- local log = "minecraft:oak_log"
- local misc_location = {0,1,0,0}
- local fuel_location = {0,2,0,0}
- local fuel = "minecraft:coal"
- local fuels = {fuel, "minecraft:stick", log}
- local fuel_locations = {{0,2,0,0},
- {0,0,0,0}}
- local sapling_location = {0,3,0,0}
- local sapling = "minecraft:oak_sapling"
- local seconds_to_wait = 60*20
- local wait_first = false
- local offset_time = 60*2
- local min_fuel_level = 100
- function refuel()
- print("refueling")
- while turtle.getFuelLevel() <= min_fuel_level and util.fuel(1,fuels) do end
- if turtle.getFuelLevel()<=0 then
- print("out of fuel")
- elseif turtle.getFuelLevel()<=min_fuel_level then
- print("low on fuel")
- end
- end
- function collect()
- print("collecting")
- move.goto(collect_location[1],collect_location[2],collect_location[3],collect_location[4])
- while turtle.suckDown() and not util.is_full() do end
- end
- function deposit_logs()
- print("depositing logs")
- local i = 1
- for i=1,16 do
- if turtle.getItemCount(i)>0 and turtle.getItemDetail(i)["name"]==log then
- move.goto(log_location[1],log_location[2],log_location[3],log_location[4])
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- function deposit_fuel()
- print("depositing fuel")
- local i = 1
- for i=1,16 do
- if turtle.getItemCount(i)>0 and turtle.getItemDetail(i)["name"]==fuel then
- move.goto(fuel_location[1],fuel_location[2],fuel_location[3],fuel_location[4])
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- function deposit_saplings()
- print("depositing saplings")
- local i = 1
- for i=1,16 do
- if turtle.getItemCount(i)>0 and turtle.getItemDetail(i)["name"]==sapling then
- move.goto(sapling_location[1],sapling_location[2],sapling_location[3],sapling_location[4])
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- function deposit_misc()
- print("depositing misc")
- local i = 1
- for i=1,16 do
- if turtle.getItemCount(i)>0 then
- move.goto(misc_location[1],misc_location[2],misc_location[3],misc_location[4])
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- function pick_up_fuel()
- print("picking up fuel")
- local fuel_max = 64
- local fuel_needed = fuel_max
- i = 1
- while fuel_needed > 0 and i <= #fuel_locations do
- move.goto(fuel_locations[i][1],fuel_locations[i][2],fuel_locations[i][3],fuel_locations[i][4])
- turtle.suck(fuel_needed)
- fuel_needed = fuel_max - util.count_all_items()
- i = i+1
- end
- if fuel_needed > 0 then
- print("Couldn't find max fuel stores")
- end
- end
- if wait_first then util.wait(seconds_to_wait) end
- util.wait(offset_time)
- while true do
- refuel()
- collect()
- refuel()
- deposit_logs()
- deposit_fuel()
- deposit_saplings()
- deposit_misc()
- pick_up_fuel()
- --wait for next harvest
- move.goto(0,0,0,0)
- util.wait(seconds_to_wait)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement