This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
surazal's profile picture

A More Different Mining Turtle Program

Started by surazal, 01 May 2014 - 05:19 PM
surazal #1
Posted 01 May 2014 - 07:19 PM
Hi everyone! I've been lurking these forums for a while but have never contributed myself until now. For while I have been searching for the perfect mining turtle Lua script that would mine only the interesting ores without leaving these gigantic gaping quarry holes that ruin the scenery no matter what biome you're in. Someone had posted a comment in the forums on this site (I have long ago lost that link) where the ideal mining turtle would dig only 1x1 vertical mineshafts all the way to bedrock, and do so in the same sort of pattern one would use to place water source blocks you see in many sugar cane farms: after digging a hole the next hole would be dug two blocks over and one block up, and this pattern would be repeated across the entire area.

It dawned on me that this pattern of digging would be relatively easy to define in a Lua script, so I wrote one that worked very well. Here's the pastebin link to the current version of the script:

http://pastebin.com/ft3Hm7nS

The procedure for using your mining turtle is as follows:
  1. Place your standard mining turtle towards the area you want mined. Right now the turtle will mine a square area, the lower left-hand corner of which is directly underneath the turtle (the first block that it will start mining will be directly in front of the turtle). When you start the program, the turtle will mine forward and to the right of where it started until it has covered the entire square area
  2. Be sure to fuel up the turtle and label it so it doesn't forget about its state if it's broken
  3. Place a chest behind the turtle, preferably the double-chest. By default, the turtle will mine a 10x10 block area for ores, and it will be bring back a lot of items to store
  4. Place some "ignore" blocks in the turtle's inventory slots starting from slot 1. You can put up to 8 "ignore" blocks in the turtle. Suggested blocks to put in the turtle are listed further down this post
  5. Run the "pastebin" command to download and execute the script referenced in the link above
  6. The script will first ask how many "ignore" blocks you want to configure. You can specify anywhere between 0 to 8. Specifying 0 will cause the mining turtle to mine *everything*, and you will end up with a big gaping hole in the end.
  7. The script will ask you how big an area you want to mine. To mine a 20x20 area, enter 20 (the default is 10x10)
  8. Step back and let it run!
Types of "ignore" blocks that are recommended for most biomes would be:
  • cobble stone
  • smooth stone
  • gravel
  • grass-covered dirt block* (you'll need a tool with silk touch to obtain this)
  • regular dirt block*
*If you are mining in the desert, you'll probably want to switch out the dirt block types for sand and sandstone respectively. Other biomes may also change what you want to be ignored by your mining turtle

Some important notes!!!
  • This software is still relatively untested and *may* result in the loss of your turtle! I've been running it on my worlds without issues, but it's important to realize that you shouldn't run this program unless you're ready to deal with the potential loss of your turtle.
  • Make sure to stay in the area where the turtle is mining and don't let the chunk(s) unload, or your turtle will get stuck. If you have the appropriate mods installed, chunk loaders are your friend
  • The turtle is efficient, but I'd fuel it up to the max before letting it loose since there are no refueling abilities built in to the script. I'm running some tests now to see how much fuel you can expect the turtle to use, but results may vary based on how high you're starting from and how many blocks you've reserved for "ignore blocks (the fewer slots available for legitimate ores, the more frequently the turtle will have to return to base to unload its contents if its inventory ever fills up).
  • This mining turtle program was designed to preserve the landscape to the best of its ability, but there are a few considerations to make. One, it will level the area it's mining so that it has a flat space to work on. Two, once it is done, you'll have a ton of 1x1 holes that will probably go all the way down to bedrock and/or the lava level. Be careful; either fence off the area somehow or remember to (carefully!) fill in those holes at the surface
Changelog
  • New update on 2014-05-02
  • Fixed problem where if a block forms in turtle's path on way back to drop off items (water meets lava, etc), the turtle would have gotten stuck.
Known issues
  • Found issue where it turtle is at bedrock or very near it, it will sometime hang on a "turn" or a "move up" command. It happens largely when a turtle is underwater and happens to be next to a lava (source?) block. I can't replicate the issue under controlled circumstances in creative mode yet, so the root cause is as yet unknown. Only known fix for this is to remove the source of the water or lava, causing the turtle to resume operations as though nothing happened. I haven't seen this issue happen since the latest bug fix, so with any luck I won't see this problem occur again
I am very interested in hearing feedback from people such as bug reports or feature requests.

Happy mining! :D/>
Edited on 05 May 2014 - 03:22 PM
surazal #2
Posted 05 May 2014 - 05:23 PM
Argh, I am a dummy. When I made my latest edit last week to link to the new version of the script, I had accidentally put in the wrong URL from pastebin. I've fixed that now.
Prominer #3
Posted 11 May 2014 - 04:36 PM
Cool script. I'm running it without problems on a multiplayer server. Good job!
BlockSmith #4
Posted 01 June 2014 - 07:22 AM
I've been working on a similar script recently so I won't look at your code. However, when mine is finished we should race/test them against one-another.
Jack #5
Posted 06 June 2014 - 12:31 AM
This is always a danger whenever someone makes a program without checking the forum first…

http://www.computercraft.info/forums2/index.php?/topic/7663-rebootable-rabbit-hole-mining-program/page__p__65063#entry65063

…It's been done before. There are too many similarities to ignore, really. That version has a few more features, but a little plagiarism ought to fix that.
BlockSmith #6
Posted 06 June 2014 - 05:43 PM
Most programs have been done before. Doesn't matter where you check. If everyone looked through forums and scoured for ideas before trying them out for themselves we'd never have any innovation or new concepts for old things. Do you think the wheel was always perfectly round and rubbery? Also, if you think code similarities represent plagiarism, let's hope someone finds another way to do for k, v in pairs… lol