I'm just learning lua and this thing went through 5 versions this weekend, slowly adding more features. It works very well for my needs, so I thought I would share. I've tried to break it (mobs, gravel) but I think it's fairly durable. The code will be messy as I don't know the more advanced shortcuts and proper formatting.
What it does:
- Tunnel Length (Must be an even number)
- Returns to exact starting location
- Handles refueling
- Fuel in Slot 1
- Smart refueling: You tell it what type of fuel you have (from limited common fuels) and it only refuels as needed.
- Option to place an inset torch every 4 blocks
- Will warn you if you don't have enough torches for your tunnel length before beginning.
- As of right now, there has to be a place for the torch to set. It digs the inset, but no building.
- Torches in Slot 3
- Option to toss cobblestone on the floor
- This checks every 4 steps forward and it requires you to follow the directions by placing 1 cobblestone in Slot 2.
- Option to pause mid-tunnel to return to chest to drop off items if turtle inventory fills
- Chest must be immediately behind turtle start position
- Turtle will drop off items and return to finish the tunnel and then return to starting position
XXX
XXX
XXX
Please let me know if you run into any problems aside from the torch issue mentioned above.
v1
v2
- Fixed turtles running out of fuel while returning home from long distances (added a check)
- Fixed the turtle return path becoming obstructed if something fell as the result of player action (now checks and removes blocks)
- Added a progress meter (Progress: Current of Total
- Error produced on servers where fuel isn't required. I fixed this by adding an option for unlimited fuel.
- Turtle getting lost if the player blocks its path during the full inventory chest drop-off trip has been corrected.
- It seems that cans/cells/capsules are not working correctly anymore as a fuel source. I added a note to be sure they work in your version before selecting them as a fuel. I will remove this if I find that they're never going to be a fuel option again.
- Added an option to drop off ALL items into a chest upon completion. This works in addition to mid-cycle drops.
- Added an option to terminate program at the end of the tunnel once complete (dropping down to bottom left corner) enabling you to continue tunneling in the same direction without having to move the turtle. Note, however, that while this still enables mid-cycle chest depositing to work, it will negate end-of-cycle chest depositing.
- In the works: Custom tunnel dimensions. I've the width worked out, but I'm not ready to implement until I get it all working as I like.