Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("turtleGeoScanMine.lua")
- -- todo: decide how you want to set the quarry dimension system up,
- -- the orientation of the chest is determined if its a horizontal/vertical mine
- manual = false
- quarryHostID = 1
- local manualMineableItems = {
- { "minecraft:iron_ore", "minecraft:raw_iron" },
- { "minecraft:deepslate_iron_ore", "minecraft:raw_iron"},
- {"minecraft:redstone_ore", "minecraft:redstone"},
- { "minecraft:deepslate_redstone_ore", "minecraft:redstone"},
- {"minecraft:gold_ore", "minecraft:raw_gold"},
- { "minecraft:deepslate_gold_ore", "minecraft:raw_gold"},
- { "minecraft:deepslate_diamond_ore", "minecraft:diamond" },
- { "minecraft:diamond_ore", "minecraft:diamond" },
- { "minecraft:nether_quartz_ore", "minecraft:quartz" },
- { "minecraft:ancient_debris", "minecraft:netherite_scrap" }
- }
- function findItemSlot(itemName)
- for slot = 1, 16 do
- local itemDetail = turtle.getItemDetail(slot)
- if itemDetail and itemDetail.name == itemName then
- return slot
- end
- end
- return nil
- end
- function equipModemIfNeeded()
- -- Check if a modem is already equipped in the right slot
- local modemSlot = turtle.getItemDetail(3) -- Right slot is slot 3
- if modemSlot and modemSlot.name == "computercraft:wireless_modem_normal" then
- print("Modem already equipped in the right slot.")
- return true
- end
- -- Try to find the modem in the inventory
- local modemSlotIndex = findItemSlot("computercraft:wireless_modem_normal")
- if modemSlotIndex then
- -- Move the modem to the right slot
- turtle.select(modemSlotIndex)
- turtle.equipRight()
- print("Modem equipped in the right slot.")
- return true
- else
- print("No modem found in inventory.")
- return false
- end
- end
- function worker()
- id, message = rednet.receive()
- turtle.equipRight()
- if id == quarryHostID and message ~= nil and type(message) == "table" then
- print("scan approved")
- turtleGeoScanMine.geoMineList(message)
- end
- if id ~= quarryHostID then
- print("ID error")
- end
- if message == nil then
- print("Message nil error")
- end
- if type(message) ~= "table" then
- print("Message Type error")
- print("Type: ")
- print(type(message))
- end
- slot = findItemSlot("computercraft:wireless_modem_normal")
- print(slot)
- if slot ~= nil then
- turtle.select(slot)
- turtle.equipRight()
- rednet.open("right")
- os.sleep(5)
- rednet.send(id, "done")
- turtle.equipRight()
- end
- end
- function manualWorker()
- turtleGeoScanMine.geoMineList(manualMineableItems)
- end
- if manual then
- manualWorker()
- else
- os.sleep(3)
- if equipModemIfNeeded() then
- rednet.open("right")
- worker()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement