Posted 18 January 2014 - 10:20 AM
I am new to computercraft and LUA, but not new to programming. I totally refused to even try other programs cause i like to experiment with these things :P/> It's like a game on its own. Anyway, i have gotten 3 turtle programs to so stable state that i can show them to you. They all use similar code with minor differences.
Turtle inventory slot 15 is for charcoal enderchest. It assumes you have other same color coded enderchest somewhere to keep the chest always full.
Inventory slot 16 is for another enderchest, used to dump all loot away to your sorting system. Resume should work on Quarry and Orequarry now. Use startup program to automate it, or manually type without parameters "quarry" or "orequarry" to resume them, whichever program was running.
1. Quarry
http://pastebin.com/aDaDM2Kr
You can use more specific commands like "quarry 2 3 100" would dig 2 wide, 3 high and 100 blocks deep tunnel.
Turtle will continue until the quarry is entirely digged, and then come back to where it started. It will occasionally place enderchest on top of itself to empty inventory, dig it back and carry on. Same for fuel.
2. Orequarry
http://pastebin.com/JaJQcv4q
Inventory slot 1 is used for 1 stone block (cobblestone won't do) so it knows to not dig them if possible.
Works similar to 1.Quarry program, but will not dig stone from up or down. This turtle will come back directly, most likely digging some things left blocking the way.
3. Treecut
http://pastebin.com/LVYDbAzc
This one is simple to use; place in front of a tree and tell it "cut"… and it will cut the entire tree down :lol:/> It starts by measuring depth of the tree by digging hole through it. At this point it knows min and max Z, so now it comes back half way and digs right. Assuming that tree width and depth are same, once it detects empty block, it has determined min and max X aswell. (NOTE: grass or dirt blocks may confuse it, thinking they are part of tree too, so have the ground around tree levelled). Now it goes back to middle and cuts to treetop, goes minX, minZ and starts script similar to 1. Quarry.
This will cut any size of trees, 1x1, 2x2 or even giant 13x13 redwood trees (i know it works cause my turtles have cut over 7 of them so far). It will leave branches there though…
Extra note on treecut program; the script ends by moving itself to where it started from. But the way i did it is using a bit more sophisticated function, it could in the future be used in all movements of these programs. You can tell the function to move to any coordinate (relative to where it started from), and it will automatically turn and move in efficient way.
4. Startup
http://pastebin.com/fLpm3c9g
Startup program will take care of resuming work on chunkloading or server restart. Potentially supports all 3 above programs, but at the time of writing this, only 1. quarry program supports resume, and is still being tested for bugs.
Finally
And don't forget to put up a chunkloader to cover the entire work areas. Turtles are very lightweight for performance, when compared to buildcraft quarrys, but if you put 4 turtles each dig 32x32 areas, that's 64x64 quarry overall and very cheap to make. This is what i get with such:
[attachment=1446:ores.jpg]
There are 4 thermal centrifuges with 3x overclocks processing that chest… they can't keep up in the turtles pace!
Turtle inventory slot 15 is for charcoal enderchest. It assumes you have other same color coded enderchest somewhere to keep the chest always full.
Inventory slot 16 is for another enderchest, used to dump all loot away to your sorting system. Resume should work on Quarry and Orequarry now. Use startup program to automate it, or manually type without parameters "quarry" or "orequarry" to resume them, whichever program was running.
1. Quarry
http://pastebin.com/aDaDM2Kr
#####
#####
#####
####^
Place turtle in bottom right corner of quarry you want, and it will head forward from there. If started with command "quarry 20 40", it will dig width 20 and depth 40 size quarry all the way down to bedrock. Will dig everything in its path and attempt to also suck in dungeon chests, because i noticed that dig() will not break full chests. Turtle will be moving in "S"-pattern and digging blocks front, up and down, then moving 3 rows down and so on.You can use more specific commands like "quarry 2 3 100" would dig 2 wide, 3 high and 100 blocks deep tunnel.
Turtle will continue until the quarry is entirely digged, and then come back to where it started. It will occasionally place enderchest on top of itself to empty inventory, dig it back and carry on. Same for fuel.
2. Orequarry
http://pastebin.com/JaJQcv4q
Inventory slot 1 is used for 1 stone block (cobblestone won't do) so it knows to not dig them if possible.
Works similar to 1.Quarry program, but will not dig stone from up or down. This turtle will come back directly, most likely digging some things left blocking the way.
3. Treecut
http://pastebin.com/LVYDbAzc
This one is simple to use; place in front of a tree and tell it "cut"… and it will cut the entire tree down :lol:/> It starts by measuring depth of the tree by digging hole through it. At this point it knows min and max Z, so now it comes back half way and digs right. Assuming that tree width and depth are same, once it detects empty block, it has determined min and max X aswell. (NOTE: grass or dirt blocks may confuse it, thinking they are part of tree too, so have the ground around tree levelled). Now it goes back to middle and cuts to treetop, goes minX, minZ and starts script similar to 1. Quarry.
This will cut any size of trees, 1x1, 2x2 or even giant 13x13 redwood trees (i know it works cause my turtles have cut over 7 of them so far). It will leave branches there though…
Extra note on treecut program; the script ends by moving itself to where it started from. But the way i did it is using a bit more sophisticated function, it could in the future be used in all movements of these programs. You can tell the function to move to any coordinate (relative to where it started from), and it will automatically turn and move in efficient way.
4. Startup
http://pastebin.com/fLpm3c9g
Startup program will take care of resuming work on chunkloading or server restart. Potentially supports all 3 above programs, but at the time of writing this, only 1. quarry program supports resume, and is still being tested for bugs.
Finally
And don't forget to put up a chunkloader to cover the entire work areas. Turtles are very lightweight for performance, when compared to buildcraft quarrys, but if you put 4 turtles each dig 32x32 areas, that's 64x64 quarry overall and very cheap to make. This is what i get with such:
[attachment=1446:ores.jpg]
There are 4 thermal centrifuges with 3x overclocks processing that chest… they can't keep up in the turtles pace!
Edited on 21 January 2014 - 05:41 AM