←  Turtle Programs

ComputerCraft | Programmable Computers for Minecraft

»

Rebootable rabbit hole mining program

eonsv's Photo eonsv 27 Dec 2012

Hello,

I've had a lot of problems with unstable servers, and people complaining about my quarry world holes, made by my strip-mining turtles. Therefore I've made a program which handles these problems. It basically digs vertical mine-shafts and checks the walls for ores. It probably isn't the most time efficient way to do a quarry, but it saves the environment for ugly world holes, and it gets the job done. ;)

Download:
Pastebin link: http://pastebin.com/JbFMHaNg
Pastebin id: JbFMHaNg


Use as follows:
Setup inventory as follows:
Slot 1: Enderchest if you want automatic inventory disposal.
Slot 2: Fuel, if you want automatic fuelling.
Slot 3: Materials for filling holes, if you want holes to be filled.
Slot 4-15: Blocks to ignore.
Slot 16: Empty
Then run the program as follows:
dig <length> <width> <right(r )/left(l)>
Example:
dig 25 25 r
This makes the turtle mine a 25 by 25 area, starting to move to the right.

You can also run the program without input parameters, to display help instructions.

The current features are:
-Saves the progress and resumes where it left off when it's rebooted.
-Can specify up to 12 blocks to ignore. And will toss all unwanted blocks.
-It digs holes in a pattern similar to where the water is located in the most space efficient reed farm. (The X's in the diagram below)

. X . . . . X . . .
. . . . X . . . . X
. . X . . . . X . .
X . . . . X . . . .
. . . X . . . . X .
. X . . . . X . . .
. . . . X . . . . X
. . X . . . . X . .
X . . . . X . . . .
. . . X . . . . X .

-Digs until it hits bedrock for each hole.
-Automatic item disposal to an enderchest, and a choice for manual inventory handling if you prefer that.
-Smart digging and moving: can handle gravel, sand and mobs.
-Autofueling.
-Filling the top layer of the holes with a block type specified.

Planned features:
-Wireless control.
-Some sort of gui or menu.
-Better manual handling of the inventory (getting out of the hole when the inventory is full or something similar).
-Specify a dig height, instead of digging straight to bedrock.
-Automatically updating if a new version of the script is available.
-Enderchest support for refuelling.

Dependencies:
-Enabled http


It depends on two other programs as well (there's on need to download them, the dig program does this by itself if they're not installed). If you want to take a look at them, here's the links:
Move and dig API: http://pastebin.com/s8GSFZrU
startup program: http://pastebin.com/CDCELxfj

I appreciate inputs if you use this program. :) And please report bugs if you find any!
Quote

Jack's Photo Jack 28 Dec 2012

Interesting! It might be nice if it could detect useful ores around it and mine those. It's a good concept and it works. Nice job.
Quote

eonsv's Photo eonsv 28 Dec 2012

I'm not sure of what you mean by detecting usefull ores and mine those. Do you mean that if it detects some ores it will mine the whole vein? Or just mine those adjacent to it? As it already does the last one, if the blocks aren't stone or dirt. Or do you want to specify which ores to find and collect instead of which to not collect? Anyway thanks for feedback! :)
Quote

Jack's Photo Jack 29 Dec 2012

Let me take another look at that code.
...
There's no need to mine the whole vein; it already takes care of that with its mining pattern. Maybe I'm being a little obtuse... but where's the main loop located? I see a lot of nice functions, but where does it execute the pattern and dig?

Anyway, I was just going to suggest a way of preconfiguring the turtle. Ideally, I see this turtle as containing a fuel slot, and in all the other slots, samples of the block types that should be ignored. At the beginning of the program, it should identify which slots (besides fuel) are non-empty, and add their indices to a list. Then, as it mines, it compares only to those in the list and tosses those that match. It would be highly configurable and easy to use. And possibly impossible to program. :)
Quote

eonsv's Photo eonsv 29 Dec 2012

Aha, I see what you mean now :) Thanks for the ideas! I've never thought about having a slot for fuel. The main function(or main loop as you call it) is at the very bottom of the script (Labeled --MAIN--). I'll implement your ideas and comment the code when I get the time. (It shouldn't be impossible as I've done something similar with a treefarm program).
Quote

meanoboy's Photo meanoboy 29 Dec 2012

So I seem to have an issue with getting this program to work for me. Perhaps im doing something wrong, but instead of the turtle putting stuff into the Enderchest, it dumps it all on the ground and keeps digging. I end up losing lots of stuff in lava. All I did was follow the instructions as to where I place the chest and other blocks. It took off like i would expect after giving it everything it asked for. As to all the mods im using, Im using FTB laucher and direwolf20's mod pack.
Quote

eonsv's Photo eonsv 29 Dec 2012

Seems like i did a huge derp in the item disposal part of the script. I'll fix it asap. Thanks for the heads up! :) And sorry for the loss of your items.

Edit: it shoud be fixed now.
Quote

Jorgun's Photo Jorgun 31 Dec 2012

love this program bur ran into a proble,
the protLib api was not loading on reboot so i added it to my startup program
as for idea, add a slot for cobble and make it plug the hole when it comes back up
Quote

eonsv's Photo eonsv 31 Dec 2012

Thanks for the heads up with that bug, and for your idea! :) I'll implement it as soon as I can, as that's a very handy feature. And I've fixed the bug, just redownload the script. ;)

Edit: I've updated the program to include Jack's and Jorgun's suggestions, as well as some bug fixes.
Quote

Kane Hart's Photo Kane Hart 02 Jan 2013

It says auto fuel but I don't see any info on how does it get more fuel? Does it grab it from a ender chest or something else?
Quote

eonsv's Photo eonsv 02 Jan 2013

It will grab fuel which is mined, if it is similar to the type you initially put in. Therefore it will use coal it finds while mining if you inserted coal. I'll maybe implement an enderchest for fuel some time later if I find it necessary.
Quote

Kane Hart's Photo Kane Hart 02 Jan 2013

View Posteonsv, on 02 January 2013 - 04:30 PM, said:

It will grab fuel which is mined, if it is similar to the type you initially put in. Therefore it will use coal it finds while mining if you inserted coal. I'll maybe implement an enderchest for fuel some time later if I find it necessary.

Have you ever ran out of coal before while mining? That was actually what I was worried about myself. I think coal was nerfed a bit more too.
Quote

eonsv's Photo eonsv 02 Jan 2013

Nope I haven't had that problem, but my quarries are usually not really huge. If it does run out, it will just stop and wait for you to insert some coal before continuing. I'll make it stop before digging a hole if it hasn't got enough fuel for digging and getting back up, when i get time. So it won't get stuck down there.
Quote

simwah's Photo simwah 02 Jan 2013

Does that mean your commenting is wrong around the refill section, it mentions enderchest?
Quote

eonsv's Photo eonsv 03 Jan 2013

View Postsimwah, on 02 January 2013 - 05:53 PM, said:

Does that mean your commenting is wrong around the refill section, it mentions enderchest?

There is no mentioning of an enderchest in the refill part of the code. I rechecked just to be certain as well, and I didn't find anything. So I'm a bit confused now :P
Quote

simwah's Photo simwah 03 Jan 2013

Sorry i was refeerence a wrong pastebin file. ignore my comment
Quote

simwah's Photo simwah 03 Jan 2013

Just noticed, if i do the follow.

Ender in slot 1, 64 stack of coal in slot 2, 64 stack of cobble in slot 3, gravel in 4, dirt in 5, sand in 6 and stone in 7
then run dig 64 64 left 67

The bot dump the coal on the ground and shuffles all the stock in the inventory up 1, (cobble goes into 2, gravel 3, dirt 4, sand 5, and stone 6)
The bot then just keeps asking for refulling, if i dump a few stacks in slots 7-15 it will suck up the coal and start
Quote

eonsv's Photo eonsv 03 Jan 2013

Thanks for letting me know about that issue, it should be fixed now (I used that as a test when I implemented some new stuff, and forgot about it). If you want to let the turtle refuel itself when it gets low on fuel, instead of fuelling it up at the beginning, then just don't use the fourth parameter.
Quote

Kane Hart's Photo Kane Hart 03 Jan 2013

so if you place ender chest in 1 it auto dumps items into it?
Quote

eonsv's Photo eonsv 03 Jan 2013

Exactly :)
Quote