Posted 04 September 2012 - 07:51 PM
So, after 3 or 4 days now, here's what the little guy can do.
shaft init
this mines a 2x3x2 hole and waits for you to place down a chest to prepare the area for mining.
shaft help
displays a ton of help info
shaft left
digs 5x3x2 blocks to the left, telling you if you forgot to remove the chest (or if there's a block where a chest should be) and then positions itself 4 blocks left from the position it was so you can start a new shaft
shaft right
same thing just without the chest and to the right
shaft length height blocks
this is the main part of the program.
length is the (duh) length of the shaft you want, it goes from 1 to whatever
height is the height of the shaft, by default it's 2 if you just type in the length and it goes up to 60
blocks is the number of blocks in the inventory that will serve as "don't mine this". it goes from 0 to 10 (but 0 might make the turtle go crazy) and is 3 by default, if you don't type in 3 numbers.
the turtle also places down torches every 8 blocks and unless someone jumps infront of him while he's in the process of mining, he should always get back since it he can't move it goes into sleep mode until he can.
it's now also smart enough to ignore bedrock if it finds any but if it's in his main shaft he will go crazy. so ALWAYS start mining at 5+ height to avoid bedrock in a straight path.
and that's about it.
if you have any ideas on how to add onto this, feel free to comment since i'll soon be running out of ideas :D/>/>
edit: changes in 1.7
1. refuel command is now a lot smarter… just trust me on that one :P/>/>
2. made it smarter in collision detection, only way to break it now is to jump on top of it while it's mining a shaft or if it hits bedrock in the main shaft.
3. added option to find it's way back home in case of chunk unloading.
for this to work, you'll also need the startup script
http://pastebin.com/A5X6DuZS
or just "pastebin get A5X6DuZS startup"
4. this is now 95% foolproof i hope :)/>/>
5. unless people really want something specific or someone reports a bug, I think this will be the last update. Only option I might consider adding in 1.8 is auto-branch mining… but having an input look like "shaft 50 4 20 2" is already kinda complicated to use ;)/>/>
edit: changes in 1.71
fixed 2 bugs that caused the turtle to nor properly backtrack. sorry about the derp :)/>/>
also, if you're using 2+ turtles at the same time, the unloading portion of the code will not work since I made them write to the same file. fixable but not critical :)/>/>
pastebin link:
http://pastebin.com/QwkJfVad version 1.71
http://pastebin.com/3EPSHvn2 version 1.7
http://pastebin.com/CTGHjq4Z version 1.5
or you can use "pastebin get QwkJfVad shaft"
big thanks to RandomHavoc for the bedrock suggestion :)/>/>
things to consider adding:
building access to a mining shaft with ladders (straight down 1x2)
building access to a mining shaft with stairs (down diagonal with 3 headspace and stairs)
option to go send it dig X deep
option to dig a quarry X,Y,Z in size
option to dig a quarry underground, starting N deep, X,Y,Z in size
smarter refuel (in case someone tells it to mine a desert) done!
smarter pathfinding (in case someone tells it to go mine a quarry or shaft starting from lvl 5 or lower)
cave exploration mode (if it hits a cave currently it just ignores it cause of pathfinding and refueling issues)
shaft init
this mines a 2x3x2 hole and waits for you to place down a chest to prepare the area for mining.
shaft help
displays a ton of help info
shaft left
digs 5x3x2 blocks to the left, telling you if you forgot to remove the chest (or if there's a block where a chest should be) and then positions itself 4 blocks left from the position it was so you can start a new shaft
shaft right
same thing just without the chest and to the right
shaft length height blocks
this is the main part of the program.
length is the (duh) length of the shaft you want, it goes from 1 to whatever
height is the height of the shaft, by default it's 2 if you just type in the length and it goes up to 60
blocks is the number of blocks in the inventory that will serve as "don't mine this". it goes from 0 to 10 (but 0 might make the turtle go crazy) and is 3 by default, if you don't type in 3 numbers.
the turtle also places down torches every 8 blocks and unless someone jumps infront of him while he's in the process of mining, he should always get back since it he can't move it goes into sleep mode until he can.
it's now also smart enough to ignore bedrock if it finds any but if it's in his main shaft he will go crazy. so ALWAYS start mining at 5+ height to avoid bedrock in a straight path.
and that's about it.
if you have any ideas on how to add onto this, feel free to comment since i'll soon be running out of ideas :D/>/>
edit: changes in 1.7
1. refuel command is now a lot smarter… just trust me on that one :P/>/>
2. made it smarter in collision detection, only way to break it now is to jump on top of it while it's mining a shaft or if it hits bedrock in the main shaft.
3. added option to find it's way back home in case of chunk unloading.
for this to work, you'll also need the startup script
http://pastebin.com/A5X6DuZS
or just "pastebin get A5X6DuZS startup"
4. this is now 95% foolproof i hope :)/>/>
5. unless people really want something specific or someone reports a bug, I think this will be the last update. Only option I might consider adding in 1.8 is auto-branch mining… but having an input look like "shaft 50 4 20 2" is already kinda complicated to use ;)/>/>
edit: changes in 1.71
fixed 2 bugs that caused the turtle to nor properly backtrack. sorry about the derp :)/>/>
also, if you're using 2+ turtles at the same time, the unloading portion of the code will not work since I made them write to the same file. fixable but not critical :)/>/>
pastebin link:
http://pastebin.com/QwkJfVad version 1.71
or you can use "pastebin get QwkJfVad shaft"
big thanks to RandomHavoc for the bedrock suggestion :)/>/>
things to consider adding:
building access to a mining shaft with ladders (straight down 1x2)
building access to a mining shaft with stairs (down diagonal with 3 headspace and stairs)
option to go send it dig X deep
option to dig a quarry X,Y,Z in size
option to dig a quarry underground, starting N deep, X,Y,Z in size
smarter pathfinding (in case someone tells it to go mine a quarry or shaft starting from lvl 5 or lower)
cave exploration mode (if it hits a cave currently it just ignores it cause of pathfinding and refueling issues)