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

Vein Miner

Started by rdalkire, 02 January 2016 - 06:10 AM
rdalkire #1
Posted 02 January 2016 - 07:10 AM
Meant to completely harvest mature trees with branches, or aggregates of ore.

http://youtu.be/6R1DVrMxPL0

See details in the video comments and/or below:

Stand-alone usage:
1. Install the script to a mining turtle:
pastebin get XguAbG4T vMiner

2. Place the turtle so that it faces the material that you want.
3. Refuel if needed. For mature oak trees, I think 500 units should be more than enough but I recommend generousness; make it an even 1000.
4. Run the script:
vMiner


______
You can also use its components to help create or enhance other scripts, like full quarries and tree farms.
https://github.com/r.../turtleApps/src

From there, see veinMiner.lua and deadReckoner.lua.

The deadReckoner keeps track of the turtle's bearing and location relative to where it started, and translates which way you want it to face (bear to starboard) to relative directions (turn left twice). This helps the programmer to manage complicated movement.

For ex-situ unit testing, I suggest you use/modify testDeadReckonerAndVeinMiner.lua and mockTurtle.lua to your own liking. Then you can run/debug the routines in eclipse.

When ready, "compile" the stand-alone by pasting the two components into a single file, fix the "require" statements at the top and call the "vm.mine()" function at the bottom.
See https://github.com/r...nerCompiled.lua

The git repository is a pair of nested Eclipse Lua Development Tools (LDT) projects: computercraft-programs (presently empty, except for turtleApps), and turtleApps itself.

My scripts are all copyrighted with the MIT license which means you're allowed to do pretty much whatever you like with them -copy, modify, redistribute, sell… just keep the license and my names intact, and add your own name(s) to the lists as applicable.
rdalkire #2
Posted 10 January 2016 - 04:27 PM
Note, there's a limitation with redstone blocks, because the matching happens by block name. When the redstone blocks light up, their name changes to "…lit_redstone_ore", so they no longer match.
Yarillo #3
Posted 10 January 2016 - 08:58 PM
That's pretty impressive !
rdalkire #4
Posted 10 January 2016 - 10:01 PM
Thanks for the ego bump Yarillo, now I'm going to be even harder to live with.
:-)

But anyway:

I have added an optional 'a' parameter, which cause turtle to dig all blocks around any block which matches the initial one. I did this because I didn't like the super-ugly spaces left behind when mining in caves.
Use by simply adding 'a' after the name of the script, like this:
vMiner a
Easier to explain with video:
http://youtu.be/x8VANknYr8k
The pastebin identifier is unchanged.
Edited on 10 January 2016 - 09:06 PM
rdalkire #5
Posted 18 January 2016 - 06:27 PM
Now a new 'r' parameter is added, meaning "room" or "rectangular prism".
The program now tracks the minimum and maximum coordinates that the turtle has inspected or moved to.
And if you launch with r, the turtle will act as if 'a' was used (digging out inspected blocks) but then it will also "clean-up" the space afterward, using min and max coords to clear all remaining blocks in the rectangle between. Takes up a little more fuel and time than 'a', but makes a better looking place. Good for making shelters when you're exploring big scary caves.
vMiner r
http://youtu.be/tNgtO_PR9z4
rdalkire #6
Posted 01 February 2016 - 03:08 AM
Once while using the program I fat-fingered the parameter, putting in -r instead of r. The program printed a warning, saying that -r is an invalid parameter, but then it continued to run as if I hadn't put any param at all.
Annoying, right? I've changed it so it will stop if the param is no good, so you can correct it calmly rather than go chasing after it, or standing back to sigh in exasperation. You're welcome.
Bug38 #7
Posted 10 January 2017 - 01:02 PM
Hi,

This topic is quite very old, but your script seems quite very useful.

I juste have some questions: what happens if…
- the turtle is full ?
- the turtle runs low / out of fuel ?
- the turtle is unloaded (will it continue at reboot, and save its state) ?

Thx,

Bug38