Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Ensure the geoscanner is connected
- local scanner = peripheral.find("geoScanner")
- if not scanner then
- print("No geoscanner found! Attach one to this computer.")
- return
- end
- -- Set scan range
- local scanRange = 16
- -- Main loop to run every 2 seconds
- while true do
- print("\nScanning...")
- local scanResult = scanner.scan(scanRange)
- if not scanResult or #scanResult == 0 then
- print("Scan failed")
- else
- local oreFound = false
- -- Loop through scanned blocks
- for _, block in pairs(scanResult) do
- local blockName = block.name:lower() -- Convert to lowercase for easy matching
- if blockName:find("unobtainium") or blockName:find("vibranium") or blockName:find("allthemodium") or blockName:find("ancient_debris") then
- oreFound = true
- print(string.format("%s found at X: %d, Y: %d, Z: %d", block.name, block.x, block.y, block.z))
- end
- end
- if not oreFound then
- print("nothing")
- end
- end
- -- Wait for 2 seconds before scanning again
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement