Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Bootstrap
- --[[
- package.loaded.inventory = nil
- package.loaded.nav = nil
- package.loaded.status = nil
- package.loaded.coord = nil
- os.execute("pastebin get -f ntSeKmpP coord.lua")
- os.execute("pastebin get -f vdUzxZT3 nav.lua")
- os.execute("pastebin get -f 0W0MeXti inventory.lua")
- os.execute("pastebin get -f 4ZnZ2iXE status.lua")
- os.execute("pastebin get -f Xe3EHF5u wither.lua")
- io.write("Done")
- --]]
- local inv = require("inventory")
- local sides = require("sides")
- local status = require("status")
- local nav = require("nav")
- local robot = require("robot")
- local SAND = { name = "minecraft:soul_sand", id = 88 }
- local SKULL = { name = "minecraft:skull", id = 397, damage = 1 }
- local function abort(reason)
- io.write(reason.."\n")
- os.exit()
- end
- local function err(reason)
- io.write(reason.."\n")
- return false, reason
- end
- --Config
- local distanceForward = 6
- local timeBetweenSummons = 12 --seconds
- local timeBetweenStockCheck = 1 --seconds
- --State
- local lastSummon = 0
- local lastStock = 0
- --Init
- local chest = inv.getExternal(sides.bottom)
- if chest == nil then abort("A chest below the robot is required to start") end
- nav.setHome()
- status.set("Initializing")
- --Functions
- function wait()
- local timeSinceLastSummon = os.time() - lastSummon
- local timeSinceLastStock = os.time() - lastStock
- if timeSinceLastStock > timeBetweenStockCheck and timeSinceLastSummon > timeBetweenSummons then return end
- os.sleep(timeBetweenStockCheck)
- end
- function stock()
- robot.select(1)
- lastStock = os.time()
- inv.stock(sides.bottom, SAND, 4)
- inv.stock(sides.bottom, SKULL, 3)
- if inv.count(SAND) < 4 then status.set("Not enough Soul Sand")
- elseif inv.count(SKULL) < 3 then status.set("Not enough Wither Skeleton Skulls")
- else return true end
- return false
- end
- --Hack cuz angel upgrade is broken
- function place()
- for i=1,distanceForward do
- nav.forward()
- end
- nav.down()
- inv.select(SAND)
- robot.placeDown()
- nav.up()
- robot.placeDown()
- nav.forward()
- robot.placeDown()
- inv.select(SKULL)
- robot.back()
- robot.place()
- robot.back()
- robot.place()
- inv.select(SAND)
- robot.placeDown()
- robot.back()
- inv.select(SKULL)
- robot.place()
- for i=1,distanceForward-2 do
- robot.back()
- end
- lastSummon = os.time()
- end
- repeat
- if stock() then
- status.set("Making withers")
- wait()
- place()
- else
- wait()
- end
- until false
Add Comment
Please, Sign In to add comment